Bug 574189 - Fix chrome tests so they can run from a .jar bundle (e10s, android) r=ctalbert a=NPOTB
authorJoel Maher <jmaher@mozilla.com>
Fri, 20 Aug 2010 09:28:13 -0700
changeset 51031 38cc0d7d66672bdc7cdd877f9f6c579038c86260
parent 51030 b3e34d6dbc4bd0ee34b06e3d8944382ea166104e
child 51032 d62bc37cb42efe8dafa403bc7bc8652c31d43589
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersctalbert, NPOTB
bugs574189
milestone2.0b5pre
Bug 574189 - Fix chrome tests so they can run from a .jar bundle (e10s, android) r=ctalbert a=NPOTB
content/events/test/test_bug415498.xul
content/events/test/test_bug508479.html
content/events/test/test_draggableprop.html
content/events/test/test_dragstart.html
content/html/content/test/test_bug417760.html
content/xul/content/test/test_bug398289.html
content/xul/templates/tests/chrome/templates_shared.js
content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters.xul
content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_2.xul
content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_3.xul
content/xul/templates/tests/chrome/test_tmpl_storage_badquery.xul
content/xul/templates/tests/chrome/test_tmpl_storage_dynamicparameters.xul
content/xul/templates/tests/chrome/test_tmpl_storage_listbox.xul
content/xul/templates/tests/chrome/test_tmpl_storage_multiqueries.xul
content/xul/templates/tests/chrome/test_tmpl_storage_parameters.xul
content/xul/templates/tests/chrome/test_tmpl_storage_rule.xul
content/xul/templates/tests/chrome/test_tmpl_storage_simple.xul
content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerasc.xul
content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerdesc.xul
content/xul/templates/tests/chrome/test_tmpl_storage_sortstringasc.xul
content/xul/templates/tests/chrome/test_tmpl_storage_sortstringdesc.xul
content/xul/templates/tests/chrome/test_tmpl_storage_tree.xul
content/xul/templates/tests/test_bug441785.xul
content/xul/templates/tests/test_sortservice.xul
docshell/test/chrome/bug293235_window.xul
docshell/test/chrome/bug294258_window.xul
docshell/test/chrome/bug298622_window.xul
docshell/test/chrome/bug301397_window.xul
docshell/test/chrome/bug303267_window.xul
docshell/test/chrome/bug321671_window.xul
docshell/test/chrome/bug360511_window.xul
docshell/test/chrome/bug396649_window.xul
docshell/test/chrome/window.template.txt
docshell/test/test_bug529119-1.html
docshell/test/test_bug529119-2.html
dom/tests/mochitest/general/test_focusrings.xul
dom/tests/mochitest/whatwg/test_postMessage_chrome.html
editor/libeditor/html/tests/test_contenteditable_focus.html
editor/libeditor/html/tests/test_contenteditable_text_input_handling.html
editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
editor/libeditor/html/tests/test_root_element_replacement.html
editor/libeditor/html/tests/test_select_all_without_body.html
editor/libeditor/text/tests/test_texteditor_keyevent_handling.html
js/src/xpconnect/tests/chrome/test_bug503926.xul
modules/libjar/test/chrome/test_bug386153.html
modules/plugin/test/mochitest/test_bug532208.html
modules/plugin/test/mochitest/test_cocoa_focus.html
modules/plugin/test/mochitest/test_cocoa_window_focus.html
modules/plugin/test/mochitest/test_cookies.html
modules/plugin/test/mochitest/test_crash_nested_loop.html
modules/plugin/test/mochitest/test_crashing.html
modules/plugin/test/mochitest/test_crashing2.html
modules/plugin/test/mochitest/test_enumerate.html
modules/plugin/test/mochitest/test_hanging.html
modules/plugin/test/mochitest/test_instantiation.html
modules/plugin/test/mochitest/test_multipleinstanceobjects.html
modules/plugin/test/mochitest/test_newstreamondestroy.html
modules/plugin/test/mochitest/test_npobject_getters.html
modules/plugin/test/mochitest/test_streamNotify.html
security/manager/ssl/tests/mochitest/bugs/test_bug480509.html
security/manager/ssl/tests/mochitest/bugs/test_bug483440.html
security/manager/ssl/tests/mochitest/bugs/test_bug484111.html
testing/mochitest/Makefile.in
testing/mochitest/browser-test.js
testing/mochitest/chrome-harness.js
testing/mochitest/tests/SimpleTest/tests/test_synthesizeDragStart.xul
testing/mochitest/tests/SimpleTest/tests/test_synthesizeDrop.xul
toolkit/components/ctypes/tests/test_ctypes.xul
toolkit/components/places/tests/chrome/test_329534.xul
toolkit/content/tests/chrome/RegisterUnregisterChrome.js
toolkit/content/tests/chrome/rtlchrome/rtl.manifest
toolkit/content/tests/chrome/test_bug437844.xul
toolkit/content/tests/chrome/test_righttoleft.xul
toolkit/content/tests/widgets/test_button.xul
toolkit/content/tests/widgets/test_deck.xul
toolkit/content/tests/widgets/test_props.xul
toolkit/content/tests/widgets/test_richlist_direction.xul
toolkit/content/tests/widgets/test_statusbar.xul
toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
toolkit/mozapps/downloads/tests/chrome/test_basic_functionality.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_429247.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
toolkit/mozapps/downloads/tests/chrome/test_clear_button_disabled.xul
toolkit/mozapps/downloads/tests/chrome/test_close_download_manager.xul
toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
toolkit/mozapps/downloads/tests/chrome/test_esc_key_closes_clears.xul
toolkit/mozapps/downloads/tests/chrome/test_multi_select.xul
toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
toolkit/mozapps/downloads/tests/chrome/test_pause_button_state.xul
toolkit/mozapps/downloads/tests/chrome/test_privatebrowsing_title.xul
toolkit/mozapps/downloads/tests/chrome/test_removeDownload_updates_ui.xul
toolkit/mozapps/downloads/tests/chrome/test_retention_is_0_closes.xul
toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
toolkit/mozapps/downloads/tests/chrome/test_space_key_pauses_resumes.xul
toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_downloadstates.xul
toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_service.xul
toolkit/mozapps/downloads/tests/chrome/test_ui_stays_open_on_alert_clickback.xul
toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
toolkit/mozapps/extensions/test/browser/head.js
toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul
toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul
toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul
toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul
toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul
toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul
toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul
toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul
toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul
toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul
toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul
toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul
toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul
toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul
toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul
toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul
toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul
toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul
toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul
toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul
toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul
toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul
toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul
toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul
toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul
toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul
toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
toolkit/mozapps/update/test/chrome/test_0091_installed.xul
toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul
toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul
toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul
toolkit/xre/test/test_fpuhandler.html
--- a/content/events/test/test_bug415498.xul
+++ b/content/events/test/test_bug415498.xul
@@ -9,28 +9,32 @@ https://bugzilla.mozilla.org/show_bug.cg
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   onload="init()">
 
   <title>Test for Bug 415498</title>
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/chrome-harness.js"></script>
 <body  xmlns="http://www.w3.org/1999/xhtml">
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=415498">Mozilla Bug 415498</a>
 
   <p id="display"></p>
 
   <pre id="test">
   <script class="testbody" type="application/javascript"><![CDATA[
 
     /** Test for Bug 415498 **/
-    const Cc = Components.classes;
-    const Ci = Components.interfaces;
-    const Cr = Components.results;
+    if (Cc === undefined) {
+      var Cc = Components.classes;
+      var Ci = Components.interfaces;
+    }
+    var Cr = Components.results;
 
     SimpleTest.waitForExplicitFinish();
 
     var gTestsIterator;
     var gConsole;
     var gConsoleListener;
     var gMessages = [];
 
@@ -67,25 +71,27 @@ https://bugzilla.mozilla.org/show_bug.cg
     function testsIterator() {
 
       var browser = $("browser");
       browser.addEventListener("load", function() {
         setTimeout(nextTest, 0)
       }, false);
 
       // 1) This document uses addEventListener to register a method throwing an exception
-      browser.loadURI("chrome://mochikit/content/chrome/content/events/test/bug415498-doc1.html");
+      var chromeDir = getRootDirectory(window.location.href);
+      browser.loadURI(chromeDir + "bug415498-doc1.html");
       yield;
 
       ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),
          "Error message not reported in event listener callback!");
       gMessages = [];
 
       // 2) This document sets window.onload to register a method throwing an exception
-      browser.loadURI("chrome://mochikit/content/chrome/content/events/test/bug415498-doc2.html");
+      var chromeDir = getRootDirectory(window.location.href);
+      browser.loadURI(chromeDir + "bug415498-doc2.html");
       yield;
 
       ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),
          "Error message not reported in window.onload!");
     }
     
     function verifyErrorReceived(errorString) {
       for (var i = 0; i < gMessages.length; i++) {
--- a/content/events/test/test_bug508479.html
+++ b/content/events/test/test_bug508479.html
@@ -1,12 +1,12 @@
 <html>
 <head>
   <title>Tests for the dragstart event</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>      
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>      
 
 <script>
   
 var gGotHandlingDrop = false;
 var gGotNotHandlingDrop = false;
--- a/content/events/test/test_draggableprop.html
+++ b/content/events/test/test_draggableprop.html
@@ -1,16 +1,16 @@
 <html>
 <head>
   <title>Tests for the draggable property on HTML elements</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
   <script type="application/javascript" 
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="application/javascript" 
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
+          src="/tests/SimpleTest/SimpleTest.js"></script>      
 
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 
 <span id="elem1">One</span>
 <span id="elem2" draggable="true">Two</span>
--- a/content/events/test/test_dragstart.html
+++ b/content/events/test/test_dragstart.html
@@ -1,12 +1,12 @@
 <html>
 <head>
   <title>Tests for the dragstart event</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>      
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>      
 
 <!--
  This test checks the dragstart event and the DataTransfer object
   -->
  
--- a/content/html/content/test/test_bug417760.html
+++ b/content/html/content/test/test_bug417760.html
@@ -1,28 +1,28 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=417760
 -->
 <head>
   <title>cannot focus() img with tabindex="-1"</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <style type="text/css">
     img {
       border: 5px solid white;
     }
     img:focus {
       border: 5px solid black;
     }
   </style>
 
 
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="text/javascript">
     function checkFocus(aExpected, aTabIndex)
     {
       elemCurr = document.activeElement.getAttribute("id");
       is(elemCurr, aExpected, "Element with tabIndex " + aTabIndex 
          + " did not receive focus!");
     }
--- a/content/xul/content/test/test_bug398289.html
+++ b/content/xul/content/test/test_bug398289.html
@@ -3,17 +3,17 @@
 <head>
   <title>Test for bug 398289</title>
   <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body style="height: 100%" onload="setTimeout(onBodyLoad, 0);">
-  <iframe id="test" src="chrome://mochikit/content/chrome/content/xul/content/test/398289-resource.xul" width="100%" height="100%">
+  <iframe id="test" src="398289-resource.xul" width="100%" height="100%">
   </iframe>
 
   <script class="testbody" type="text/javascript">
     var snap1, snap2;
   
     SimpleTest.waitForExplicitFinish();
   
     function onBodyLoad() {
--- a/content/xul/templates/tests/chrome/templates_shared.js
+++ b/content/xul/templates/tests/chrome/templates_shared.js
@@ -430,8 +430,42 @@ function compareConsoleMessages()
    var out = {};
    consoleService.getMessageArray(out, {});
    var messages = out.value || [];
    is(messages.length, expectedConsoleMessages.length, "correct number of logged messages");
    for (var m = 0; m < messages.length; m++) {
      is(messages[m].message, expectedConsoleMessages.shift(), "logged message " + (m + 1));
    }
 }
+
+function copyToProfile(filename)
+{
+  if (Cc === undefined) {
+    var Cc = Components.classes;
+    var Ci = Components.interfaces;
+  }
+
+  var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
+                         .getService(Ci.mozIJSSubScriptLoader);
+  loader.loadSubScript("chrome://mochikit/content/chrome-harness.js");
+
+  var file = Cc["@mozilla.org/file/directory_service;1"]
+                       .getService(Ci.nsIProperties)
+                       .get("ProfD", Ci.nsIFile);
+  file.append(filename);
+
+  var parentURI = getResolvedURI(getRootDirectory(window.location.href));
+  if (parentURI.JARFile) {
+    parentURI = extractJarToTmp(parentURI);
+  } else {
+    var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
+                      getService(Ci.nsIFileProtocolHandler);
+    parentURI = fileHandler.getFileFromURLSpec(parentURI.spec);
+  }
+
+  parentURI = parentURI.QueryInterface(Ci.nsILocalFile);
+  parentURI.append(filename);
+  try {
+    var retVal = parentURI.copyToFollowingLinks(file.parent, filename);
+  } catch (ex) {
+    ok(false, "Cannot copy files to profile due to: " + ex);
+  }
+}
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters.xul
@@ -30,24 +30,25 @@ var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput = <output></output>;
 
 
 Components.classes["@mozilla.org/consoleservice;1"]
           .getService(Components.interfaces.nsIConsoleService)
           .reset();
 
+copyToProfile('animals.sqlite');
 expectedConsoleMessages.push("Error parsing template: the given named parameter is unknown in the SQL query");
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = ? ORDER BY name
             <param name="bar">2</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_2.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_2.xul
@@ -30,24 +30,26 @@ var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput = <output></output>;
 
 
 Components.classes["@mozilla.org/consoleservice;1"]
           .getService(Components.interfaces.nsIConsoleService)
           .reset();
 
+copyToProfile('animals.sqlite');
+
 expectedConsoleMessages.push("Error parsing template: the type of a query parameter is wrong");
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = ? ORDER BY name
             <param type="mysupertype">2</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_3.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_bad_parameters_3.xul
@@ -30,24 +30,26 @@ var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput = <output></output>;
 
 
 Components.classes["@mozilla.org/consoleservice;1"]
           .getService(Components.interfaces.nsIConsoleService)
           .reset();
 
+copyToProfile('animals.sqlite');
+
 expectedConsoleMessages.push("Error parsing template: a query parameter cannot be bound to the SQL query");
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
                 SELECT * FROM animals WHERE species_id = :spec ORDER BY name
             <param name="spec" type="int32">5</param>
             <param>L%</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_badquery.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_badquery.xul
@@ -29,26 +29,28 @@ var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =<output></output>;
 
 Components.classes["@mozilla.org/consoleservice;1"]
           .getService(Components.interfaces.nsIConsoleService)
           .reset();
 
+copyToProfile('animals.sqlite');
+
 expectedConsoleMessages.push("Error parsing template: syntax error in the SQL query");
 
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
               flex="1" rows="8"
-              datasources="animals.sqlite" ref="." querytype="storage">
+              datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animalssssssss WHERE species_id = 2 ORDER BY 
         </query>
         <action>
             <listitem uri="?" label="?name"  />
         </action>
     </template>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_dynamicparameters.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_dynamicparameters.xul
@@ -17,16 +17,17 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
 
 function test_storage_template()
 {
   var root = document.getElementById("root");
   expectedOutput = <output></output>;
   checkResults(root, 0);
 
   document.getElementById("species-id").textContent = '2';
@@ -62,17 +63,17 @@ var expectedOutput =
 
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
              SELECT * FROM animals WHERE species_id = :spec ORDER BY name
             <param id="species-id" name="spec" type="int32" />
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_listbox.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_listbox.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage simple listbox";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -36,17 +38,17 @@ var expectedOutput =
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
               flex="1" rows="8"
-              datasources="animals.sqlite" ref="." querytype="storage">
+              datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = 2 ORDER BY name
         </query>
         <action>
             <listitem uri="?" label="?name"  />
         </action>
     </template>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_multiqueries.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_multiqueries.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage listbox with multiqueries";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -43,17 +45,17 @@ var expectedOutput =
     <listitem anyid="true" label="Bird: Raven"/>
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <queryset>
             <query>SELECT * FROM animals WHERE species_id = 5 ORDER BY name</query>
             <rule>
                 <where subject="?id" rel="greater" value="12"/>
                 <action>
                     <listitem uri="?" label="Mammal: ?name"  style="font-weight:bold"/>
                 </action>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_parameters.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_parameters.xul
@@ -15,16 +15,18 @@
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
+
+copyToProfile('animals.sqlite');
 SimpleTest.waitForExplicitFinish();
 
 
 function test_storage_template()
 {
   var root = document.getElementById("root1");
   expectedOutput = <output>
     <listitem anyid="true" label="Barn Owl"/>
@@ -74,87 +76,87 @@ var expectedOutput =
     <listitem anyid="true" label="aardvark"/>
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root1" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = ? ORDER BY name
             <param>2</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
     </template>
 </listbox>
 
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root2" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = ? ORDER BY name
             <param type="int32">2</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
     </template>
 </listbox>
 
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root3" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
                 SELECT * FROM animals WHERE species_id = :spec AND name like ? ORDER BY name
             <param name="spec" type="int32">5</param>
             <param>L%</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
     </template>
 </listbox>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root4" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
                 SELECT * FROM animals WHERE species_id = ?3 AND name like ?1 ORDER BY name
             <param index="3" type="int32">5</param>
             <param index="1">L%</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
     </template>
 </listbox>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root5" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
                 SELECT * FROM animals WHERE species_id = ?3 AND name like :pattern ORDER BY name
             <param name="pattern">L%</param>
             <param index="3" type="int32">5</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
     </template>
 </listbox>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root6" 
-              flex="1"  datasources="animals.sqlite" ref="." querytype="storage">
+              flex="1"  datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = ? ORDER BY name
             <param type="int32">2qsdqsd</param>
         </query>
         <action>
             <listitem uri="?" label="?name"/>
         </action>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_rule.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_rule.xul
@@ -15,17 +15,19 @@
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
+
 SimpleTest.waitForExplicitFinish();
+copyToProfile('animals.sqlite');
 
 var testid ="storage listbox with rule";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
@@ -37,17 +39,17 @@ var expectedOutput =
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <listbox  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
               flex="1" rows="8"
-              datasources="animals.sqlite" ref="." querytype="storage">
+              datasources="profile:animals.sqlite" ref="." querytype="storage">
     <template>
         <query>
             SELECT * FROM animals WHERE species_id = 5 ORDER BY name
         </query>
         <rule>
             <where subject="?id" rel="greater" value="10"/>
             <action>
                 <listitem uri="?" label="?name" />
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_simple.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_simple.xul
@@ -15,16 +15,17 @@
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
+copyToProfile('animals.sqlite');
 SimpleTest.waitForExplicitFinish();
 
 var testid ="storage simple";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
@@ -35,17 +36,17 @@ var expectedOutput =
   <button anyid="true" label="Raven / Corvus corax"/>
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-      datasources="animals.sqlite" querytype="storage" ref=".">
+      datasources="profile:animals.sqlite" querytype="storage" ref=".">
 <template>
     <query>SELECT * FROM animals WHERE species_id = 2 ORDER BY name</query>
     <action>
         <button uri="?" label="?name / ?specimen"/>
     </action>
 </template>
 </vbox>
 
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerasc.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerasc.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage sort integer asc";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -52,17 +54,17 @@ var changes = [];
 ]]>
 </script>
 
 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
     <columns>
         <column flex="1"/>
         <column flex="3"/>
     </columns>
-    <rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
+    <rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
          sort="?id" sortDirection="ascending">
         <template>
             <query>SELECT id, name FROM animals</query>
             <action>
                 <row uri="?">
                     <label value="?id"/>
                     <label value="?name"/>
                 </row>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerdesc.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_sortintegerdesc.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage sort integer desc";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -52,17 +54,17 @@ var changes = [];
 ]]>
 </script>
 
 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
     <columns>
         <column flex="1"/>
         <column flex="3"/>
     </columns>
-    <rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
+    <rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
          sort="?id" sortDirection="descending">
         <template>
             <query>SELECT id, name FROM animals</query>
             <action>
                 <row uri="?">
                     <label value="?id"/>
                     <label value="?name"/>
                 </row>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_sortstringasc.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_sortstringasc.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage sort string asc";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -52,17 +54,17 @@ var changes = [];
 ]]>
 </script>
 
 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
     <columns>
         <column flex="1"/>
         <column flex="3"/>
     </columns>
-    <rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
+    <rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
          sort="?name" sortDirection="ascending">
         <template>
             <query>SELECT id, name FROM animals</query>
             <action>
                 <row uri="?">
                     <label value="?id"/>
                     <label value="?name"/>
                 </row>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_sortstringdesc.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_sortstringdesc.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage sort string desc";
 var queryType = "storage";
 var isTreeBuilder = false;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -52,17 +54,17 @@ var changes = [];
 ]]>
 </script>
 
 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
     <columns>
         <column flex="1"/>
         <column flex="3"/>
     </columns>
-    <rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
+    <rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
          sort="?name" sortDirection="descending">
         <template>
             <query>SELECT id, name FROM animals</query>
             <action>
                 <row uri="?">
                     <label value="?id"/>
                     <label value="?name"/>
                 </row>
--- a/content/xul/templates/tests/chrome/test_tmpl_storage_tree.xul
+++ b/content/xul/templates/tests/chrome/test_tmpl_storage_tree.xul
@@ -17,16 +17,18 @@
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script src="templates_shared.js"/>
 
 <script>
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
+copyToProfile('animals.sqlite');
+
 var testid ="storage tree";
 var queryType = "storage";
 var isTreeBuilder = true;
 var needsOpen = false;
 var notWorkingYet = false;
 var notWorkingYetDynamic = false;
 var expectedOutput =
 <output>
@@ -88,17 +90,17 @@ var expectedOutput =
   </treechildren>
 </output>;
 
 var changes = [];
 ]]>
 </script>
 
 <tree   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" 
-        flex="1" datasources="animals.sqlite" ref="*" querytype="storage" flags="dont-build-content">
+        flex="1" datasources="profile:animals.sqlite" ref="*" querytype="storage" flags="dont-build-content">
     <treecols>
         <treecol id="species" primary="true" label="Species" flex="2"/>
         <treecol id="name" label="Common name" flex="2"/>
         <treecol id="specimen" label="Specimen" flex="3"/>
         <treecol id="id" label="id" flex="1"/>
     </treecols>
     <template>
         <query>
--- a/content/xul/templates/tests/test_bug441785.xul
+++ b/content/xul/templates/tests/test_bug441785.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0" ?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <tree flex="20" id="t" ref="urn:data:row" datasources="rdf:null" seltype="single">
      <treecols> 
       <treecol flex="1" id="id" label="id" sort="rdf:http://dummy/rdf#id" />
       <splitter class="tree-splitter"/>
       <treecol flex="1" id="title" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
      </treecols>
--- a/content/xul/templates/tests/test_sortservice.xul
+++ b/content/xul/templates/tests/test_sortservice.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0" ?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 <vbox id="box"/>
 
 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script type="application/javascript" src="/MochiKit/packed.js"></script>
--- a/docshell/test/chrome/bug293235_window.xul
+++ b/docshell/test/chrome/bug293235_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 293235 test">
 
   <script type="application/javascript"
     src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
 
   <script type="application/javascript"><![CDATA[
     const Ci = Components.interfaces;
     const Cc = Components.classes;
     Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
--- a/docshell/test/chrome/bug294258_window.xul
+++ b/docshell/test/chrome/bug294258_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 294258 test">
 
   <script type="application/javascript"
   src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
 
     ////
--- a/docshell/test/chrome/bug298622_window.xul
+++ b/docshell/test/chrome/bug298622_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 298622 test">
 
   <script type="application/javascript"
     src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
     // Global variable that holds a reference to the find bar.
     var gFindBar;
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
--- a/docshell/test/chrome/bug301397_window.xul
+++ b/docshell/test/chrome/bug301397_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 301397 test">
 
   <script type="application/javascript"
     src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
 
     ////
--- a/docshell/test/chrome/bug303267_window.xul
+++ b/docshell/test/chrome/bug303267_window.xul
@@ -4,17 +4,17 @@
 <window id="303267Test"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 303267 test">
 
   <script type="application/javascript"  
-  src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  src="docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
 
     ////
--- a/docshell/test/chrome/bug321671_window.xul
+++ b/docshell/test/chrome/bug321671_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 321671 test">
 
   <script type="application/javascript"
     src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
     
     // Maximum number of entries in the bfcache for this session history.
--- a/docshell/test/chrome/bug360511_window.xul
+++ b/docshell/test/chrome/bug360511_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 360511 test">
 
   <script type="application/javascript"
           src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
 
     ////
--- a/docshell/test/chrome/bug396649_window.xul
+++ b/docshell/test/chrome/bug396649_window.xul
@@ -5,17 +5,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug 396649 test">
 
   <script type="application/javascript"
           src=
-  "chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  "docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
     
     // Maximum number of entries in the bfcache for this session history.
--- a/docshell/test/chrome/window.template.txt
+++ b/docshell/test/chrome/window.template.txt
@@ -4,17 +4,17 @@
 <window id="303267Test"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="setTimeout(nextTest,0);"
         title="bug {BUGNUMBER} test">
 
   <script type="application/javascript"
-  src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
+  src="docshell_helpers.js">
   </script>
 
   <script type="application/javascript"><![CDATA[
   
     // Define the generator-iterator for the tests.
     var tests = testIterator();
 
     ////
--- a/docshell/test/test_bug529119-1.html
+++ b/docshell/test/test_bug529119-1.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
 <title>Test bug 529119</title>
-<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>        
-<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+<script type="text/javascript" src="/MochiKit/packed.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 var workingURL = "http://mochi.test:8888/tests/docshell/test/bug529119-window.html";
 var faultyURL = "http://some-nonexistent-domain-27489274c892748217cn2384.com/";
 
--- a/docshell/test/test_bug529119-2.html
+++ b/docshell/test/test_bug529119-2.html
@@ -1,15 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
 <title>Test bug 529119</title>
-<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>        
-<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+<script type="text/javascript" src="/MochiKit/packed.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 var workingURL = "http://mochi.test:8888/tests/docshell/test/bug529119-window.html";
 var faultyURL = "http://some-nonexistent-domain-27489274c892748217cn2384.com/";
 
--- a/dom/tests/mochitest/general/test_focusrings.xul
+++ b/dom/tests/mochitest/general/test_focusrings.xul
@@ -1,21 +1,21 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 <script type="application/javascript"
-        src="chrome://mochikit/content/MochiKit/packed.js"></script>
+        src="/MochiKit/packed.js"></script>
 <script type="application/javascript"
-        src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+        src="/tests/SimpleTest/SimpleTest.js"></script>
 <script type="application/javascript"
-        src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+        src="/tests/SimpleTest/EventUtils.js"></script>
 <script type="application/javascript"
-        src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
+        src="/tests/SimpleTest/WindowSnapshot.js"></script>
 
 <html:style xmlns:html="http://www.w3.org/1999/xhtml" type="text/css">
 * { outline: none; }
 #l1:-moz-focusring, #l3:-moz-focusring, #b1:-moz-focusring { outline: 2px solid red; }
 #l2:focus, #b2:focus { outline: 2px solid red; }
 </html:style>
 
 <script>
--- a/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
+++ b/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
@@ -2,23 +2,20 @@
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
 -->
 <head>
   <title>postMessage chrome tests</title>
   <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
-<!--
-This test runs at the following URL:
-chrome://mochikit/content/chrome/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
--->
 
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 
 <iframe src="http://example.org/tests/dom/tests/mochitest/whatwg/postMessage_chrome_helper.html"
         name="contentDomain"></iframe>
 
@@ -65,18 +62,20 @@ function messageReceiver(evt)
 
 
 /******************
  * SELF-RESPONDER *
  ******************/
 
 function checkSelf(evt)
 {
+  var prepath = getChromePrePath(window.location.href);
+
   is(evt.isTrusted, true, "should have sent a trusted event");
-  is(evt.origin, "chrome://mochikit", "wrong origin for chrome: URL");
+  is(evt.origin, prepath, "wrong origin for chrome: URL");
   is(evt.source, null, "chrome posters get a null source, for security");
 
   window.frames.contentDomain.postMessage("post-to-content",
                                           "http://example.org");
 }
 
 
 /*************
--- a/editor/libeditor/html/tests/test_contenteditable_focus.html
+++ b/editor/libeditor/html/tests/test_contenteditable_focus.html
@@ -1,17 +1,17 @@
 <html>
 <head>
   <title>Test for contenteditable focus</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="display">
   First text in this document.<br>
   <input id="inputText" type="text"><br>
   <input id="inputTextReadonly" type="text" readonly><br>
   <input id="inputButton" type="button" value="input[type=button]"><br>
   <button id="button">button</button><br>
--- a/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html
+++ b/editor/libeditor/html/tests/test_contenteditable_text_input_handling.html
@@ -1,19 +1,19 @@
 <html>
 <head>
   <title>Test for text input event handling on contenteditable editor</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+          src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="display">
   <p id="static">static content<input id="inputInStatic"><textarea id="textareaInStatic"></textarea></p>
   <p id="editor"contenteditable="true">content editable<input id="inputInEditor"><textarea id="textareaInEditor"></textarea></p>
 </div>
 <div id="content" style="display: none">
   
--- a/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
+++ b/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
@@ -1,19 +1,19 @@
 <html>
 <head>
   <title>Test for key event handler of HTML editor</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+          src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="display">
   <div id="htmlEditor" contenteditable="true"><br></div>
 </div>
 <div id="content" style="display: none">
   
 </div>
--- a/editor/libeditor/html/tests/test_root_element_replacement.html
+++ b/editor/libeditor/html/tests/test_root_element_replacement.html
@@ -1,19 +1,19 @@
 <html>
 <head>
   <title>Test for root element replacement</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+          src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display">
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
--- a/editor/libeditor/html/tests/test_select_all_without_body.html
+++ b/editor/libeditor/html/tests/test_select_all_without_body.html
@@ -1,17 +1,17 @@
 <html>
 <head>
   <title>Test select all in HTML editor without body element</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display">
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
--- a/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html
+++ b/editor/libeditor/text/tests/test_texteditor_keyevent_handling.html
@@ -1,19 +1,19 @@
 <html>
 <head>
   <title>Test for key event handler of text editor</title>
   <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+          src="/MochiKit/packed.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+          src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+          src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+          href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="display">
   <input type="text" id="inputField">
   <input type="password" id="passwordField">
   <textarea id="textarea"></textarea>
 </div>
 <div id="content" style="display: none">
--- a/js/src/xpconnect/tests/chrome/test_bug503926.xul
+++ b/js/src/xpconnect/tests/chrome/test_bug503926.xul
@@ -11,34 +11,32 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml">
   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=503926"
      target="_blank">Mozilla Bug 503926</a>
 
-  <iframe id="ifr" type="content" onload="iframe_loaded()"
-          src="chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/bug503926.xul#iframe"/>
+  <iframe id="ifr" type="content" onload="iframe_loaded()" src="bug503926.xul#iframe"/>
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
 
   /** Test for Bug 503926 **/
   function iframe_loaded() {
     var gWindowUtils  = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                                getInterface(Components.interfaces.nsIDOMWindowUtils);
     var passed = false;
     var obj = { QueryInterface: function() { passed = true; } };
     try { gWindowUtils.dispatchDOMEventViaPresShell(obj, obj, false); } catch (e) {}
     ok(passed, "trusted QIs should be called");
 
-    openDialog("chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/bug503926.xul",
-               "chromeDialog", "modal");
+    openDialog("bug503926.xul", "chromeDialog", "modal");
     SimpleTest.finish();
   }
 
   SimpleTest.waitForExplicitFinish();
   ]]>
   </script>
 </window>
--- a/modules/libjar/test/chrome/test_bug386153.html
+++ b/modules/libjar/test/chrome/test_bug386153.html
@@ -2,16 +2,17 @@
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=386153
 -->
 <head>
   <title>Test for Bug 386153</title>
   <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=386153">Mozilla Bug 386153</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
@@ -20,25 +21,27 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 386153 **/
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 // Opens a zip file from the test directory.
 function openZip(path) {
-  var ios = Cc["@mozilla.org/network/io-service;1"].
-            getService(Ci.nsIIOService);
-  var chromeURI = ios.newURI("chrome://mochikit/content/chrome/modules/libjar/test/chrome/" + path,
-                              null, null);
-  var resolved = Cc["@mozilla.org/chrome/chrome-registry;1"].
-                 getService(Ci.nsIChromeRegistry).
-                 convertChromeURL(chromeURI).
-                 QueryInterface(Ci.nsIFileURL).
-                 file;
+
+  var location = window.location.href;
+  location = getRootDirectory(location);
+  var jar = getJar(location);
+  if (jar != null) {
+    var resolved = extractJarToTmp(jar);
+  } else {
+    var resolvedURI = getResolvedURI(window.location.href);
+    var resolved = getChromeDir(resolvedURI);
+  }
+  resolved.append(path);
 
   var zip = Cc["@mozilla.org/libjar/zip-reader;1"].
             createInstance(Ci.nsIZipReader);
   zip.open(resolved);
   return zip;
 }
 
 // Gets the pretty name from the signing cert or null if the zip is unsigned.
--- a/modules/plugin/test/mochitest/test_bug532208.html
+++ b/modules/plugin/test/mochitest/test_bug532208.html
@@ -1,16 +1,16 @@
 <head>
 <title>Test for correct async delivery of large streams, bug
 532208</title>
 
 <script type="application/javascript"
-src="chrome://mochikit/content/MochiKit/packed.js"></script>
+src="/MochiKit/packed.js"></script>
 <script type="application/javascript"
-src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="setTimeout(runTests, 2000)">
   <embed id="plugin1" type="application/x-test" width="400"
   height="400" src="large-pic.jpg" functiontofail="npp_write_rpc" streammode="normal"></embed>
 
 <script class="testbody" type="application/javascript">
 SimpleTest.waitForExplicitFinish();
 
--- a/modules/plugin/test/mochitest/test_cocoa_focus.html
+++ b/modules/plugin/test/mochitest/test_cocoa_focus.html
@@ -1,13 +1,13 @@
 <html>
 <head>
   <title>NPCocoaEventFocusChanged Tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 
 <body onload="runTests()">
   <script class="testbody" type="application/javascript">
     SimpleTest.waitForExplicitFinish();
 
     var gOtherWindow;
 
--- a/modules/plugin/test/mochitest/test_cocoa_window_focus.html
+++ b/modules/plugin/test/mochitest/test_cocoa_window_focus.html
@@ -1,13 +1,13 @@
 <html>
 <head>
   <title>NPCocoaEventWindowFocusChanged Tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 
 <body onload="runTests()">
   <script class="testbody" type="application/javascript">
     SimpleTest.waitForExplicitFinish();
 
     var gOtherWindow;
 
--- a/modules/plugin/test/mochitest/test_cookies.html
+++ b/modules/plugin/test/mochitest/test_cookies.html
@@ -1,13 +1,13 @@
 <html>
 <head>
   <title>NPAPI Cookie Tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 
 <body onload="runTests()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
   <script class="testbody" type="application/javascript">
     SimpleTest.waitForExplicitFinish();
     function runTests() {
       var pluginElement = document.getElementById("plugin1");
--- a/modules/plugin/test/mochitest/test_crash_nested_loop.html
+++ b/modules/plugin/test/mochitest/test_crash_nested_loop.html
@@ -1,12 +1,12 @@
 <head>
   <title>Plugin crashing in nested loop</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body>
   <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var iframe = document.getElementById('iframe1');
--- a/modules/plugin/test/mochitest/test_crashing.html
+++ b/modules/plugin/test/mochitest/test_crashing.html
@@ -1,12 +1,12 @@
 <head>
   <title>Plugin crashing</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body>
   <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var iframe = document.getElementById('iframe1');
--- a/modules/plugin/test/mochitest/test_crashing2.html
+++ b/modules/plugin/test/mochitest/test_crashing2.html
@@ -1,12 +1,12 @@
 <head>
   <title>Plugin crashing</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="mainLoaded()">
   <iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var iframe = document.getElementById('iframe1');
--- a/modules/plugin/test/mochitest/test_enumerate.html
+++ b/modules/plugin/test/mochitest/test_enumerate.html
@@ -1,13 +1,13 @@
 <html>
 <head>
   <title>NPAPI Cookie Tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
   <link rel="stylesheet" type="text/css" 
         href="/tests/SimpleTest/test.css" />
 </head>
 
 <body onload="runTests()">
   <p id="display"></p>
 
--- a/modules/plugin/test/mochitest/test_hanging.html
+++ b/modules/plugin/test/mochitest/test_hanging.html
@@ -1,12 +1,12 @@
 <head>
   <title>Plugin hanging</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body>
   <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var iframe = document.getElementById('iframe1');
--- a/modules/plugin/test/mochitest/test_instantiation.html
+++ b/modules/plugin/test/mochitest/test_instantiation.html
@@ -1,13 +1,12 @@
 <head>
   <title>Plugin instantiation</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <body onload="mainLoaded()">
   <iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var iframe = document.getElementById('iframe1');
 
--- a/modules/plugin/test/mochitest/test_multipleinstanceobjects.html
+++ b/modules/plugin/test/mochitest/test_multipleinstanceobjects.html
@@ -1,12 +1,12 @@
 <head>
   <title>NPNV*NPObject accessibility tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="runTests()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
   <embed id="plugin2" type="application/x-test" width="400" height="400"></embed>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
--- a/modules/plugin/test/mochitest/test_newstreamondestroy.html
+++ b/modules/plugin/test/mochitest/test_newstreamondestroy.html
@@ -1,12 +1,12 @@
 <head>
   <title>NPN_GetURL called from NPP_Destroy</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
   <link rel="stylesheet" type="text/css"
 	href="/tests/SimpleTest/test.css">
 
 <body onload="runTest()">
   <p id="display"></p>
 
   <embed id="plugin1" type="application/x-test"></embed>
--- a/modules/plugin/test/mochitest/test_npobject_getters.html
+++ b/modules/plugin/test/mochitest/test_npobject_getters.html
@@ -1,12 +1,12 @@
 <head>
   <title>NPNV*NPObject accessibility tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="runTests()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
 
   <script class="testbody" type="application/javascript">
   dump('lastScript');
 
   SimpleTest.waitForExplicitFinish();
--- a/modules/plugin/test/mochitest/test_streamNotify.html
+++ b/modules/plugin/test/mochitest/test_streamNotify.html
@@ -1,12 +1,12 @@
 <head>
   <title>NPN_Get/PostURLNotify tests</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="runTests()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   var pending = 6;
--- a/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html
+++ b/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html
@@ -1,14 +1,14 @@
 <html>
 <head>
   <title>Test bug 483437 and bug 480509</title>
-  <script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>        
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body onload="onWindowLoad()">
 
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 function badCertListener() 
--- a/security/manager/ssl/tests/mochitest/bugs/test_bug483440.html
+++ b/security/manager/ssl/tests/mochitest/bugs/test_bug483440.html
@@ -1,14 +1,14 @@
 <html>
 <head>
   <title>Test bug 483437 and bug 480509</title>
-  <script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>        
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 
 <script class="testbody" type="text/javascript">
 
 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
 var certdb = Components.classes["@mozilla.org/security/x509certdb;1"]
--- a/security/manager/ssl/tests/mochitest/bugs/test_bug484111.html
+++ b/security/manager/ssl/tests/mochitest/bugs/test_bug484111.html
@@ -1,14 +1,14 @@
 <html>
 <head>
   <title>Test bug 484111</title>
-  <script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>        
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body onload="onWindowLoad()">
 
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 function badCertListener() 
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -69,16 +69,17 @@ include $(topsrcdir)/build/automation-bu
 		$(topsrcdir)/build/mobile/remoteautomation.py \
 		gen_template.pl \
 		server.js \
 		harness-a11y.xul \
 		harness-overlay.xul \
 		harness.xul \
 		browser-test-overlay.xul \
 		browser-test.js \
+		chrome-harness.js \
 		ipc-overlay.xul \
 		ipc.js \
 		browser-harness.xul \
 		redirect-a11y.html \
 		redirect.html \
 		redirect.js \
 		$(topsrcdir)/build/pgo/server-locations.txt \
 		$(topsrcdir)/netwerk/test/httpserver/httpd.js \
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -40,16 +40,17 @@ function Tester(aTests, aDumper, aCallba
 
   this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
                        getService(Ci.mozIJSSubScriptLoader);
   this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", this.EventUtils);
   // Avoid polluting this scope with packed.js contents.
   var simpleTestScope = {};
   this._scriptLoader.loadSubScript("chrome://mochikit/content/MochiKit/packed.js", simpleTestScope);
   this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", simpleTestScope);
+  this._scriptLoader.loadSubScript("chrome://mochikit/content/chrome-harness.js", simpleTestScope);
   this.SimpleTest = simpleTestScope.SimpleTest;
 }
 Tester.prototype = {
   EventUtils: {},
   SimpleTest: {},
 
   checker: null,
   currentTestIndex: -1,
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/chrome-harness.js
@@ -0,0 +1,342 @@
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mochitest code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joel Maher <joel.maher@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+/*
+ * getChromeURI converts a URL to a URI
+ * 
+ * url: string of a URL (http://mochi.test/test.html)
+ * returns: a nsiURI object representing the given URL
+ *
+ */
+function getChromeURI(url) {
+  var ios = Components.classes["@mozilla.org/network/io-service;1"].
+              getService(Components.interfaces.nsIIOService);
+  return ios.newURI(url, null, null);
+}
+
+/*
+ * Convert a URL (string) into a nsIURI or NSIJARURI
+ * This is intended for URL's that are on a file system 
+ * or in packaged up in an extension .jar file
+ *
+ * url: a string of a url on the local system(http://localhost/blah.html)
+ */
+function getResolvedURI(url) {
+  var chromeURI = getChromeURI(url);
+  var resolvedURI = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
+                    getService(Components.interfaces.nsIChromeRegistry).
+                    convertChromeURL(chromeURI);
+
+  try {
+    resolvedURI = resolvedURI.QueryInterface(Components.interfaces.nsIJARURI);
+  } catch (ex) {} //not a jar file
+
+  return resolvedURI;
+}
+
+/**
+ *  getChromeDir is intended to be called after getResolvedURI and convert
+ *  the input URI into a nsILocalFile (actually the directory containing the
+ *  file).  This can be used for copying or referencing the file or extra files
+ *  required by the test.  Usually we need to load a secondary html file or library
+ *  and this will give us file system access to that.
+ *
+ *  resolvedURI: nsIURI (from getResolvedURI) that points to a file:/// url
+ */
+function getChromeDir(resolvedURI) {
+
+  var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
+                    getService(Components.interfaces.nsIFileProtocolHandler);
+  var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
+  return chromeDir.parent.QueryInterface(Components.interfaces.nsILocalFile);
+}
+
+/*
+ * given a .jar file, we get all test files located inside the archive
+ *
+ * basePath: base URL to determine chrome location and search for tests
+ * testPath: passed in testPath value from command line such as: dom/tests/mochitest
+ * dir: the test dir to append to the baseURL after getting a directory interface
+ *
+ * As a note, this is hardcoded to the .jar structure we use for mochitest.  
+ * Please don't assume this works for all jar files.
+ */
+function getMochitestJarListing(basePath, testPath, dir)
+{
+  var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
+                  createInstance(Components.interfaces.nsIZipReader);
+  var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
+                    getService(Components.interfaces.nsIFileProtocolHandler);
+
+  var fileName = fileHandler.getFileFromURLSpec(getResolvedURI(basePath).JARFile.spec);
+  zReader.open(fileName);
+  //hardcoded 'content' as that is the root dir in the mochikit.jar file
+  var base = "content/" + dir + "/";
+
+  var singleTestPath;
+  if (testPath) {
+    var extraPath = testPath;
+    var pathToCheck = base + testPath;
+    if (zReader.hasEntry(pathToCheck)) {
+      var pathEntry = zReader.getEntry(pathToCheck);
+      if (pathEntry.isDirectory) {
+        base = pathToCheck;
+      } else {
+        singleTestPath = '/' + base + testPath;
+        var singleObject = {};
+        singleObject[singleTestPath] = true;
+        return [singleObject, singleTestPath];
+      }
+    }
+    else if (zReader.hasEntry(pathToCheck + "/")) {
+      base = pathToCheck + "/";
+    }
+  }
+  var [links, count] = zList(base, zReader, true);
+  return [links, null];
+}
+
+/*
+ * Replicate the server.js list() function with a .jar file
+ *
+ * base: string value of base directory we are testing
+ * zReader: handle to opened nsIZipReader object
+ * recurse: true|false if we do subdirs
+ *
+ * returns:
+ *  [json object of {dir:{subdir:{file:true, file:true, ...}}}, count of tests]
+ */
+function zList(base, zReader, recurse) {
+  var dirs = zReader.findEntries(base + "*");
+  var links = {};
+  var count = 0;
+  var fileArray = [];
+  
+  while(dirs.hasMore()) {
+    var entryName = dirs.getNext();
+    if (entryName.substr(-1) == '/' && entryName.split('/').length == (base.split('/').length + 1) ||
+        (entryName.substr(-1) != '/' && entryName.split('/').length == (base.split('/').length))) { 
+      fileArray.push(entryName);
+    }
+  }
+  fileArray.sort();
+  count = fileArray.length;
+  for (var i=0; i < fileArray.length; i++) {
+    var myFile = fileArray[i];
+    if (myFile.substr(-1) === '/' && recurse) {
+      var childCount = 0;
+      [links[myFile], childCount] = zList(myFile, zReader, recurse);
+      count += childCount;
+    } else {
+      if (myFile.indexOf("SimpleTest") == -1) {
+        //we add the '/' so we don't try to run content/content/chrome
+        links['/' + myFile] = true;
+      }
+    }
+  }
+  return [links, count];
+}
+
+/**
+ * basePath: the URL base path to search from such as chrome://mochikit/content/a11y
+ * testPath: the optional testPath passed into the test such as dom/tests/mochitest
+ * dir: the test dir to append to the uri after getting a directory interface
+ * srvScope: loaded javascript to server.js so we have aComponents.classesess to the list() function
+ *
+ * return value:
+ *  single test: [json object, path to test]
+ *  list of tests: [json object, null] <- directory [heirarchy]
+ */
+function getFileListing(basePath, testPath, dir, srvScope)
+{
+  var uri = getResolvedURI(basePath);
+  var chromeDir = getChromeDir(uri);
+  chromeDir.appendRelativePath(dir);
+  basePath += '/' + dir;
+
+  var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
+              getService(Components.interfaces.nsIIOService);
+  var testsDirURI = ioSvc.newFileURI(chromeDir);
+  var testsDir = ioSvc.newURI(testPath, null, testsDirURI)
+                  .QueryInterface(Components.interfaces.nsIFileURL).file;
+
+  var singleTestPath;
+  if (testPath != undefined) {
+    var extraPath = testPath;
+    
+    var fileNameRegexp = /(browser|test)_.+\.(xul|html|js)$/;
+
+    // Invalid testPath...
+    if (!testsDir.exists())
+      return [];
+
+    // If we were passed a speComponents.interfacesfic file, run only that test.
+    if (testsDir.isFile()) {
+      if (fileNameRegexp.test(testsDir.leafName))
+        var singlePath = basePath + '/' + testPath;
+        var links = {};
+        links[singlePath] = true;
+        return [links, singlePath];
+
+      // We were passed a file that's not a test...
+      return [];
+    }
+
+    // otherwise, we were passed a directory of tests
+    basePath += "/" + testPath;
+  }
+  var [links, count] = srvScope.list(basePath, testsDir, true);
+  return [links, null];
+}
+
+
+//used by tests to determine their directory based off window.location.path
+function getRootDirectory(path, chromeURI) {
+  if (chromeURI === undefined)
+  {
+    chromeURI = getChromeURI(path);
+  }
+  var myURL = chromeURI.QueryInterface(Components.interfaces.nsIURL);
+
+  return chromeURI.prePath + myURL.directory;
+}
+
+//used by tests to determine their directory based off window.location.path
+function getChromePrePath(path, chromeURI) {
+
+  if (chromeURI === undefined) {
+    chromeURI = getChromeURI(path);
+  }
+
+  return chromeURI.prePath;
+}
+
+/*
+ * Given a URI, return nsIJARURI or null
+ */
+function getJar(uri) {
+  var resolvedURI = getResolvedURI(uri);
+  var jar = null;
+  try {
+    if (resolvedURI.JARFile) {
+      jar = resolvedURI;
+    }
+  } catch (ex) {}
+  return jar;
+}
+
+/*
+ * input:
+ *  jar: a nsIJARURI object with the jarfile and jarentry (path in jar file)
+ *
+ * output;
+ *  all files and subdirectories inside jarentry will be extracted to TmpD/mochikit.tmp
+ *  we will return the location of /TmpD/mochikit.tmp* so you can reference the files locally
+ */
+function extractJarToTmp(jar) {
+  var tmpdir = Components.classes["@mozilla.org/file/directory_service;1"]
+                      .getService(Components.interfaces.nsIProperties)
+                      .get("ProfD", Components.interfaces.nsILocalFile);
+  tmpdir.append("mochikit.tmp");
+  tmpdir.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
+
+  var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
+                  createInstance(Components.interfaces.nsIZipReader);
+
+  var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
+                    getService(Components.interfaces.nsIFileProtocolHandler);
+
+  var fileName = fileHandler.getFileFromURLSpec(jar.JARFile.spec);
+  zReader.open(fileName);
+
+  //filepath represents the path in the jar file without the filename
+  var filepath = "";
+  var parts = jar.JAREntry.split('/');
+  for (var i =0; i < parts.length - 1; i++) {
+    if (parts[i] != '') {
+      filepath += parts[i] + '/';
+    }
+  }
+
+  /* Create dir structure first, no guarantee about ordering of directories and
+   * files returned from findEntries.
+   */
+  var dirs = zReader.findEntries(filepath + '*/');
+  while (dirs.hasMore()) {
+    var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath);
+    targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
+  }
+
+  //now do the files
+  var files = zReader.findEntries(filepath + "*");
+  while (files.hasMore()) {
+    var fname = files.getNext();
+    if (fname.substr(-1) != '/') {
+      var targetFile = buildRelativePath(fname, tmpdir, filepath);
+      zReader.extract(fname, targetFile);
+    }
+  }
+  return tmpdir;
+}
+
+/*
+ * Simple utility function to take the directory structure in jarentryname and 
+ * translate that to a path of a nsILocalFile.
+ */
+function buildRelativePath(jarentryname, destdir, basepath)
+{
+  var baseParts = basepath.split('/');
+  if (baseParts[baseParts.length-1] == '') {
+    baseParts.pop();
+  }
+
+  var parts = jarentryname.split('/');
+
+  var targetFile = Components.classes["@mozilla.org/file/local;1"]
+                   .createInstance(Components.interfaces.nsILocalFile);
+  targetFile.initWithFile(destdir);
+
+  for (var i = baseParts.length; i < parts.length; i++) {
+    targetFile.append(parts[i]);
+  }
+
+  return targetFile;
+}
+
--- a/testing/mochitest/tests/SimpleTest/tests/test_synthesizeDragStart.xul
+++ b/testing/mochitest/tests/SimpleTest/tests/test_synthesizeDragStart.xul
@@ -60,17 +60,18 @@ check if nsIFile can be determined
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="application/javascript">
   <![CDATA[
 
   /** Test for Bug 462172 synthesizeDragStart**/
 var testFile = Components.classes["@mozilla.org/file/directory_service;1"].
-                  getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
+                  getService(Components.interfaces.nsIProperties).
+                  get("CurWorkD", Components.interfaces.nsIFile);
 var regularDtForDrag1 = null;
 
 function doOnDragStart(aEvent)
 {
   var dt = aEvent.dataTransfer;
   switch (aEvent.currentTarget.id) {
     case "drag2" :
       dt.setData("text/plain", "this is text/plain");
--- a/testing/mochitest/tests/SimpleTest/tests/test_synthesizeDrop.xul
+++ b/testing/mochitest/tests/SimpleTest/tests/test_synthesizeDrop.xul
@@ -47,18 +47,16 @@
 <window title="Mozilla Bug 462172 extra tests for synthesizeDrop"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="setTimeout(test,0)">
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
-  <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="application/javascript">
   <![CDATA[
 
   /** Test for Bug 462172 synthesizeDrop**/
 
 var gSetDropEffect = true;
 var gData;
--- a/toolkit/components/ctypes/tests/test_ctypes.xul
+++ b/toolkit/components/ctypes/tests/test_ctypes.xul
@@ -41,44 +41,67 @@
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/chrome-harness.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
+    /*
+     * input: string of the url where we are running from
+     * return: nsILocalFile
+     */
+    function getCurrentDir(path) {
+      var rootDir = getRootDirectory(window.location.href);
+      var jar = getJar(rootDir);
+
+      if (jar) {
+        return extractJarToTmp(jar);
+      } else {
+        return getLocalDir(path);
+      }
+    }
+
+    function getLocalDir(path) {
+      let dir = Components.classes["@mozilla.org/file/directory_service;1"]
+                          .getService(Components.interfaces.nsIProperties)
+                          .get("CurWorkD", Components.interfaces.nsILocalFile);
+      let path = location.pathname;
+      path = path.slice("content/".length,
+                                         -1 * "/test_ctypes.xul".length);
+      let components = path.split("/");
+      for (let part in components) {
+        dir.append(components[part]);
+      }
+      return dir;    
+    }
+
     function test()
     {
       SimpleTest.waitForExplicitFinish();
 
       var worker = new ChromeWorker("ctypes_worker.js");
       worker.onmessage = function(event) {
         is(event.data, "Done!", "Wrong message!");
         SimpleTest.finish();
       }
       worker.onerror = function(event) {
         ok(false, "Worker had an error: " + event.message);
         worker.terminate();
         SimpleTest.finish();
       }
 
-      let dir = Components.classes["@mozilla.org/file/directory_service;1"]
-                          .getService(Components.interfaces.nsIProperties)
-                          .get("CurWorkD", Components.interfaces.nsILocalFile);
-      let path = location.pathname.slice("content/".length,
-                                         -1 * "/test_ctypes.xul".length);
-      let components = path.split("/");
-      for (let part in components) {
-        dir.append(components[part]);
-      }
+      var dir = getCurrentDir(location.path);
       ok(dir.exists() && dir.isDirectory(), "Chrome test dir doesn't exist?!");
       worker.postMessage(dir.path);
     }
 
   ]]>
   </script>
 
   <body xmlns="http://www.w3.org/1999/xhtml">
--- a/toolkit/components/places/tests/chrome/test_329534.xul
+++ b/toolkit/components/places/tests/chrome/test_329534.xul
@@ -79,18 +79,18 @@ var observer =
         bmsvc.removeItem(gLivemarkId1);
         bmsvc.removeItem(gLivemarkId2);
         SimpleTest.finish();
       }
     }
   },
   onBeforeItemRemoved: function(){},
   onItemRemoved: function() {},
-  onItemChanged: function() {}
-  onItemVisited: function() {}
+  onItemChanged: function() {},
+  onItemVisited: function() {},
   onItemMoved: function() {}
 };
 bmsvc.addObserver(observer, false);
 
 // start updating livemarks
 firstLoadTime = Date.now();
 lmsvc.start();
 
--- a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
+++ b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js
@@ -32,16 +32,26 @@ function convertChromeURI(chromeURI)
 {
   let uri = Cc["@mozilla.org/network/io-service;1"].
     getService(Ci.nsIIOService).newURI(chromeURI, null, null);
   return gChromeReg.convertChromeURL(uri);
 }
 
 function chromeURIToFile(chromeURI)
 {
+  var jar = getJar(chromeURI);
+  if (jar) {
+    var tmpDir = extractJarToTmp(jar);
+    let parts = chromeURI.split('/');
+    if (parts[parts.length - 1] != '') {
+      tmpDir.append(parts[parts.length - 1]);
+    }
+    return tmpDir;
+  }
+
   return convertChromeURI(chromeURI).
     QueryInterface(Ci.nsIFileURL).file;
 }  
 
 // Register a chrome manifest temporarily and return a function which un-does
 // the registrarion when no longer needed.
 function registerManifestTemporarily(manifestURI)
 {
--- a/toolkit/content/tests/chrome/rtlchrome/rtl.manifest
+++ b/toolkit/content/tests/chrome/rtlchrome/rtl.manifest
@@ -1,3 +1,9 @@
+content rtlchrome /content
+
+# Override intl.css with our own CSS file
+override chrome://global/locale/intl.css chrome://rtlchrome/rtl.css
+override chrome://global/locale/global.dtd chrome://rtlchrome/rtl.dtd
+
 # Override intl.css with our own CSS file
 override chrome://global/locale/intl.css chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.css
 override chrome://global/locale/global.dtd chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.dtd
--- a/toolkit/content/tests/chrome/test_bug437844.xul
+++ b/toolkit/content/tests/chrome/test_bug437844.xul
@@ -11,16 +11,18 @@ https://bugzilla.mozilla.org/show_bug.cg
   xmlns:html="http://www.w3.org/1999/xhtml"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <title>Test for Bug 437844 and Bug 348233</title>
   <script type="application/javascript" 
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript" 
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" 
+          src="chrome://mochikit/content/chrome-harness.js"></script>
   <script type="application/javascript"
           src="RegisterUnregisterChrome.js"></script>
 
   <body  xmlns="http://www.w3.org/1999/xhtml">
     <a target="_blank" 
        href="https://bugzilla.mozilla.org/show_bug.cgi?id=437844">
       Mozilla Bug 437844
     </a>
@@ -44,21 +46,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       let cleanupFunc = registerManifestTemporarily("chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.manifest");
 
       // Load about:plugins in an iframe
       let frame = document.createElement("iframe");
       frame.setAttribute("src", "about:plugins");
       frame.addEventListener("load", function () {
           frame.removeEventListener("load", arguments.callee, false);
-
           is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales");
 
+          let gDirSvc    = Components.classes["@mozilla.org/file/directory_service;1"].
+                                      getService(Components.interfaces.nsIDirectoryService).
+                                      QueryInterface(Components.interfaces.nsIProperties);
+          let tmpd = gDirSvc.get("ProfD", Components.interfaces.nsIFile);
+
           frame = document.createElement("iframe");
-          frame.setAttribute("src", convertChromeURI("chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/").spec); // a file:// URI, bug 348233
+          frame.setAttribute("src", "file://" + tmpd.path); // a file:// URI, bug 348233
           frame.addEventListener("load", function () {
               frame.removeEventListener("load", arguments.callee, false);
 
               is(frame.contentDocument.body.dir, "rtl", "file:// listings should be RTL in RTL locales");
 
               cleanupFunc();
               SimpleTest.finish();
             }, false);
--- a/toolkit/content/tests/chrome/test_righttoleft.xul
+++ b/toolkit/content/tests/chrome/test_righttoleft.xul
@@ -8,16 +8,18 @@
         onload="runTest()"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript" 
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript" 
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" 
+          src="chrome://mochikit/content/chrome-harness.js"></script>
+  <script type="application/javascript" 
           src="RegisterUnregisterChrome.js"></script>
 
   <body  xmlns="http://www.w3.org/1999/xhtml">
     <p id="display"></p>
     <div id="content" style="display: none">
     </div>
     <pre id="test">
     </pre>
--- a/toolkit/content/tests/widgets/test_button.xul
+++ b/toolkit/content/tests/widgets/test_button.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for button
   -->
 <window title="Button Test"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" 
           src="/MochiKit/packed.js"></script>
   <script type="application/javascript"
--- a/toolkit/content/tests/widgets/test_deck.xul
+++ b/toolkit/content/tests/widgets/test_deck.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for deck
   -->
 <window title="Deck Test"
         onload="setTimeout(test_deck, 0);"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" 
           src="/MochiKit/packed.js"></script>
--- a/toolkit/content/tests/widgets/test_props.xul
+++ b/toolkit/content/tests/widgets/test_props.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for basic properties - this test checks that the basic
   properties defined in general.xml and inherited by a number of elements
   work properly.
   -->
 <window title="Basic Properties Test"
         onload="setTimeout(test_props, 0);"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
--- a/toolkit/content/tests/widgets/test_richlist_direction.xul
+++ b/toolkit/content/tests/widgets/test_richlist_direction.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for listbox direction
   -->
 <window title="Listbox direction test"
         onload="test_richlistbox()"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript"
           src="/MochiKit/packed.js"></script>
--- a/toolkit/content/tests/widgets/test_statusbar.xul
+++ b/toolkit/content/tests/widgets/test_statusbar.xul
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for statusbar
   -->
 <window title="Statusbar Test"
         onload="setTimeout(test_statusbar, 0);"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" 
           src="/MochiKit/packed.js"></script>
--- a/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
@@ -49,17 +49,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 var dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
 dmFile.append("dm-ui-test.file");
--- a/toolkit/mozapps/downloads/tests/chrome/test_basic_functionality.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_basic_functionality.xul
@@ -48,17 +48,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 var dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
 dmFile.append("dm-ui-test.file");
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
@@ -49,17 +49,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 let didFail = false;
 var file;
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_429247.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_429247.xul
@@ -49,17 +49,18 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
+
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
@@ -57,17 +57,17 @@ close window
 <window title="Mozilla Bug 462172"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="application/javascript">
   <![CDATA[
 
   /** Test for Bug 462172 **/
 var missingFileElid;
 var realFileElid;
--- a/toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
@@ -49,17 +49,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_clear_button_disabled.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_clear_button_disabled.xul
@@ -51,17 +51,17 @@
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
 
   <![CDATA[
 
 let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 let dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
--- a/toolkit/mozapps/downloads/tests/chrome/test_close_download_manager.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_close_download_manager.xul
@@ -50,17 +50,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
 
   <![CDATA[
 
 const dmui = getDMUI();
 
 function testCloseDMWithEscKey(aWin)
--- a/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
@@ -15,17 +15,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
@@ -54,17 +54,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 var dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
 dmFile.append("dm-ui-test.file");
--- a/toolkit/mozapps/downloads/tests/chrome/test_esc_key_closes_clears.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_esc_key_closes_clears.xul
@@ -48,17 +48,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
 let os = Cc["@mozilla.org/observer-service;1"].
          getService(Ci.nsIObserverService);
--- a/toolkit/mozapps/downloads/tests/chrome/test_multi_select.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_multi_select.xul
@@ -49,17 +49,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
@@ -47,17 +47,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_pause_button_state.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_pause_button_state.xul
@@ -47,17 +47,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 var dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
 dmFile.append("dm-ui-test.file");
--- a/toolkit/mozapps/downloads/tests/chrome/test_privatebrowsing_title.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_privatebrowsing_title.xul
@@ -48,17 +48,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   // The private browsing service might not be available
   let pbs = null;
--- a/toolkit/mozapps/downloads/tests/chrome/test_removeDownload_updates_ui.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_removeDownload_updates_ui.xul
@@ -46,17 +46,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
 var dmFile = Cc["@mozilla.org/file/directory_service;1"].
              getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
 dmFile.append("dm-ui-test.file");
--- a/toolkit/mozapps/downloads/tests/chrome/test_retention_is_0_closes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_retention_is_0_closes.xul
@@ -49,17 +49,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function setPref(aDoTest)
 {
   let prefs = Cc["@mozilla.org/preferences-service;1"].
               getService(Ci.nsIPrefBranch);
--- a/toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
@@ -46,17 +46,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
@@ -50,17 +50,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test_meta_k(aWin)
 {
   let doc = aWin.document;
   let searchbox = doc.getElementById("searchbox");
--- a/toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
@@ -48,17 +48,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_space_key_pauses_resumes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_space_key_pauses_resumes.xul
@@ -49,17 +49,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function bug413985obs(aWin)
 {
   this.mWin = aWin;
   this.wasPaused = false;
--- a/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_downloadstates.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_downloadstates.xul
@@ -49,17 +49,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 const kTaskbarID = "@mozilla.org/windows-taskbar;1";
 const DOWNLOAD_MANAGER_URL = "chrome://mozapps/content/downloads/downloads.xul";
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_service.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_service.xul
@@ -47,17 +47,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 const kTaskbarID = "@mozilla.org/windows-taskbar;1";
 const DOWNLOAD_MANAGER_URL = "chrome://mozapps/content/downloads/downloads.xul";
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_ui_stays_open_on_alert_clickback.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_ui_stays_open_on_alert_clickback.xul
@@ -47,17 +47,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="test();">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
--- a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul
@@ -47,17 +47,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="init()">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
-          src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
+          src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
 const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul";
 
 let testIndex = -1;
 let tests = [
--- a/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_dragdrop.js
@@ -116,33 +116,31 @@ add_test(function() {
                [[{type: "text/x-moz-url", data: url}]],
                "copy", gManagerWindow);
   is(effect, "copy", "Drag should be accepted");
 });
 
 // Simulates dropping a file onto the manager
 add_test(function() {
   var fileurl = get_addon_file_url("browser_dragdrop1.xpi");
-
   new WindowOpenListener(INSTALL_URI, function(aWindow) {
     test_confirmation(aWindow, [fileurl.spec]);
   }, run_next_test);
 
   var viewContainer = gManagerWindow.document.getElementById("view-container");
   var effect = EventUtils.synthesizeDrop(viewContainer, viewContainer,
                [[{type: "application/x-moz-file", data: fileurl.file}]],
                "copy", gManagerWindow);
   is(effect, "copy", "Drag should be accepted");
 });
 
 // Simulates dropping two urls onto the manager
 add_test(function() {
   var url1 = TESTROOT + "addons/browser_dragdrop1.xpi";
   var url2 = TESTROOT2 + "addons/browser_dragdrop2.xpi";
-
   new WindowOpenListener(INSTALL_URI, function(aWindow) {
     test_confirmation(aWindow, [url1, url2]);
   }, run_next_test);
 
   var viewContainer = gManagerWindow.document.getElementById("view-container");
   var effect = EventUtils.synthesizeDrop(viewContainer, viewContainer,
                [[{type: "text/x-moz-url", data: url1}],
                 [{type: "text/x-moz-url", data: url2}]],
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -45,20 +45,35 @@ function run_next_test() {
 
   gTestsRun++;
   info("Running test " + gTestsRun);
 
   gPendingTests.shift()();
 }
 
 function get_addon_file_url(aFilename) {
-  var cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
-           getService(Ci.nsIChromeRegistry);
-  var fileurl = cr.convertChromeURL(makeURI(CHROMEROOT + "addons/" + aFilename));
-  return fileurl.QueryInterface(Ci.nsIFileURL);
+  var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
+                         .getService(Ci.mozIJSSubScriptLoader);
+  loader.loadSubScript("chrome://mochikit/content/chrome-harness.js");
+
+  var jar = getJar(CHROMEROOT + "addons/" + aFilename);
+
+  if (jar == null) {
+    var cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
+             getService(Ci.nsIChromeRegistry);
+    var fileurl = cr.convertChromeURL(makeURI(CHROMEROOT + "addons/" + aFilename));
+    return fileurl.QueryInterface(Ci.nsIFileURL);
+  } else {
+    var ios = Cc["@mozilla.org/network/io-service;1"].  
+                getService(Ci.nsIIOService);
+
+    var tmpDir = extractJarToTmp(jar);
+    tmpDir.append(aFilename);
+    return ios.newFileURI(tmpDir).QueryInterface(Ci.nsIFileURL);
+  }
 }
 
 function wait_for_view_load(aManagerWindow, aCallback, aForceWait) {
   if (!aForceWait && !aManagerWindow.gViewController.isLoading) {
     aCallback(aManagerWindow);
     return;
   }
 
--- a/toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, basic, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, basic, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, basic, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, basic, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, basic, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, basic, license, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, billboard, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, billboard, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, billboard, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, billboard, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, billboard, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, add-ons check, billboard, license, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_INCOMPAT_CHECK
--- a/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: basic, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_FOUND_BASIC,
   buttonClick: "next"
 }, {
--- a/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: basic, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_FOUND_BASIC,
   buttonClick: "next"
 }, {
--- a/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, basic, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, basic, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, basic, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, basic, license, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BASIC,
--- a/toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: billboard, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_FOUND_BILLBOARD,
   extraDelayedCheckFunction: checkRemoteContentState,
   expectedRemoteContentState: "loading",
--- a/toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: billboard, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_FOUND_BILLBOARD,
   extraDelayedCheckFunction: checkRemoteContentState,
   expectedRemoteContentState: "loading",
--- a/toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, billboard, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, billboard, license, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, billboard, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: add-ons check, billboard, license, add-ons list, download, and finished"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INCOMPAT_CHECK
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check and error (xml malformed)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_ERRORS,
--- a/toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check and no updates found"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_NO_UPDATES_FOUND,
--- a/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, billoard, basic, license, and manual update (bug 548061)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check, billoard, basic, license, and manual update (bug 548061)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
 }, {
   pageid: PAGEID_FOUND_BILLBOARD,
--- a/toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: errors (partial only patch apply failure)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_ERRORS,
   buttonClick: "finish"
 } ];
--- a/toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: errors (complete only patch apply failure)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_ERRORS,
   buttonClick: "finish"
 } ];
--- a/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: error patching, download, and finished (partial failed and download complete)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_ERROR_PATCHING,
   buttonClick: "next"
 }, {
--- a/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: error patching, download, and errors (partial failed and download complete verification failure)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_ERROR_PATCHING,
   buttonClick: "next"
 }, {
--- a/toolkit/mozapps/update/test/chrome/test_0091_installed.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0091_installed.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: installed"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_INSTALLED,
   buttonClick: "finish"
 } ];
--- a/toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: finished background"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 const TESTS = [ {
   pageid: PAGEID_FINISHED_BKGRD,
   buttonClick: "extra1"
 } ];
--- a/toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check and basic (never button test)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
--- a/toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul
@@ -11,17 +11,17 @@
 <window title="Update Wizard pages: update check and billboard (never button test)"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTestDefault();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 gPrefToCheck = PREF_APP_UPDATE_NEVER_BRANCH + Services.appinfo.version;
 
 const TESTS = [ {
   pageid: PAGEID_CHECKING
--- a/toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul
+++ b/toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul
@@ -18,17 +18,17 @@
 <window title="Application Update test cleanup"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="runTest();">
 <script type="application/javascript" 
         src="chrome://mochikit/content/MochiKit/packed.js"/>
 <script type="application/javascript"
         src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 <script type="application/javascript"
-        src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
+        src="utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 /**
  * If the application update tests left behind any of the files it uses it could
  * be a very bad thing. The purpose of this test is to prevent that from
  * happening.
--- a/toolkit/xre/test/test_fpuhandler.html
+++ b/toolkit/xre/test/test_fpuhandler.html
@@ -1,12 +1,12 @@
 <head>
   <title>Floating-point exception handler test</title>
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <body onload="runTest()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
 
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
 
   function doDiv(x, y) {