Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.253
diff -u -p -r1.253 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	30 Nov 2010 19:31:46 -0000	1.253
+++ modules/simpletest/drupal_web_test_case.php	3 Dec 2010 03:40:18 -0000
@@ -1750,7 +1750,7 @@ class DrupalWebTestCase extends DrupalTe
         $submit_matches = $this->handleForm($post, $edit, $upload, $ajax ? NULL : $submit, $form);
         $action = isset($form['action']) ? $this->getAbsoluteUrl($form['action']) : $this->getUrl();
         if ($ajax) {
-          $action = $this->getAbsoluteUrl(!empty($submit['path']) ? $submit['path'] : 'system/ajax');
+          $action = $this->getAbsoluteUrl(!empty($submit['path']) ? $submit['path'] : url('system/ajax'));
           // AJAX callbacks verify the triggering element if necessary, so while
           // we may eventually want extra code that verifies it in the
           // handleForm() function, it's not currently a requirement.
@@ -2355,7 +2355,8 @@ class DrupalWebTestCase extends DrupalTe
    * @param $path
    *   A path from the internal browser content.
    * @return
-   *   The $path with $base_url prepended, if necessary.
+   *   The $path with the internal browser's base URL or $base_url prepended, if
+   *   necessary.
    */
   protected function getAbsoluteUrl($path) {
     global $base_url, $base_path;
@@ -2364,6 +2365,20 @@ class DrupalWebTestCase extends DrupalTe
     if (empty($parts['host'])) {
       // Ensure that we have a string (and no xpath object).
       $path = (string) $path;
+      // Return an absolute URL based on the internal browser's current URL if
+      // it is not using the internal: scheme.
+      $parts = parse_url($this->getUrl());
+      if ($parts['scheme'] != 'internal') {
+        $port = isset($parts['port']) ? ':' . $parts['port'] : '';
+        $url = $parts['scheme'] . '://' . $parts['host'] . $port;
+        if ($path[0] === '/') {
+          $url .= $path;
+        }
+        else {
+          $url .= preg_replace('@(.*/)([^/]*)@', '$1' . $path, $parts['path']);
+        }
+        return $url;
+      }
       // Strip $base_path, if existent.
       $length = strlen($base_path);
       if (substr($path, 0, $length) === $base_path) {
Index: modules/simpletest/tests/ajax.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/ajax.test,v
retrieving revision 1.21
diff -u -p -r1.21 ajax.test
--- modules/simpletest/tests/ajax.test	29 Nov 2010 03:00:50 -0000	1.21
+++ modules/simpletest/tests/ajax.test	3 Dec 2010 03:40:18 -0000
@@ -389,7 +389,7 @@ class AJAXMultiFormTestCase extends AJAX
     // page update, ensure the same as above.
     foreach ($field_xpaths as $form_html_id => $field_xpath) {
       for ($i = 0; $i < 2; $i++) {
-        $this->drupalPostAJAX(NULL, array(), array($button_name => $button_value), 'system/ajax', array(), array(), $form_html_id);
+        $this->drupalPostAJAX(NULL, array(), array($button_name => $button_value), url('system/ajax'), array(), array(), $form_html_id);
         $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == $i+2, t('Found the correct number of field items after an AJAX submission.'));
         $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, t('Found the "add more" button after an AJAX submission.'));
         $this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other');
