Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1177 diff -u -p -r1.1177 common.inc --- includes/common.inc 17 Jun 2010 13:44:44 -0000 1.1177 +++ includes/common.inc 20 Jun 2010 13:07:40 -0000 @@ -3602,10 +3602,15 @@ function drupal_add_js($data = NULL, $op // Add jquery.js and drupal.js, as well as the basePath setting, the // first time a Javascript file is added. if (empty($javascript)) { + // url() generates the prefix using hook_url_outbound_alter(). Instead of + // running the drupal_alter('url_outbound') again here, extract the prefix + // from url(). + url('', array('prefix' => &$prefix)); $javascript = array( 'settings' => array( 'data' => array( array('basePath' => base_path()), + array('pathPrefix' => empty($prefix) ? '' : $prefix), ), 'type' => 'setting', 'scope' => 'header', Index: modules/overlay/overlay-parent.js =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v retrieving revision 1.48 diff -u -p -r1.48 overlay-parent.js --- modules/overlay/overlay-parent.js 13 Jun 2010 05:47:47 -0000 1.48 +++ modules/overlay/overlay-parent.js 20 Jun 2010 13:07:40 -0000 @@ -307,8 +307,9 @@ Drupal.overlay.isAdminLink = function (u // Turn the list of administrative paths into a regular expression. if (!this.adminPathRegExp) { - var adminPaths = '^(' + Drupal.settings.overlay.paths.admin.replace(/\s+/g, ')$|^(') + ')$'; - var nonAdminPaths = '^(' + Drupal.settings.overlay.paths.non_admin.replace(/\s+/g, ')$|^(') + ')$'; + var regExpPrefix = '^' + Drupal.settings.pathPrefix + '('; + var adminPaths = regExpPrefix + Drupal.settings.overlay.paths.admin.replace(/\s+/g, ')$|' + regExpPrefix) + ')$'; + var nonAdminPaths = regExpPrefix + Drupal.settings.overlay.paths.non_admin.replace(/\s+/g, ')$|'+ regExpPrefix) + ')$'; adminPaths = adminPaths.replace(/\*/g, '.*'); nonAdminPaths = nonAdminPaths.replace(/\*/g, '.*'); this.adminPathRegExp = new RegExp(adminPaths); Index: modules/simpletest/tests/ajax.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/ajax.test,v retrieving revision 1.11 diff -u -p -r1.11 ajax.test --- modules/simpletest/tests/ajax.test 30 Apr 2010 08:07:55 -0000 1.11 +++ modules/simpletest/tests/ajax.test 20 Jun 2010 13:07:40 -0000 @@ -47,6 +47,9 @@ class AJAXFrameworkTestCase extends AJAX $this->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.')); // Verify that basePath is contained in JavaScript settings. $this->assertEqual($result[0]['settings']['basePath'], base_path(), t('Base path is contained in JavaScript settings.')); + // Verify that pathPrefix is contained in JavaScript settings. + url('', array('prefix' => &$prefix)); + $this->assertEqual($result[0]['settings']['pathPrefix'], empty($prefix) ? '' : $prefix, t('Path prefix is contained in JavaScript settings.')); } /** Index: modules/simpletest/tests/common.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v retrieving revision 1.113 diff -u -p -r1.113 common.test --- modules/simpletest/tests/common.test 17 Jun 2010 13:16:57 -0000 1.113 +++ modules/simpletest/tests/common.test 20 Jun 2010 13:07:40 -0000 @@ -1098,6 +1098,8 @@ class JavaScriptTestCase extends DrupalW $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), t('Drupal.js is added when file is added.')); $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), t('JavaScript files are correctly added.')); $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], t('Base path JavaScript setting is correctly set.')); + url('', array('prefix' => &$prefix)); + $this->assertEqual(empty($prefix) ? '' : $prefix, $javascript['settings']['data'][1]['pathPrefix'], t('Path prefix JavaScript setting is correctly set.')); } /** @@ -1105,8 +1107,8 @@ class JavaScriptTestCase extends DrupalW */ function testAddSetting() { $javascript = drupal_add_js(array('drupal' => 'rocks', 'dries' => 280342800), 'setting'); - $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], t('JavaScript setting is set correctly.')); - $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], t('The other JavaScript setting is set correctly.')); + $this->assertEqual(280342800, $javascript['settings']['data'][2]['dries'], t('JavaScript setting is set correctly.')); + $this->assertEqual('rocks', $javascript['settings']['data'][2]['drupal'], t('The other JavaScript setting is set correctly.')); } /** @@ -1125,6 +1127,7 @@ class JavaScriptTestCase extends DrupalW drupal_add_js(array('testSetting' => 'testValue'), 'setting'); $javascript = drupal_get_js('header'); $this->assertTrue(strpos($javascript, 'basePath') > 0, t('Rendered JavaScript header returns basePath setting.')); + $this->assertTrue(strpos($javascript, 'pathPrefix') > 0, t('Rendered JavaScript header returns pathPrefix setting.')); $this->assertTrue(strpos($javascript, 'testSetting') > 0, t('Rendered JavaScript header returns custom setting.')); $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, t('Rendered JavaScript header includes jQuery.')); }