Bug 792036 - Automated fixups. r=mccr8
authorBobby Holley <bobbyholley@gmail.com>
Mon, 24 Sep 2012 14:46:29 +0200
changeset 108017 1f7c4fae49c0d80075e7b0380c4b841a5ed30ab0
parent 108016 a8583bee3c377dd9878dca774d3ff01adcbea3c5
child 108018 633082d3e5468cb48d0e61dfb4e84c4b29dfa9ac
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersmccr8
bugs792036
milestone18.0a1
Bug 792036 - Automated fixups. r=mccr8 find /files/mozilla/build/d/_tests/testing/mochitest/tests/ | egrep "\.(xhtml|html|xml|js)$" | grep -v SimpleTest | grep -vi mochikit | grep -v simpleThread | grep -v test_ipc_messagemanager_blob.html | grep -v "indexedDB/test" | xargs grep -l Components | xargs grep -L enablePrivilege | perl -pe 's#.*mochitest/tests/##' | xargs perl -p -i.bakkk -e 's/Components\.interfaces(\s|;|\.|\[)/SpecialPowers\.Ci$1/g, s/SpecialPowers\.wrap\(Components\)\.(.)(lasses|tils|nterfaces|esults)/SpecialPowers.C$1/g, s/(?<![\.a-zA-Z])Components/SpecialPowers\.Components/g, s/window\.Components/window\.SpecialPowers\.Components/g'
browser/base/content/test/test_contextmenu.html
browser/base/content/test/test_offlineNotification.html
browser/base/content/test/test_offline_gzip.html
caps/tests/mochitest/test_bug246699.html
content/base/test/test_XHR_anon.html
content/base/test/test_XHR_system.html
content/base/test/test_bug166235.html
content/base/test/test_bug345339.html
content/base/test/test_bug352728.html
content/base/test/test_bug352728.xhtml
content/base/test/test_bug375314.html
content/base/test/test_bug393968.html
content/base/test/test_bug397234.html
content/base/test/test_bug413974.html
content/base/test/test_bug422403-1.html
content/base/test/test_bug422537.html
content/base/test/test_bug431701.html
content/base/test/test_bug450160.html
content/base/test/test_bug475156.html
content/base/test/test_bug482935.html
content/base/test/test_treewalker_nextsibling.xml
content/canvas/test/test_canvas.html
content/events/test/test_bug448602.html
content/events/test/test_bug493251.html
content/events/test/test_bug545268.html
content/events/test/test_bug547996-1.html
content/events/test/test_bug547996-2.xhtml
content/events/test/test_bug742376.html
content/html/content/test/file_fullscreen-esc-exit-inner.html
content/html/content/test/test_bug143220.html
content/html/content/test/test_bug523771.html
content/html/document/test/test_bug512367.html
content/media/test/manifest.js
content/xslt/tests/mochitest/test_bug319374.xhtml
docshell/test/navigation/NavigationUtils.js
docshell/test/test_bug369814.html
docshell/test/test_bug509055.html
dom/alarm/test/test_alarm_permitted_app.html
dom/browser-element/mochitest/browserElement_Auth.js
dom/browser-element/mochitest/browserElement_KeyEvents.js
dom/browser-element/mochitest/file_focus.html
dom/contacts/tests/test_contacts_basics.html
dom/contacts/tests/test_contacts_blobs.html
dom/devicestorage/ipc/test_ipc.html
dom/devicestorage/test/devicestorage_common.js
dom/devicestorage/test/test_lastModificationFilter.html
dom/file/test/test_archivereader.html
dom/file/test/test_archivereader_zip_in_zip.html
dom/file/test/test_lockedfile_lifetimes_nested.html
dom/file/test/test_success_events_after_abort.html
dom/identity/tests/head_identity.js
dom/indexedDB/ipc/test_ipc.html
dom/settings/tests/test_settings_basics.html
dom/tests/mochitest/ajax/offline/foreign2.html
dom/tests/mochitest/ajax/offline/obsolete.html
dom/tests/mochitest/ajax/offline/test_foreign.html
dom/tests/mochitest/ajax/offline/test_updatingManifest.html
dom/tests/mochitest/bugs/test_bug317448.html
dom/tests/mochitest/bugs/test_bug369306.html
dom/tests/mochitest/bugs/test_bug534149.html
dom/tests/mochitest/bugs/utils_bug260264.js
dom/tests/mochitest/general/test_interfaces.html
dom/tests/mochitest/geolocation/test_mozsettings.html
dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html
dom/tests/mochitest/localstorage/pbSwitch.js
dom/tests/mochitest/localstorage/test_cookieBlock.html
dom/tests/mochitest/localstorage/test_cookieSession-phase1.html
dom/tests/mochitest/localstorage/test_cookieSession-phase2.html
dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
dom/tests/mochitest/whatwg/test_bug500328.html
editor/composer/test/test_bug519928.html
editor/libeditor/html/tests/test_bug432225.html
editor/libeditor/html/tests/test_bug468353.html
editor/libeditor/html/tests/test_bug520189.html
editor/libeditor/html/tests/test_bug525389.html
editor/libeditor/html/tests/test_root_element_replacement.html
js/xpconnect/tests/mochitest/test_bug772288.html
js/xpconnect/tests/mochitest/test_lookupMethod.html
layout/base/tests/bug585922-ref.html
layout/base/tests/bug585922.html
layout/base/tests/test_bug449781.html
layout/forms/test/test_bug348236.html
layout/forms/test/test_bug411236.html
layout/generic/test/test_bug348681.html
toolkit/components/passwordmgr/test/prompt_common.js
toolkit/components/passwordmgr/test/test_bug_627616.html
toolkit/components/passwordmgr/test/test_prompt.html
toolkit/components/passwordmgr/test/test_prompt_async.html
toolkit/components/passwordmgr/test/test_xml_load.html
toolkit/components/prompts/test/test_bug620145.html
toolkit/components/satchel/test/satchel_common.js
toolkit/components/satchel/test/test_bug_511615.html
toolkit/content/tests/widgets/popup_shared.js
toolkit/content/tests/widgets/use_large_cache.js
toolkit/identity/tests/mochitest/head_identity.js
uriloader/exthandler/tests/mochitest/handlerApps.js
--- a/browser/base/content/test/test_contextmenu.html
+++ b/browser/base/content/test/test_contextmenu.html
@@ -13,20 +13,20 @@ Browser context menu tests.
 <div id="content">
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: multiple login autocomplete. **/
 
-SpecialPowers.wrap(Components).utils.import("resource://gre/modules/InlineSpellChecker.jsm", window);
+SpecialPowers.Cu.import("resource://gre/modules/InlineSpellChecker.jsm", window);
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
+const Cc = SpecialPowers.Components.classes;
+const Ci = SpecialPowers.Ci;
 
 function openContextMenuFor(element, shiftkey, shouldWaitForFocus) {
     // Context menu should be closed before we open it again.
     is(SpecialPowers.wrap(contextMenu).state, "closed", "checking if popup is closed");
 
     if (lastElement)
       lastElement.blur();
     element.focus();
--- a/browser/base/content/test/test_offlineNotification.html
+++ b/browser/base/content/test/test_offlineNotification.html
@@ -21,37 +21,37 @@ https://bugzilla.mozilla.org/show_bug.cg
 <iframe id="eventsTestFrame" src="offlineEvent.html"></iframe>
 
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
-const Cc = SpecialPowers.wrap(Components).classes;
+const Cc = SpecialPowers.Cc;
 
 var numFinished = 0;
 
 window.addEventListener("message", function(event) {
     is(event.data, "success", "Child was successfully cached.");
 
     if (++numFinished == 3) {
       // Clean up after ourself
       var pm = Cc["@mozilla.org/permissionmanager;1"].
-               getService(Components.interfaces.nsIPermissionManager);
+               getService(SpecialPowers.Ci.nsIPermissionManager);
       var ioService = Cc["@mozilla.org/network/io-service;1"]
-                        .getService(Components.interfaces.nsIIOService);
+                        .getService(SpecialPowers.Ci.nsIIOService);
       var uri1 = ioService.newURI(frames.testFrame.location, null, null);
       var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
 
       var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                        .getService(Components.interfaces.nsIScriptSecurityManager)
+                        .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
                         .getNoAppCodebasePrincipal(uri1);
       var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                        .getService(Components.interfaces.nsIScriptSecurityManager)
+                        .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
                         .getNoAppCodebasePrincipal(uri2);
 
       pm.removeFromPrincipal(principal1, "offline-app");
       pm.removeFromPrincipal(principal2, "offline-app");
 
       SimpleTest.finish();
     }
   }, false);
@@ -103,18 +103,18 @@ function testEventHandling() {
 }
 
 function loaded() {
   testEventHandling();
 
   // Click the notification bar's "Allow" button.  This should kick
   // off updates, which will eventually lead to getting messages from
   // the children.
-  var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
-           getService(Components.interfaces.nsIWindowMediator);
+  var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
+           getService(SpecialPowers.Ci.nsIWindowMediator);
   var win = wm.getMostRecentWindow("navigator:browser");
   var notificationBox = win.gBrowser.getNotificationBox();
 
   var notification = notificationBox.getNotificationWithValue("offline-app-requested-mochi.test");
   notification.childNodes[0].click();
 
   notification = SpecialPowers.wrap(notificationBox).getNotificationWithValue("offline-app-requested-example.com");
   notification.childNodes[0].click();
--- a/browser/base/content/test/test_offline_gzip.html
+++ b/browser/base/content/test/test_offline_gzip.html
@@ -27,24 +27,24 @@ cache, it can be fetched from the cache 
 var cacheCount = 0;
 var intervalID = 0;
 
 window.addEventListener("message", handleMessageEvents, false);
 SimpleTest.waitForExplicitFinish();
 
 function finishTest() {
   // Clean up after ourselves.
-  var Cc = SpecialPowers.wrap(Components).classes;
+  var Cc = SpecialPowers.Cc;
   var pm = Cc["@mozilla.org/permissionmanager;1"].
-           getService(Components.interfaces.nsIPermissionManager);
+           getService(SpecialPowers.Ci.nsIPermissionManager);
 
-  var uri = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
+  var uri = Cc["@mozilla.org/network/io-service;1"].getService(SpecialPowers.Ci.nsIIOService)
               .newURI(window.frames[0].location, null, null);
   var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                   .getService(Components.interfaces.nsIScriptSecurityManager)
+                   .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
                    .getNoAppCodebasePrincipal(uri);
 
   pm.removeFromPrincipal(principal, "offline-app");
 
   window.removeEventListener("message", handleMessageEvents, false);
 
   SimpleTest.finish();  
 }
@@ -94,18 +94,18 @@ function handleMessageEvents(event) {
       ok(false, "cacheCount not 1 or 2");
   }
 }
 
 function loaded() {
   // Click the notification bar's "Allow" button.  This should kick
   // off updates, which will eventually lead to getting messages from
   // the iframe.
-  var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
-           getService(Components.interfaces.nsIWindowMediator);
+  var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
+           getService(SpecialPowers.Ci.nsIWindowMediator);
   var win = wm.getMostRecentWindow("navigator:browser");
   var notificationBox = win.gBrowser.getNotificationBox();
 
   var notification = notificationBox
     .getNotificationWithValue("offline-app-requested-mochi.test");
   notification.childNodes[0].click();
 }
 
--- a/caps/tests/mochitest/test_bug246699.html
+++ b/caps/tests/mochitest/test_bug246699.html
@@ -45,21 +45,21 @@ function inciteCaps(f)
 
 function tryChromeLoad()
 {
     window.frames[0].location = "chrome://global/content/mozilla.xhtml";
 }
 
 function tryComponentsClasses()
 {
-    return Components.classes["@mozilla.org/dummy;1"];
+    return SpecialPowers.Components.classes["@mozilla.org/dummy;1"];
 }
 
 
 is(inciteCaps(tryChromeLoad), "denied-stack",
    "should get stack for content-loading-chrome rejection");
 is(inciteCaps(tryComponentsClasses), "denied-stack",
-   "should get stack for Components.classes rejection");
+   "should get stack for SpecialPowers.Components.classes rejection");
 </script>
 </pre>
 </body>
 </html>
 
--- a/content/base/test/test_XHR_anon.html
+++ b/content/base/test/test_XHR_anon.html
@@ -16,20 +16,20 @@
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
 
 function runTests() {
   let tearDown = (function setUp() {
     SimpleTest.waitForExplicitFinish();
 
-    const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(Components);
+    const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(SpecialPowers.Components);
 
     let authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
-                    .getService(Components.interfaces.nsIHttpAuthManager)
+                    .getService(SpecialPowers.Ci.nsIHttpAuthManager)
     authMgr.setAuthIdentity("http", "example.com", 80, "basic", "testrealm",
                             "", "example.com", "user1", "password1");
 
     SpecialPowers.addPermission("systemXHR", true, document);
 
     return function tearDown() {
       authMgr.clearAll();
       SpecialPowers.removePermission("systemXHR", document);
--- a/content/base/test/test_XHR_system.html
+++ b/content/base/test/test_XHR_system.html
@@ -11,17 +11,17 @@
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
 function runTests() {
-  var comp = SpecialPowers.wrap(Components);
+  var comp = SpecialPowers.wrap(SpecialPowers.Components);
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.addPermission("systemXHR", true, document);
 
   function tearDown() {
     SpecialPowers.removePermission("systemXHR", document);
     SimpleTest.finish();
   }
 
--- a/content/base/test/test_bug166235.html
+++ b/content/base/test/test_bug166235.html
@@ -16,29 +16,29 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <textarea id="input"></textarea>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 166235 **/
-  var Cc = SpecialPowers.wrap(Components).classes;
-  var Ci = SpecialPowers.wrap(Components).interfaces;
+  var Cc = SpecialPowers.Cc;
+  var Ci = SpecialPowers.Ci;
 
-  var webnav = SpecialPowers.wrap(window).QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                                         .getInterface(Components.interfaces.nsIWebNavigation)
+  var webnav = SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+                                         .getInterface(SpecialPowers.Ci.nsIWebNavigation)
 
-  var docShell = webnav.QueryInterface(Components.interfaces.nsIDocShell);
+  var docShell = webnav.QueryInterface(SpecialPowers.Ci.nsIDocShell);
 
   var documentViewer = docShell.contentViewer
-                               .QueryInterface(Components.interfaces.nsIContentViewerEdit);
+                               .QueryInterface(SpecialPowers.Ci.nsIContentViewerEdit);
 
   var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
-                    .getService(Components.interfaces.nsIClipboard);
+                    .getService(SpecialPowers.Ci.nsIClipboard);
 
   var textarea = SpecialPowers.wrap(document).getElementById('input');
 
   function getLoadContext() {
     return SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor)
                                      .getInterface(Ci.nsIWebNavigation)
                                      .QueryInterface(Ci.nsILoadContext);
   }
@@ -49,36 +49,36 @@ https://bugzilla.mozilla.org/show_bug.cg
     window.getSelection().selectAllChildren(document.getElementById(id));
     documentViewer.copySelection();
 
     is(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), true);
     is(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), true);
   }
   function getClipboardData(mime) {
     var transferable = Cc['@mozilla.org/widget/transferable;1']
-                         .createInstance(Components.interfaces.nsITransferable);
+                         .createInstance(SpecialPowers.Ci.nsITransferable);
     transferable.init(getLoadContext());
     transferable.addDataFlavor(mime);
     clipboard.getData(transferable, 1);
     var data = SpecialPowers.wrap({});
     transferable.getTransferData(mime, data, {}) ;
     return data;
   }
   function testClipboardValue(mime, expected, test) {
     var data = getClipboardData(mime);
     is (data.value == null ? data.value :
-        data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
+        data.value.QueryInterface(SpecialPowers.Ci.nsISupportsString).data,
       expected,
       mime + " value in the clipboard");
     return data.value;
   }
   function testPasteText(expected, test) {
     textarea.value="";
     textarea.focus();
-    textarea.QueryInterface(Components.interfaces.nsIDOMNSEditableElement)
+    textarea.QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement)
             .editor.paste(1);
     is(textarea.value, expected, test + ": textarea paste");
   }
   function testInnerHTML(id, expected) {
     var value = document.getElementById(id).innerHTML;
     is(value, expected, id + ".innerHTML");
   }
 
--- a/content/base/test/test_bug345339.html
+++ b/content/base/test/test_bug345339.html
@@ -27,21 +27,21 @@ function afterLoad() {
     var iframeDoc = $("testframe").contentDocument;
 
     /* change all the form controls */
     iframeDoc.getElementById("select").selectedIndex = 1;
     iframeDoc.getElementById("radio2").checked = true;
     iframeDoc.getElementById("password").value = "123456";
     iframeDoc.getElementById("hidden").value = "gecko";
 
-    var file = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
-             .getService(Components.interfaces.nsIProperties)
-             .get("TmpD", Components.interfaces.nsILocalFile);
+    var file = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
+             .getService(SpecialPowers.Ci.nsIProperties)
+             .get("TmpD", SpecialPowers.Ci.nsILocalFile);
     file.append("345339_test.file");
-    file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+    file.createUnique(SpecialPowers.Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
     filePath = file.path;
 
     SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath;
 
     /* Reload the page */
     $("testframe").setAttribute("onload", "afterReload()");
     iframeDoc.location.reload();
 }
--- a/content/base/test/test_bug352728.html
+++ b/content/base/test/test_bug352728.html
@@ -24,17 +24,17 @@ function checkTypes(aNode, aNodeType, aT
     ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
        aNodeType + " should be a " + aTypeArray[i]);
   }
 }
 
 function checkInterfaces(aNode, aNodeType, aInterfaceArray)
 {
   for (var i = 0; i < aInterfaceArray.length; ++i) {
-    ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
+    ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
        aNodeType + " interface test " + i,
        aNodeType + " should be a " + aInterfaceArray[i]);
   }
 }
 
 function testCharacterData(aNode, aText)
 {
   is(aNode.length, aText.length, "Text length should match");
--- a/content/base/test/test_bug352728.xhtml
+++ b/content/base/test/test_bug352728.xhtml
@@ -48,17 +48,17 @@ function checkTypes(aNode, aNodeType, aT
     ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
        aNodeType + " should be a " + aTypeArray[i]);
   }
 }
 
 function checkInterfaces(aNode, aNodeType, aInterfaceArray)
 {
   for (var i = 0; i < aInterfaceArray.length; ++i) {
-    ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
+    ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
        aNodeType + " interface test " + i,
        aNodeType + " should be a " + aInterfaceArray[i]);
   }
 }
 
 function testCharacterData(aNode, aText)
 {
   is(aNode.length, aText.length, "Text length should match");
--- a/content/base/test/test_bug375314.html
+++ b/content/base/test/test_bug375314.html
@@ -16,33 +16,33 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 375314 **/
 
 var lastContentType = -1;
 const testURL = window.location.href + "/this/is/the/test/url";
-const Cc = SpecialPowers.wrap(Components).classes;
-const Ci = Components.interfaces;
+const Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
 
 // Content policy / factory implementation for the test
-var policyID = SpecialPowers.wrap(Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
+var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
 var policyName = "@mozilla.org/testpolicy;1";
 var policy = {
   // nsISupports implementation
   QueryInterface: function(iid) {
 
     iid = SpecialPowers.wrap(iid);
     if (iid.equals(Ci.nsISupports) ||
         iid.equals(Ci.nsIFactory) ||
         iid.equals(Ci.nsIContentPolicy))
       return this;
 
-    throw SpecialPowers.wrap(Components).results.NS_ERROR_NO_INTERFACE;
+    throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
   },
 
   // nsIFactory implementation
   createInstance: function(outer, iid) {
     return this.QueryInterface(iid);
   },
 
   // nsIContentPolicy implementation
@@ -59,17 +59,17 @@ var policy = {
 
   shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
 
     return Ci.nsIContentPolicy.ACCEPT;
   }
 }
 
 // Register content policy
-var componentManager = SpecialPowers.wrap(Components).manager
+var componentManager = SpecialPowers.wrap(SpecialPowers.Components).manager
                                                      .QueryInterface(Ci.nsIComponentRegistrar);
 
 componentManager.registerFactory(policyID, "Test content policy", policyName, policy);
 
 var categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
 categoryManager.addCategoryEntry("content-policy", policyName, policyName, false, true);
 
 // Try creating different request types
--- a/content/base/test/test_bug393968.html
+++ b/content/base/test/test_bug393968.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 393968 **/
 var req = new XMLHttpRequest();
 req.open("POST", window.location.href);
 req.setRequestHeader("Content-Type", "text/plain; charset=us-ascii; boundary=01234567890");
 req.send("Some text");
 
 is(SpecialPowers.wrap(req).channel
-      .QueryInterface(Components.interfaces.nsIHttpChannel)
+      .QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
       .getRequestHeader("Content-Type"),
    "text/plain; charset=UTF-8; boundary=01234567890",
    "Headers should match");
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/base/test/test_bug397234.html
+++ b/content/base/test/test_bug397234.html
@@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug 397234 **/
 var req = new XMLHttpRequest();
 req.open("POST", window.location.href);
 // Capitalization of charet param is on purpose!
 req.setRequestHeader("Content-Type", "text/plain; charset='uTf-8'");
 req.send("Some text");
 
 is(SpecialPowers.wrap(req).channel
-      .QueryInterface(Components.interfaces.nsIHttpChannel)
+      .QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
       .getRequestHeader("Content-Type"),
    "text/plain; charset='uTf-8'",
    "Headers should match");
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/base/test/test_bug413974.html
+++ b/content/base/test/test_bug413974.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 413974 **/
 var req = new XMLHttpRequest();
 req.open("POST", window.location.href);
 req.setRequestHeader("Content-Type", "text/plain; boundary=01234567890");
 req.send("Some text");
 
 is(SpecialPowers.wrap(req).channel
-      .QueryInterface(Components.interfaces.nsIHttpChannel)
+      .QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
       .getRequestHeader("Content-Type"),
    "text/plain; charset=UTF-8; boundary=01234567890",
    "Charset should come before boundary");
 </script>
 </pre>
 </body>
 </html>
 
--- a/content/base/test/test_bug422403-1.html
+++ b/content/base/test/test_bug422403-1.html
@@ -18,41 +18,41 @@
 <script class="testbody" type="text/javascript">
 
 
 function loadFileContent(aFile, aCharset) {
     //if(aAsIso == undefined) aAsIso = false;
     if(aCharset == undefined)
         aCharset = 'UTF-8';
 
-    var baseUri = SpecialPowers.wrap(Components).classes['@mozilla.org/network/standard-url;1']
-                   .createInstance(Components.interfaces.nsIURI);
+    var baseUri = SpecialPowers.Cc['@mozilla.org/network/standard-url;1']
+                   .createInstance(SpecialPowers.Ci.nsIURI);
     baseUri.spec = window.location.href;
 
-    var ios = SpecialPowers.wrap(Components).classes['@mozilla.org/network/io-service;1']
-            .getService(Components.interfaces.nsIIOService);
+    var ios = SpecialPowers.Cc['@mozilla.org/network/io-service;1']
+            .getService(SpecialPowers.Ci.nsIIOService);
     var chann = ios.newChannel(aFile, aCharset, baseUri);
 
-    var cis = Components.interfaces.nsIConverterInputStream;
+    var cis = SpecialPowers.Ci.nsIConverterInputStream;
 
-    var inputStream = SpecialPowers.wrap(Components).classes["@mozilla.org/intl/converter-input-stream;1"]
+    var inputStream = SpecialPowers.Cc["@mozilla.org/intl/converter-input-stream;1"]
                        .createInstance(cis);
     inputStream.init(chann.open(), aCharset, 1024, cis.DEFAULT_REPLACEMENT_CHARACTER);
     var str = {}, content = '';
     while (inputStream.readString(4096, str) != 0) {
         content += str.value;
     }
     return content;
 }
 
 
 function testHtmlSerializer_1 () {
-  const de = Components.interfaces.nsIDocumentEncoder
-  var encoder = SpecialPowers.wrap(Components).classes["@mozilla.org/layout/documentEncoder;1?type=application/xhtml+xml"]
-                   .createInstance(Components.interfaces.nsIDocumentEncoder);
+  const de = SpecialPowers.Ci.nsIDocumentEncoder
+  var encoder = SpecialPowers.Cc["@mozilla.org/layout/documentEncoder;1?type=application/xhtml+xml"]
+                   .createInstance(SpecialPowers.Ci.nsIDocumentEncoder);
 
   var doc = SpecialPowers.wrap($("testframe")).contentDocument;
   var out, expected;
 
   // in the following tests, we must use the OutputLFLineBreak flag, to avoid
   // to have the default line break of the platform in the result, so the test
   // can pass on all platform
 
--- a/content/base/test/test_bug422537.html
+++ b/content/base/test/test_bug422537.html
@@ -14,18 +14,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 422537 **/
-var isupports_string = SpecialPowers.wrap(Components).classes["@mozilla.org/supports-string;1"]
-                                    .createInstance(Components.interfaces.nsISupportsString);
+var isupports_string = SpecialPowers.Cc["@mozilla.org/supports-string;1"]
+                                    .createInstance(SpecialPowers.Ci.nsISupportsString);
 isupports_string.data = "foo";
 
 const url = "http://mochi.test:8888";
 var body = [
   document,
   "foo",
   isupports_string
 ];
@@ -33,23 +33,23 @@ var body = [
 for each (var i in body) {
   var xhr = new XMLHttpRequest();
   xhr.open("POST", url, true);
   if (i == isupports_string)
     SpecialPowers.wrap(xhr).send(i);
   else
     xhr.send(i);
   var chan = SpecialPowers.wrap(xhr).channel;
-  if (!SpecialPowers.call_Instanceof(chan, Components.interfaces.nsIUploadChannel))
+  if (!SpecialPowers.call_Instanceof(chan, SpecialPowers.Ci.nsIUploadChannel))
     throw "Must be an upload channel";
   var stream = chan.uploadStream;
-  if (!stream || !SpecialPowers.call_Instanceof(stream, Components.interfaces.nsISeekableStream))
+  if (!stream || !SpecialPowers.call_Instanceof(stream, SpecialPowers.Ci.nsISeekableStream))
     throw "Stream must be seekable";
   // the following is a no-op, but should not throw an exception
-  stream.seek(Components.interfaces.nsISeekableStream.NS_SEEK_CUR, 0);
+  stream.seek(SpecialPowers.Ci.nsISeekableStream.NS_SEEK_CUR, 0);
 }
 
 ok(true, "xhr is seekable");
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/base/test/test_bug431701.html
+++ b/content/base/test/test_bug431701.html
@@ -93,17 +93,17 @@ addLoadEvent(function() {
   for (var i = 0; i < tests.length; ++i) {
     doTest(i);
   }
 
   // Now check what xhr does
   var xhr = new XMLHttpRequest();
   xhr.open("POST", document.location.href);
   xhr.send(createDoc());
-  is(SpecialPowers.wrap(xhr).channel.QueryInterface(Components.interfaces.nsIHttpChannel)
+  is(SpecialPowers.wrap(xhr).channel.QueryInterface(SpecialPowers.Ci.nsIHttpChannel)
                 .getRequestHeader("Content-Type"),
      "application/xml; charset=UTF-8", "Testing correct type on the wire");
   xhr.abort();
                      
   SimpleTest.finish();
 });
 
 
--- a/content/base/test/test_bug450160.html
+++ b/content/base/test/test_bug450160.html
@@ -27,19 +27,19 @@ function testHTMLDocuments(ids, isXHTML)
                                                  ids[i],
                                                  null);
     ok(docType1, "No doctype?");
     ok(docType1.ownerDocument, "docType should have ownerDocument!");
     var doc1 = document.implementation.createDocument(null, null, docType1);
     is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
     ok(!doc1.documentElement, "Document shouldn't have document element!");
     is(doc1.body, null, "Shouldn't have .body!");
-    ok(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument,
+    ok(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument,
        "Document should be an HTML document!");
-    ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
+    ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
        "Document shouldn't be an SVG document!");
 
     var docType2 =
       document.implementation.createDocumentType(isXHTML ? "html" : "HTML",
                                                  ids[i],
                                                  null);
     var doc2 = document.implementation.createDocument(
       "http://www.w3.org/1999/xhtml", "html", docType2);
@@ -63,19 +63,19 @@ function testSVGDocument() {
       document.implementation.createDocumentType("svg",
                                                  "-//W3C//DTD SVG 1.1//EN",
                                                  null);
   ok(docType1, "No doctype?");
   ok(docType1.ownerDocument, "docType should have ownerDocument!");
   var doc1 = document.implementation.createDocument(null, null, docType1);
   is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
   ok(!doc1.documentElement, "Document shouldn't have document element!");
-  ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
+  ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
      "Document shouldn't be an HTML document!");
-  ok(doc1 instanceof Components.interfaces.nsIDOMSVGDocument,
+  ok(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument,
      "Document should be an SVG document!");
 
   // SVG documents have .rootElement.
   ok("rootElement" in doc1, "No .rootElement in document");
 
   var docType2 =
       document.implementation.createDocumentType("svg",
                                                  "-//W3C//DTD SVG 1.1//EN",
@@ -90,36 +90,36 @@ function testSVGDocument() {
 function testFooBarDocument() {
   var docType1 =
       document.implementation.createDocumentType("FooBar", "FooBar", null);
   ok(docType1, "No doctype?");
   ok(docType1.ownerDocument, "docType should have ownerDocument!");
   var doc1 = document.implementation.createDocument(null, null, docType1);
   is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
   ok(!doc1.documentElement, "Document shouldn't have document element!");
-  ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
+  ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
      "Document shouldn't be an HTML document!");
-  ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
+  ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
      "Document shouldn't be an SVG document!");
 
   var docType2 =
       document.implementation.createDocumentType("FooBar", "FooBar", null);
   var doc2 = document.implementation.createDocument("FooBarNS",
                                                     "FooBar", docType2);
   ok(doc2.documentElement, "Document should have document element!");
   is(doc2.documentElement.namespaceURI, "FooBarNS", "Wrong namespaceURI!");
   is(doc2.documentElement.localName, "FooBar", "Wrong localName!");
 }
 
 function testNullDocTypeDocument() {
   var doc1 = document.implementation.createDocument(null, null, null);
   ok(!doc1.documentElement, "Document shouldn't have document element!");
-  ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
+  ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMHTMLDocument),
      "Document shouldn't be an HTML document!");
-  ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
+  ok(!(doc1 instanceof SpecialPowers.Ci.nsIDOMSVGDocument),
      "Document shouldn't be an SVG document!");
 
   var doc2 = document.implementation.createDocument("FooBarNS",
                                                     "FooBar", null);
   ok(doc2.documentElement, "Document should have document element!");
   is(doc2.documentElement.namespaceURI, "FooBarNS", "Wrong namespaceURI!");
   is(doc2.documentElement.localName, "FooBar", "Wrong localName!");
 }
--- a/content/base/test/test_bug475156.html
+++ b/content/base/test/test_bug475156.html
@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 var path = "http://mochi.test:8888/tests/content/base/test/";
 
 function fromCache(xhr)
 {
-  var ch = SpecialPowers.wrap(xhr).channel.QueryInterface(Components.interfaces.nsICachingChannel);
+  var ch = SpecialPowers.wrap(xhr).channel.QueryInterface(SpecialPowers.Ci.nsICachingChannel);
   return ch.isFromCache();  
 }
 
 var tests = [
   // First just init the file with an ETag
   {
     init: function(xhr) 
     {
--- a/content/base/test/test_bug482935.html
+++ b/content/base/test/test_bug482935.html
@@ -6,19 +6,19 @@
   <link rel="stylesheet" type="text/css" href="	/tests/SimpleTest/test.css" />
 </head>
 <body onload="onWindowLoad()">
 <script class="testbody" type="text/javascript">
 
 var url = "bug482935.sjs";
 
 function clearCache() {
-    SpecialPowers.wrap(Components).classes["@mozilla.org/network/cache-service;1"].
-               getService(Components.interfaces.nsICacheService).
-               evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
+    SpecialPowers.Cc["@mozilla.org/network/cache-service;1"].
+               getService(SpecialPowers.Ci.nsICacheService).
+               evictEntries(SpecialPowers.Ci.nsICache.STORE_ANYWHERE);
 }
 
 // Tests that the response is cached if the request is cancelled
 // after it has reached state 4
 function testCancelInPhase4() {
 
   clearCache();
 
--- a/content/base/test/test_treewalker_nextsibling.xml
+++ b/content/base/test/test_treewalker_nextsibling.xml
@@ -14,17 +14,17 @@
 <![CDATA[
 function setPass(aNode) {
   aNode.setUserData("pass", true, null);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 window.addEventListener("load", function() {
-  const nsIDOMNodeFilter = Components.interfaces.nsIDOMNodeFilter;
+  const nsIDOMNodeFilter = SpecialPowers.Ci.nsIDOMNodeFilter;
   var walker = document.createTreeWalker(
     document,
     nsIDOMNodeFilter.SHOW_TEXT | nsIDOMNodeFilter.SHOW_DOCUMENT,
     null,
     true
   );
   setPass(walker.firstChild());
   while (walker.nextSibling()) {
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -1,77 +1,77 @@
 <!DOCTYPE HTML>
 <title>Canvas Tests</title>
 <script src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
 <body>
 <script>
 
 SimpleTest.waitForExplicitFinish();
-const Cc = SpecialPowers.wrap(Components).classes;
-const Cr = SpecialPowers.wrap(Components).results;
+const Cc = SpecialPowers.Cc;
+const Cr = SpecialPowers.Cr;
 
 function IsD2DEnabled() {
     var enabled = false;
 
     try {
-        enabled = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
+        enabled = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).D2DEnabled;
     } catch(e) {}
     
     return enabled;
 }
 
 function IsLinux() {
     return navigator.platform.indexOf("Linux") == 0 &&
            navigator.appVersion.indexOf("Android") == -1;
 }
 
 function IsMacOSX10_5orOlder() {
     var is105orOlder = false;
 
     if (navigator.platform.indexOf("Mac") == 0) {
         var version = Cc["@mozilla.org/system-info;1"]
-                        .getService(Components.interfaces.nsIPropertyBag2)
+                        .getService(SpecialPowers.Ci.nsIPropertyBag2)
                         .getProperty("version");
         // the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
         // Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
         // is the Darwin version.
         is105orOlder = (parseFloat(version) < 10.0);
     }
     return is105orOlder;
 }
 
 
 function IsAzureEnabled() {
   var enabled = false;
 
   try {
-    var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
+    var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
     enabled = (backend != "none");
   } catch (e) { }
 
   return enabled;
 }
 
 function IsAzureSkia() {
   var enabled = false;
   
   try {
-    var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
+    var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
     enabled = (backend == "skia");
   } catch (e) { }
 
   return enabled;
 }
 
 function IsAzureCairo() {
   var enabled = false;
   
   try {
-    var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
+    var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
     enabled = (backend == "cairo");
   } catch (e) { }
 
   return enabled;
 }
 
 </script>
 <!-- Includes all the tests in the content/canvas/tests except for test_bug397524.html -->
--- a/content/events/test/test_bug448602.html
+++ b/content/events/test/test_bug448602.html
@@ -18,22 +18,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="application/javascript">
 
 /** Test for Bug 448602 **/
 
 
 function runTests() {
 /*
   Disabled due to lack of present support for JSD in JM
-  var jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
-  var jsd = Components.classes['@mozilla.org/js/jsd/debugger-service;1']
+  var jsdIDebuggerService = SpecialPowers.Ci.jsdIDebuggerService;
+  var jsd = SpecialPowers.Components.classes['@mozilla.org/js/jsd/debugger-service;1']
                       .getService(jsdIDebuggerService);
 */
-  var els = SpecialPowers.wrap(Components).classes["@mozilla.org/eventlistenerservice;1"]
-                      .getService(Components.interfaces.nsIEventListenerService);
+  var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"]
+                      .getService(SpecialPowers.Ci.nsIEventListenerService);
 
   // Event listener info tests
   var root = document.getElementById("testroot");
   var infos = els.getListenerInfoFor(root, {});
   is(infos.length, 0, "Element shouldn't have listeners (1)");
 
   var listenerSource = 'alert(event);';
   root.setAttribute("onclick", listenerSource);
@@ -48,17 +48,17 @@ function runTests() {
 /*
   var jsdOn = jsd.isOn;
   if (!jsdOn) {
     is(infos[0].getDebugObject(), null,
        "If JSD isn't running, getDebugObject() should return null.")
     jsd.on();
     ok(jsd.isOn, "JSD should be running.");
   }
-  var jsdvalue = infos[0].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
+  var jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
   is(jsdvalue.jsType, 3, "Event listener should be a function! (1)");
 */
 
   root.removeAttribute("onclick");
   infos = els.getListenerInfoFor(root, {});
   is(infos.length, 0, "Element shouldn't have listeners (2)");
 
   var l = function (e) { alert(e); };
@@ -67,29 +67,29 @@ function runTests() {
   infos = els.getListenerInfoFor(root, {});
   is(infos.length, 2, "Element should have listeners (2)");
   is(infos[0].toSource(), "(function (e) { alert(e); })",
      "Unexpected serialization (2)");
   is(infos[0].type, "foo", "Wrong type (2)");
   is(infos[0].capturing, true, "Wrong phase (2)");
   is(infos[0].allowsUntrusted, true, "Should allow untrusted events (2)");
 /*
-  jsdvalue = infos[0].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
+  jsdvalue = infos[0].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
   is(jsdvalue.jsType, 3, "Event listener should be a function!(2)");
   is(jsdvalue.getWrappedValue(), l, "Wrong JS value! (1)");
 */
 
   is(infos[1].toSource(), "(function (e) { alert(e); })",
      "Unexpected serialization (3)");
   is(infos[1].type, "foo", "Wrong type (3)");
   is(infos[1].capturing, false, "Wrong phase (3)");
   is(infos[1].allowsUntrusted, false, "Shouldn't allow untrusted events (1)");
 
 /*
-  jsdvalue2 = infos[1].getDebugObject().QueryInterface(Components.interfaces.jsdIValue);
+  jsdvalue2 = infos[1].getDebugObject().QueryInterface(SpecialPowers.Ci.jsdIValue);
   is(jsdvalue2.jsType, 3, "Event listener should be a function! (3)");
   is(jsdvalue2.getWrappedValue(), l, "Wrong JS value! (2)");
 */
   root.removeEventListener("foo", l, true);
   root.removeEventListener("foo", l, false);
   infos = els.getListenerInfoFor(root, {});
   is(infos.length, 0, "Element shouldn't have listeners (3)");
 
--- a/content/events/test/test_bug493251.html
+++ b/content/events/test/test_bug493251.html
@@ -35,17 +35,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     ok(true, "suppressEventHandling: aSuppress=" + aSuppress);
     utils.suppressEventHandling(aSuppress);
   }
 
   function dispatchKeyEvent(type) {
     var utils = SpecialPowers.getDOMWindowUtils(win);
     ok(true, "Dipatching key event: type=" + type);
     utils.sendKeyEvent(type, 
-                       Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
+                       SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_A,
                        0, 0);
   }
 
   function dispatchMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers) {
     var utils = SpecialPowers.getDOMWindowUtils(win);
     ok(true, "Dipatching mouse event: aType=" + aType + ", aX=" + aX + ", aY" +
                aY + ", aButton=" + aButton + ", aClickCount=" + aClickCount +
                ", aModifiers=" + aModifiers);
@@ -77,18 +77,18 @@ https://bugzilla.mozilla.org/show_bug.cg
           ", shiftKey=" + (aEvent.shiftKey ? "PRESSED" : "no") +
           ", metaKey=" + (aEvent.metaKey ? "PRESSED" : "no") +
           ", button=" + aEvent.button +
           ", relatedTarget=" + aEvent.relatedTarget;
         break;
     }
     ok(true, aEvent.type + " event is handled: " + detail);
 
-    var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"].
-                        getService(Components.interfaces.nsIFocusManager);
+    var fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"].
+                        getService(SpecialPowers.Ci.nsIFocusManager);
     ok(true, "focused element is \"" + fm.focusedElement +
              "\" and focused window is \"" + fm.focusedWindow +
              "\" (the testing window is \"" + win + "\"");
   }
 
   function doTest() {
     win.document.getElementsByTagName("input")[0].focus();
     win.addEventListener("keydown",
--- a/content/events/test/test_bug545268.html
+++ b/content/events/test/test_bug545268.html
@@ -31,17 +31,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   var keyDown = 0;
   var keyPress = 0;
   var keyUp = 0;
 
   function dispatchKeyEvent(type) {
     var utils = SpecialPowers.getDOMWindowUtils(subwin);
     utils.sendKeyEvent(type, 
-                       Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
+                       SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_A,
                        0, 0);
   }
 
   function doTest() {
     var utils = SpecialPowers.getDOMWindowUtils(win);
     var f = win.document.getElementById("f");
     subwin = f.contentWindow;
     subwin.document.getElementsByTagName("input")[0].focus();
--- a/content/events/test/test_bug547996-1.html
+++ b/content/events/test/test_bug547996-1.html
@@ -21,18 +21,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 /* mouseEvent.mozInputSource attribute */
 
 function prepareListener(eventName, expectedValue) {
   return function(event) {
     is(event.mozInputSource, expectedValue, "Correct .mozInputSource value in " + eventName);
   };
 }
 
-const INPUT_SOURCE_UNKNOWN = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
-const INPUT_SOURCE_KEYBOARD = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
+const INPUT_SOURCE_UNKNOWN = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
+const INPUT_SOURCE_KEYBOARD = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
 
 function doTest() {
   var eventNames = [
     "mousedown",
     "mouseup",
     "click",
     "dblclick",
     "contextmenu",
--- a/content/events/test/test_bug547996-2.xhtml
+++ b/content/events/test/test_bug547996-2.xhtml
@@ -24,23 +24,23 @@ var expectedInputSource = null;
 
 function check(event) {
   is(event.mozInputSource, expectedInputSource, ".mozInputSource");
 }
 
 function doTest() {
   setup();
 
-  expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
+  expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
   testKeyboard();
 
-  expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
+  expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
   testMouse();
 
-  expectedInputSource = Components.interfaces.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
+  expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
   testScriptedClicks();
 
   cleanup();
   SimpleTest.finish();
 }
 
 function testKeyboard() {
 
--- a/content/events/test/test_bug742376.html
+++ b/content/events/test/test_bug742376.html
@@ -13,18 +13,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742376">Mozilla Bug 742376</a>
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 742376 **/
 
 function getListenerCount() {
 
-  var Cc = SpecialPowers.wrap(Components).classes;
-  var Ci = SpecialPowers.wrap(Components).interfaces;
+  var Cc = SpecialPowers.Cc;
+  var Ci = SpecialPowers.Ci;
   var dss = Cc["@mozilla.org/devicesensors;1"].getService(Ci.nsIDeviceSensors);
 
   return dss.listenerCount(Ci.nsIDeviceSensorData.TYPE_ORIENTATION);
 }
 
 var startListenerCount = getListenerCount();
 
 function dumbListener(event) {}
--- a/content/html/content/test/file_fullscreen-esc-exit-inner.html
+++ b/content/html/content/test/file_fullscreen-esc-exit-inner.html
@@ -29,17 +29,17 @@ function ok(condition, msg) {
 function is(a, b, msg) {
   parent.is(a, b, msg);
 }
 
 var escKeyReceived = false;
 var escKeySent = false;
 
 function keyHandler(event) {
-  if (escKeyReceived == Components.interfaces.nsIDOMKeyEvent.DOM_VK_ESC) {
+  if (escKeyReceived == SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_ESC) {
     escKeyReceived = true;
   }
 }
 
 window.addEventListener("keydown", keyHandler, true);
 window.addEventListener("keyup", keyHandler, true);
 window.addEventListener("keypress", keyHandler, true);
 
--- a/content/html/content/test/test_bug143220.html
+++ b/content/html/content/test/test_bug143220.html
@@ -21,19 +21,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 143220 **/
 var leafName;
 var fullPath;
 
 
 function initVals() {
-  var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
-                            .getService(Components.interfaces.nsIProperties);
-  var file = dirSvc.get("XpcomLib", Components.interfaces.nsILocalFile);
+  var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
+                            .getService(SpecialPowers.Ci.nsIProperties);
+  var file = dirSvc.get("XpcomLib", SpecialPowers.Ci.nsILocalFile);
   isnot(file, null, "Must have file here");
 
   leafName = file.leafName;
   fullPath = file.path;
 }
 
 function initControl1() {
   SpecialPowers.wrap($("i1")).value = fullPath;
--- a/content/html/content/test/test_bug523771.html
+++ b/content/html/content/test/test_bug523771.html
@@ -39,22 +39,22 @@ function setFileInputs () {
   for each (file in input2Files) {
     f = createFileWithData(file.name, file.body);
     input2FileNames.push(f.path);
   }
   SpecialPowers.wrap(multiFileInput).mozSetFileNameArray(input2FileNames, input2FileNames.length);
 }
 
 function createFileWithData(fileName, fileData) {
-  var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
-                            .getService(Components.interfaces.nsIProperties);
-  var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+  var dirSvc = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
+                            .getService(SpecialPowers.Ci.nsIProperties);
+  var testFile = dirSvc.get("ProfD", SpecialPowers.Ci.nsIFile);
   testFile.append(fileName);
-  var outStream = SpecialPowers.wrap(Components).classes["@mozilla.org/network/file-output-stream;1"].
-                    createInstance(Components.interfaces.nsIFileOutputStream);
+  var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"].
+                    createInstance(SpecialPowers.Ci.nsIFileOutputStream);
   outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
                  0666, 0);
   outStream.write(fileData, fileData.length);
   outStream.close();
 
   filesToKill.push(testFile);
 
   return testFile;
--- a/content/html/document/test/test_bug512367.html
+++ b/content/html/document/test/test_bug512367.html
@@ -21,21 +21,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="application/javascript">
 
 var frame = document.getElementById("i");
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
   var viewer =
     SpecialPowers.wrap(frame.contentWindow
-                 .QueryInterface(Components.interfaces.nsIInterfaceRequestor))
-                 .getInterface(Components.interfaces.nsIWebNavigation)
-                 .QueryInterface(Components.interfaces.nsIDocShell)
+                 .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor))
+                 .getInterface(SpecialPowers.Ci.nsIWebNavigation)
+                 .QueryInterface(SpecialPowers.Ci.nsIDocShell)
                  .contentViewer
-                 .QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
+                 .QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
 
   viewer.fullZoom = 1.5;
 
   setTimeout(function() {
     synthesizeMouse(frame, 30, 30, {});
 
     is(viewer.fullZoom, 1.5, "Zoom in the image frame should not have been reset");
 
--- a/content/media/test/manifest.js
+++ b/content/media/test/manifest.js
@@ -170,19 +170,19 @@ var gSnifferTests = [
 // Converts a path/filename to a file:// URI which we can load from disk.
 // Optionally checks whether the file actually exists on disk at the location
 // we've specified.
 function fileUriToSrc(path, mustExist) {
   // android mochitest doesn't support file://
   if (navigator.appVersion.indexOf("Android") != -1)
     return path;
 
-  const Ci = Components.interfaces;
-  const Cc = SpecialPowers.wrap(Components).classes;
-  const Cr = SpecialPowers.wrap(Components).results;
+  const Ci = SpecialPowers.Ci;
+  const Cc = SpecialPowers.Cc;
+  const Cr = SpecialPowers.Cr;
   var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                getService(Ci.nsIProperties);
   var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
   var split = path.split("/");
   for(var i = 0; i < split.length; ++i) {
     f.append(split[i]);
   }
   if (mustExist && !f.exists()) {
@@ -535,19 +535,19 @@ function mediaTestCleanup() {
       A[i].parentNode.removeChild(A[i]);
       A[i] = null;
     }
     SpecialPowers.forceGC();
 }
 
 (function() {
   // Ensure that preload preferences are comsistent
-  var prefService = SpecialPowers.wrap(Components)
+  var prefService = SpecialPowers.wrap(SpecialPowers.Components)
                                  .classes["@mozilla.org/preferences-service;1"]
-                                 .getService(Components.interfaces.nsIPrefService);
+                                 .getService(SpecialPowers.Ci.nsIPrefService);
   var branch = prefService.getBranch("media.");
   var oldDefault = 2;
   var oldAuto = 3;
   var oldOpus = undefined;
   try {
     oldDefault = branch.getIntPref("preload.default");
     oldAuto    = branch.getIntPref("preload.auto");
     oldOpus    = branch.getBoolPref("opus.enabled");
--- a/content/xslt/tests/mochitest/test_bug319374.xhtml
+++ b/content/xslt/tests/mochitest/test_bug319374.xhtml
@@ -31,17 +31,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     //         cause non-anonymous XPath result to throw exceptions..
     var counter = 0;
     var error = null;
     try {
       var xp = new XPathEvaluator();
       var result = xp.evaluate("*",
                                document.getElementById('content'),
                                null,
-                               Components.interfaces.nsIDOMXPathResult.
+                               SpecialPowers.Ci.nsIDOMXPathResult.
                                  UNORDERED_NODE_ITERATOR_TYPE,
                                null);
       var res = null;
       while (res = result.iterateNext()) {
         ++counter; 
         var anon = document.getAnonymousNodes(res);
         anon[0].removeChild(anon[0].firstChild); // Removing a child node
         anon[0].removeAttribute("attr1"); // Removing an attribute
@@ -61,17 +61,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     var anonAttr2 =
       document.getAnonymousNodes(document.getElementById('content').
         lastChild)[0].getAttributeNode('attr');
     var resultAttr = null;
     try {
       var xp2 = xp.evaluate(".",
                             anonAttr1,
                             null,
-                            Components.interfaces.nsIDOMXPathResult.
+                            SpecialPowers.Ci.nsIDOMXPathResult.
                               UNORDERED_NODE_ITERATOR_TYPE,
                             null);
       // Attribute changing in a different anonymous tree.
       anonAttr2.value = "foo";
       resultAttr = xp2.iterateNext();
       ok(resultAttr == anonAttr1, "XPathEvaluator returned wrong attribute!")
     } catch (e) {
       ok(false, e);
@@ -79,17 +79,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     // Test 3: If the anonymous tree in which context node is in is modified,
     //         XPath result should throw when iterateNext() is called.
     resultAttr = null;
     try {
       var xp3 = xp.evaluate(".",
                             anonAttr1,
                             null,
-                            Components.interfaces.nsIDOMXPathResult.
+                            SpecialPowers.Ci.nsIDOMXPathResult.
                               UNORDERED_NODE_ITERATOR_TYPE,
                             null);
       // Attribute changing in the same anonymous tree.
       anonAttr1.ownerElement.setAttribute("foo", "bar");
       resultAttr = xp3.iterateNext();
       ok(resultAttr == anonAttr1,
          "XPathEvaluator should have thrown an exception!")
     } catch (e) {
--- a/docshell/test/navigation/NavigationUtils.js
+++ b/docshell/test/navigation/NavigationUtils.js
@@ -94,18 +94,18 @@ function isInaccessible(wnd, message) {
 }
 
 ///////////////////////////////////////////////////////////////////////////
 // Functions that require UniversalXPConnect privilege
 ///////////////////////////////////////////////////////////////////////////
 
 function xpcEnumerateContentWindows(callback) {
 
-  var Ci = Components.interfaces;
-  var ww = SpecialPowers.wrap(Components)
+  var Ci = SpecialPowers.Ci;
+  var ww = SpecialPowers.wrap(SpecialPowers.Components)
                         .classes["@mozilla.org/embedcomp/window-watcher;1"]
                         .getService(Ci.nsIWindowWatcher);
   var enumerator = ww.getWindowEnumerator();
 
   var contentWindows = [];
 
   while (enumerator.hasMoreElements()) {
     var win = enumerator.getNext();
--- a/docshell/test/test_bug369814.html
+++ b/docshell/test/test_bug369814.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 SimpleTest.waitForExplicitFinish();
 
 // Because child scripts won't be able to run to tell us they're done,
 // we need to just wait for them.  Wait this many event loop spins before
 // checking the results.
 const gLoadEventLoopCount = 100;
 
-var Ci = Components.interfaces;
+var Ci = SpecialPowers.Ci;
 
 var gCurrentTest;
 var gTargetWindow;
 var gNumPokes;
 var gPrefValue;
 
 var gTestFrame;
 
@@ -181,18 +181,18 @@ var gTests = [
     "func" : loadErrorTest
   },
 ];
 
 var gNextTest = 0;
 
 function runNextTest()
 {
-  var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                           .getService(Components.interfaces.nsIPrefBranch);
+  var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                           .getService(SpecialPowers.Ci.nsIPrefBranch);
 
   if (gNextTest < gTests.length) {
     gCurrentTest = gTests[gNextTest++];
     gNumPokes = 0;
 
     prefs.setBoolPref("network.jar.open-unsafe-types", gCurrentTest['pref']);
 
     // Create a new frame each time, so our restictions on loads in a
@@ -208,31 +208,31 @@ function runNextTest()
     // Put back the pref value we had at test start
     prefs.setBoolPref("network.jar.open-unsafe-types", gPrefValue);
     SimpleTest.finish();
   }
 }
 
 function finishTest()
 {
-    var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                             .getService(Components.interfaces.nsIPrefBranch);
+    var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                             .getService(SpecialPowers.Ci.nsIPrefBranch);
     prefs.setBoolPref("network.jar.open-unsafe-types", false);
 
   if (gNumPokes == 0) {
     ok(true, gCurrentTest["name"] + ": no unexpected pokes");
   }
 
   runNextTest();
 }
 
 function startTests()
 {
-  var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                           .getService(Components.interfaces.nsIPrefBranch);
+  var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                           .getService(SpecialPowers.Ci.nsIPrefBranch);
   gPrefValue = prefs.getBoolPref("network.jar.open-unsafe-types");
 }
 
 addLoadEvent(runNextTest);
 
 </script>
 </pre>
 </body>
--- a/docshell/test/test_bug509055.html
+++ b/docshell/test/test_bug509055.html
@@ -66,18 +66,18 @@ function runTest() {
   popup.document.title = "Changed";
 
   // Wait for listeners to be notified of the title change.
   shortWait();
   dump('Got second hashchange.  Spinning event loop.\n');
   yield;
 
   var sh = SpecialPowers.wrap(popup)
-                        .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                        .getInterface(Components.interfaces.nsIWebNavigation)
+                        .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+                        .getInterface(SpecialPowers.Ci.nsIWebNavigation)
                         .sessionHistory;
 
   // Get the title of the inner popup's current SHEntry 
   var sheTitle = sh.getEntryAtIndex(sh.index, false).title;
   is(sheTitle, "Changed", "SHEntry's title should change when we change.");
 
   popup.close();
 
--- a/dom/alarm/test/test_alarm_permitted_app.html
+++ b/dom/alarm/test/test_alarm_permitted_app.html
@@ -19,17 +19,17 @@ SpecialPowers.pushPrefEnv({"set": [["dom
   SpecialPowers.addPermission("alarms", true, document);
 
   // mozAlarms is intalled on all platforms except Android for the moment.
   if (navigator.appVersion.indexOf("Android") != -1) {
     ok(!('mozAlarms' in navigator), "navigator.mozAlarms should not exist");
   } else {
     ok('mozAlarms' in navigator, "navigator.mozAlarms should exist");
     ok(navigator.mozAlarms, "navigator.mozAlarms should return an object");
-    ok(navigator.mozAlarms instanceof Components.interfaces.nsIDOMMozAlarmsManager,
+    ok(navigator.mozAlarms instanceof SpecialPowers.Ci.nsIDOMMozAlarmsManager,
       "navigator.mozAlarms should be an nsIDOMMozAlarmsManager object");
   }
 
   SpecialPowers.removePermission("alarms", document);
   SimpleTest.finish();
 });
 
 </script>
--- a/dom/browser-element/mochitest/browserElement_Auth.js
+++ b/dom/browser-element/mochitest/browserElement_Auth.js
@@ -76,20 +76,20 @@ function testHttpAuth(e) {
 
   SimpleTest.executeSoon(function() {
     e.detail.authenticate("httpuser", "httppass");
   });
 }
 
 function testFinish() {
   // Clear login information stored in password manager.
-  var authMgr = SpecialPowers.wrap(Components).classes['@mozilla.org/network/http-auth-manager;1']
-    .getService(Components.interfaces.nsIHttpAuthManager);
+  var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
+    .getService(SpecialPowers.Ci.nsIHttpAuthManager);
   authMgr.clearAll();
 
-  var pwmgr = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager;1"]
-    .getService(Components.interfaces.nsILoginManager);
+  var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
+    .getService(SpecialPowers.Ci.nsILoginManager);
   pwmgr.removeAllLogins();
 
   SimpleTest.finish();
 }
 
 runTest();
--- a/dom/browser-element/mochitest/browserElement_KeyEvents.js
+++ b/dom/browser-element/mochitest/browserElement_KeyEvents.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the public domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that an iframe with the |mozbrowser| attribute does bubble some
 // whitelisted key events.
 "use strict";
 
-let Ci = Components.interfaces;
+let Ci = SpecialPowers.Ci;
 
 let whitelistedEvents = [
   Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE,   // Back button.
   Ci.nsIDOMKeyEvent.DOM_VK_SLEEP,    // Power button
   Ci.nsIDOMKeyEvent.DOM_VK_CONTEXT_MENU,
   Ci.nsIDOMKeyEvent.DOM_VK_F5,       // Search button.
   Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP,  // Volume up.
   Ci.nsIDOMKeyEvent.DOM_VK_PAGE_DOWN // Volume down.
--- a/dom/browser-element/mochitest/file_focus.html
+++ b/dom/browser-element/mochitest/file_focus.html
@@ -8,17 +8,17 @@ document.getElementById('url').innerHTML
 
 <script>
   // The input element is getting synthesized key events and will prevent
   // default on the first ESC keydown event.
 
   var alreadyBlocked = false;
 
   addEventListener('keydown', function(e) {
-    if (e.keyCode == Components.interfaces.nsIDOMKeyEvent.DOM_VK_ESCAPE &&
+    if (e.keyCode == SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE &&
         alreadyBlocked == false) {
       alreadyBlocked = true;
       e.preventDefault();
     }
   });
 </script>
 </body>
 </html>
--- a/dom/contacts/tests/test_contacts_basics.html
+++ b/dom/contacts/tests/test_contacts_basics.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
-var comp = SpecialPowers.wrap(Components);
+var comp = SpecialPowers.wrap(SpecialPowers.Components);
 comp.utils.import("resource://gre/modules/ContactService.jsm");
 comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
 SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
 SpecialPowers.addPermission("contacts", true, document);
 
 // For Sorting
 var c1 = {
   name: "a",
--- a/dom/contacts/tests/test_contacts_blobs.html
+++ b/dom/contacts/tests/test_contacts_blobs.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
-var comp = SpecialPowers.wrap(Components);
+var comp = SpecialPowers.wrap(SpecialPowers.Components);
 comp.utils.import("resource://gre/modules/ContactService.jsm");
 comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
 SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
 SpecialPowers.addPermission("contacts", true, document);
 
 var utils = SpecialPowers.getDOMWindowUtils(window);
 
 function getView(size)
@@ -101,20 +101,20 @@ function onUnwantedSuccess() {
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
 
 function verifyBlob(blob1, blob2, isLast)
 {
   dump("islast? " + isLast + "\n");
-  is(blob1 instanceof Components.interfaces.nsIDOMBlob, true,
+  is(blob1 instanceof SpecialPowers.Ci.nsIDOMBlob, true,
      "Instance of nsIDOMBlob");
-  is(blob1 instanceof Components.interfaces.nsIDOMFile,
-     blob2 instanceof Components.interfaces.nsIDOMFile,
+  is(blob1 instanceof SpecialPowers.Ci.nsIDOMFile,
+     blob2 instanceof SpecialPowers.Ci.nsIDOMFile,
      "Instance of nsIDOMFile");
   is(blob1.size, blob2.size, "Correct size");
   is(blob1.type, blob2.type, "Correct type");
 
   var buffer1;
   var buffer2;
 
   var reader1 = new FileReader();
--- a/dom/devicestorage/ipc/test_ipc.html
+++ b/dom/devicestorage/ipc/test_ipc.html
@@ -65,17 +65,17 @@
           case "TEST-DEBUG-INFO":
           default:
             info(details);
         }
       }
     }
 
     function onTestComplete() {
-      let comp = SpecialPowers.wrap(Components);
+      let comp = SpecialPowers.wrap(SpecialPowers.Components);
       let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
       let spObserver = comp.classes["@mozilla.org/special-powers-observer;1"]
                             .getService(comp.interfaces.nsIMessageListener);
 
       mm.removeMessageListener("SPPrefService", spObserver);
       mm.removeMessageListener("SPProcessCrashService", spObserver);
       mm.removeMessageListener("SPPingService", spObserver);
       mm.removeMessageListener("SpecialPowers.Quit", spObserver);
@@ -104,17 +104,17 @@
 
       function iframeLoadFirst() {
         ok(true, "Got first iframe load event.");
         iframe.removeEventListener("mozbrowserloadend", iframeLoadFirst);
         iframe.addEventListener("mozbrowserloadend", iframeLoadSecond);
 
         let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
-        let comp = SpecialPowers.wrap(Components);
+        let comp = SpecialPowers.wrap(SpecialPowers.Components);
 
         let spObserver =
           comp.classes["@mozilla.org/special-powers-observer;1"]
               .getService(comp.interfaces.nsIMessageListener);
 
         mm.addMessageListener("SPPrefService", spObserver);
         mm.addMessageListener("SPProcessCrashService", spObserver);
         mm.addMessageListener("SPPingService", spObserver);
--- a/dom/devicestorage/test/devicestorage_common.js
+++ b/dom/devicestorage/test/devicestorage_common.js
@@ -11,18 +11,18 @@ Array.prototype.remove = function(from, 
   this.length = from < 0 ? this.length + from : from;
   return this.push.apply(this, rest);
 };
 
 function devicestorage_setup() {
 
   // ensure that the directory we are writing into is empty
   try {
-    const Cc = SpecialPowers.wrap(Components).classes;
-    const Ci = Components.interfaces;
+    const Cc = SpecialPowers.Cc;
+    const Ci = SpecialPowers.Ci;
     var directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
     var f = directoryService.get("TmpD", Ci.nsIFile);
     f.appendRelativePath("device-storage-testing");
     f.remove(true);
   } catch(e) {}
 
   SimpleTest.waitForExplicitFinish();
   if (SpecialPowers.isMainProcess()) {
--- a/dom/devicestorage/test/test_lastModificationFilter.html
+++ b/dom/devicestorage/test/test_lastModificationFilter.html
@@ -46,18 +46,18 @@ function verifyAndDelete(prefix, files, 
   // clean up
   var storage = navigator.getDeviceStorage("pictures");
   var cleanup = storage.delete(prefix + "/" + filename);
   cleanup.onsuccess = function(e) {}
 }
 
 function addFiles(prefix, files, date, callback) {
 
-  const Cc = SpecialPowers.wrap(Components).classes;
-  const Ci = Components.interfaces;
+  const Cc = SpecialPowers.Cc;
+  const Ci = SpecialPowers.Ci;
 
   var directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
 
   for (var i=0; i<files.length; i++) {
 
     var f = directoryService.get("TmpD", Ci.nsIFile);
     f.appendRelativePath("device-storage-testing");
 
--- a/dom/file/test/test_archivereader.html
+++ b/dom/file/test/test_archivereader.html
@@ -6,18 +6,18 @@
 <head>
   <title>Archive Reader Test</title>
 
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script type="text/javascript;version=1.7">
   function createZipFileWithData(fileData) {
-    var Cc = SpecialPowers.wrap(Components).classes;
-    var Ci = SpecialPowers.wrap(Components).interfaces;
+    var Cc = SpecialPowers.Cc;
+    var Ci = SpecialPowers.Ci;
 
     var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
     var testFile = dirSvc.get("ProfD", Ci.nsIFile);
     testFile.append("fileArchiveReader.zip");
     var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
     outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
                    0666, 0);
     outStream.write(fileData, fileData.length);
@@ -25,18 +25,18 @@
 
     var fileList = document.getElementById('fileList');
     SpecialPowers.wrap(fileList).value = testFile.path;
 
     return fileList.files[0];
   }
 
   function createTextFileWithData(fileData) {
-    var Cc = SpecialPowers.wrap(Components).classes;
-    var Ci = SpecialPowers.wrap(Components).interfaces;
+    var Cc = SpecialPowers.Cc;
+    var Ci = SpecialPowers.Ci;
 
     var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
     var testFile = dirSvc.get("ProfD", Ci.nsIFile);
     testFile.append("fileArchiveReader.txt");
     var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
     outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
                    0666, 0);
     outStream.write(fileData, fileData.length);
--- a/dom/file/test/test_archivereader_zip_in_zip.html
+++ b/dom/file/test/test_archivereader_zip_in_zip.html
@@ -6,18 +6,18 @@
 <head>
   <title>Archive Reader Zip-In-Zip Test</title>
 
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script type="text/javascript;version=1.7">
   function createZipInZipData() {
-    var Cc = SpecialPowers.wrap(Components).classes;
-    var Ci = SpecialPowers.wrap(Components).interfaces;
+    var Cc = SpecialPowers.Cc;
+    var Ci = SpecialPowers.Ci;
 
     var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
     var testFile = dirSvc.get("ProfD", Ci.nsIFile);
     testFile.append("fileArchiveReader_42.zip");
     var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
     outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
                    0666, 0);
 
--- a/dom/file/test/test_lockedfile_lifetimes_nested.html
+++ b/dom/file/test/test_lockedfile_lifetimes_nested.html
@@ -20,28 +20,28 @@
 
       let fileHandle = event.target.result;
       fileHandle.onerror = errorHandler;
 
       let lockedFile = fileHandle.open();
 
       let lockedFile2;
 
-      let comp = SpecialPowers.wrap(Components);
+      let comp = SpecialPowers.wrap(SpecialPowers.Components);
       let thread = comp.classes["@mozilla.org/thread-manager;1"]
                        .getService(comp.interfaces.nsIThreadManager)
                        .currentThread;
 
       let eventHasRun;
 
       thread.dispatch(function() {
         eventHasRun = true;
 
         lockedFile2 = fileHandle.open();
-      }, Components.interfaces.nsIThread.DISPATCH_NORMAL);
+      }, SpecialPowers.Ci.nsIThread.DISPATCH_NORMAL);
 
       while (!eventHasRun) {
         thread.processNextEvent(false);
       }
 
       ok(lockedFile2, "Non-null lockedFile2");
 
       continueToNextStep();
--- a/dom/file/test/test_success_events_after_abort.html
+++ b/dom/file/test/test_success_events_after_abort.html
@@ -39,17 +39,17 @@
       lockedFile.abort();
 
       event = yield;
 
       is(event.type, "abort", "Got abort event");
       is(sawError, true, "Saw getMetadata() error");
 
       // Make sure the success event isn't queued somehow.
-      let comp = SpecialPowers.wrap(Components);
+      let comp = SpecialPowers.wrap(SpecialPowers.Components);
       var thread = comp.classes["@mozilla.org/thread-manager;1"]
                        .getService(comp.interfaces.nsIThreadManager)
                        .currentThread;
       while (thread.hasPendingEvents()) {
         thread.processNextEvent(false);
       }
     }
 
--- a/dom/identity/tests/head_identity.js
+++ b/dom/identity/tests/head_identity.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const Ci = Components.interfaces;
-const Cu = SpecialPowers.wrap(Components).utils;
+const Ci = SpecialPowers.Ci;
+const Cu = SpecialPowers.Cu;
 
 SpecialPowers.setBoolPref("toolkit.identity.debug", true);
 SpecialPowers.setBoolPref("dom.identity.enabled", true);
 
 const Services = Cu.import("resource://gre/modules/Services.jsm").Services;
 const DOMIdentity = Cu.import("resource://gre/modules/DOMIdentity.jsm")
                       .DOMIdentity;
 
--- a/dom/indexedDB/ipc/test_ipc.html
+++ b/dom/indexedDB/ipc/test_ipc.html
@@ -123,17 +123,17 @@
 
       function iframeLoadFirst() {
         ok(true, "Got first iframe load event.");
         iframe.removeEventListener("mozbrowserloadend", iframeLoadFirst);
         iframe.addEventListener("mozbrowserloadend", iframeLoadSecond);
 
         let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
-        let comp = SpecialPowers.wrap(Components);
+        let comp = SpecialPowers.wrap(SpecialPowers.Components);
 
         let spObserver =
           comp.classes["@mozilla.org/special-powers-observer;1"]
               .getService(comp.interfaces.nsIMessageListener);
 
         mm.addMessageListener("SPPrefService", spObserver);
         mm.addMessageListener("SPProcessCrashService", spObserver);
         mm.addMessageListener("SPPingService", spObserver);
--- a/dom/settings/tests/test_settings_basics.html
+++ b/dom/settings/tests/test_settings_basics.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
-var comp = SpecialPowers.wrap(Components);
+var comp = SpecialPowers.wrap(SpecialPowers.Components);
 comp.utils.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
 SpecialPowers.addPermission("settings", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
--- a/dom/tests/mochitest/ajax/offline/foreign2.html
+++ b/dom/tests/mochitest/ajax/offline/foreign2.html
@@ -5,18 +5,18 @@
 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script class="testbody" type="text/javascript">
 
 function manifestUpdated()
 {
-  var appCacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]
-    .getService(Components.interfaces.nsIApplicationCacheService);
+  var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"]
+    .getService(SpecialPowers.Ci.nsIApplicationCacheService);
 
   var foreign2cache = appCacheService.chooseApplicationCache(
     "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
 
   OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html");
   OfflineTest.is(foreign2cache.groupID, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest")
 
   var foreign1cache = appCacheService.getActiveCache(
@@ -25,34 +25,34 @@ function manifestUpdated()
   foreign1cache.discard();
 
   OfflineTest.teardown();
   OfflineTest.finish();
 }
 
 function onLoaded()
 {
-  var appCacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]
-    .getService(Components.interfaces.nsIApplicationCacheService);
+  var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"]
+    .getService(SpecialPowers.Ci.nsIApplicationCacheService);
 
   var foreign1cache = appCacheService.getActiveCache(
     "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest");
   OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded");
 
   var foreign2cache = appCacheService.getActiveCache(
     "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest");
   OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present");
 
   foreign1cache = appCacheService.chooseApplicationCache(
     "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
   OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache");
 
   try
   {
-    OfflineTest.ok(applicationCache.status == Components.interfaces.nsIDOMOfflineResourceList.UNCACHED,
+    OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED,
         "there is no associated application cache");
   }
   catch (ex)
   {
     OfflineTest.ok(false, "applicationCache.status must not throw an exception");
   }
 }
 
--- a/dom/tests/mochitest/ajax/offline/obsolete.html
+++ b/dom/tests/mochitest/ajax/offline/obsolete.html
@@ -45,17 +45,17 @@ applicationCache.oncached = function() {
   applicationCache.onnoupdate = fail;
   applicationCache.onerror = fail;
   applicationCache.onobsolete = obsolete;
 
   // Make the obsoleting.sjs return 404 NOT FOUND code
   var req = new XMLHttpRequest();
   req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state=");
   var channel = SpecialPowers.wrap(req).channel
-    .QueryInterface(Components.interfaces.nsIApplicationCacheChannel);
+    .QueryInterface(SpecialPowers.Ci.nsIApplicationCacheChannel);
   channel.chooseApplicationCache = false;
   channel.inheritApplicationCache = false;
   req.send("");
   req.onreadystatechange = function() {
     if (req.readyState == 4) {
       applicationCache.update();
     }
   }
--- a/dom/tests/mochitest/ajax/offline/test_foreign.html
+++ b/dom/tests/mochitest/ajax/offline/test_foreign.html
@@ -16,18 +16,18 @@
  * On load of foreign2.html we check there is no associated cache
  * because the foreign2.html page was marked as FOREIGN in foreign1 cache.
  * After the foreign2 manifest is updated we check foreign2 cache is
  * chosen by foreign.html page.
  */
 
 function manifestUpdated()
 {
-  var appCacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]
-    .getService(Components.interfaces.nsIApplicationCacheService);
+  var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"]
+    .getService(SpecialPowers.Ci.nsIApplicationCacheService);
 
   foreign1cache = appCacheService.chooseApplicationCache(
     "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
 
   OfflineTest.ok(foreign1cache, "foreign2.html chosen from foreign1 cache");
   OfflineTest.is(foreign1cache.groupID, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest")
 
   window.location = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html";
--- a/dom/tests/mochitest/ajax/offline/test_updatingManifest.html
+++ b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html
@@ -12,18 +12,18 @@
  * This test loads manifest and checks presence of all items.
  * Then it modifies the manifest and updates the cache again.
  * Then test presence of items according to the spec and also
  * if the cache associated with the document is still the old
  * one. Then again modifies the manifest, checks items and finally
  * swaps cache for this document, reloads and checks document state.
  */
 
-const NAMESPACE_BYPASS = Components.interfaces.nsIApplicationCacheNamespace.NAMESPACE_BYPASS;
-const NAMESPACE_FALLBACK = Components.interfaces.nsIApplicationCacheNamespace.NAMESPACE_FALLBACK;
+const NAMESPACE_BYPASS = SpecialPowers.Ci.nsIApplicationCacheNamespace.NAMESPACE_BYPASS;
+const NAMESPACE_FALLBACK = SpecialPowers.Ci.nsIApplicationCacheNamespace.NAMESPACE_FALLBACK;
 
 var gStep = 0;
 var gGotFrameVersion = 0;
 var gCallOnUpdatingFrameLoad = null;
 
 // Helpers
 
 function reloadLocations(frames)
@@ -148,17 +148,17 @@ function implicitCached()
 
   // Fallback URI selection check
   checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
       "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
   checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
       "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
 
   // Cache object status
-  OfflineTest.is(applicationCache.status, Components.interfaces.nsIDOMOfflineResourceList.IDLE,
+  OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.IDLE,
       "we have associated application cache (1)");
 
   OfflineTest.is(gGotFrameVersion, 1, "IFrame version 1");
 
   var entries = [
     // Explicit entries
     ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
     ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
@@ -202,17 +202,17 @@ function manifestUpdated()
 
     // Fallback URI selection check
     checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
         "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback.html", false);
     checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
         "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
 
     // Cache object status
-    OfflineTest.is(applicationCache.status, Components.interfaces.nsIDOMOfflineResourceList.UPDATEREADY,
+    OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
         "we have associated application cache and update is pending (2)");
 
     var entries = [
       // Explicit entries
       ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true],
       ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
 
       // Fallback entries
@@ -251,17 +251,17 @@ function manifestUpdated()
 
     // Fallback URI selection check
     checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/opp.html",
         "", false);
     checkFallbackAndWhitelisting("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/opp.html",
         "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/fallback2.html", false);
 
     // Cache object status
-    OfflineTest.is(applicationCache.status, Components.interfaces.nsIDOMOfflineResourceList.UPDATEREADY,
+    OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
         "we have associated application cache and update is pending (3)");
 
     OfflineTest.is(gGotFrameVersion, 1, "IFrame version 1 because cache was not swapped");
 
     var entries = [
       // Explicit entries
       ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
       ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true],
@@ -294,20 +294,20 @@ function manifestUpdated()
 }
 
 function manifestNoUpdate()
 {
   applicationCache.onnoupdate = null;
 
   OfflineTest.ok(gStep == 3);
 
-  OfflineTest.is(applicationCache.status, Components.interfaces.nsIDOMOfflineResourceList.UPDATEREADY,
+  OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.UPDATEREADY,
         "we have associated application cache and update is pending (4)");
   applicationCache.swapCache();
-  OfflineTest.is(applicationCache.status, Components.interfaces.nsIDOMOfflineResourceList.IDLE,
+  OfflineTest.is(applicationCache.status, SpecialPowers.Ci.nsIDOMOfflineResourceList.IDLE,
         "we have associated application cache (4)");
 
   gGotFrameVersion = 0;
   gCallOnUpdatingFrameLoad = checkNewVersionOfIFrame;
   updatingFrame.location.reload();
 }
 
 function checkNewVersionOfIFrame()
--- a/dom/tests/mochitest/bugs/test_bug317448.html
+++ b/dom/tests/mochitest/bugs/test_bug317448.html
@@ -16,22 +16,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 317448 **/
 var x = new XMLHttpRequest();
 x.open("GET", document.location.href);
 x.send("");
-is(x instanceof Components.interfaces.nsIInterfaceRequestor,
+is(x instanceof SpecialPowers.Ci.nsIInterfaceRequestor,
    true, "Must be interface requestor");
 
 var count = {};
 var interfaces = SpecialPowers.wrap(x).
-                 QueryInterface(Components.interfaces.nsIClassInfo).
+                 QueryInterface(SpecialPowers.Ci.nsIClassInfo).
                  getInterfaces(count).
                  map(function(id) {
                             id = SpecialPowers.wrap(id);
                             return SpecialPowers.wrap(SpecialPowers.Components).interfacesByID[id].toString();
                      });
 isnot(interfaces.indexOf("nsIInterfaceRequestor"), "-1",
       "Must have interface requestor classinfo");
 </script>
--- a/dom/tests/mochitest/bugs/test_bug369306.html
+++ b/dom/tests/mochitest/bugs/test_bug369306.html
@@ -111,37 +111,37 @@ function test5()
       }, w, true);
 
       w.focus();
     }, originatingWindow);
 
     SimpleTest.executeSoon(function() {
       // We have to focus back the originating window but we can't do that with
       // .focus() or .blur() anymore.
-      var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"]
-                            .getService(Components.interfaces.nsIFocusManager);
+      var fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"]
+                            .getService(SpecialPowers.Ci.nsIFocusManager);
       fm.focusedWindow = window;
     });
   }, w, true);
 }
 
 function finished()
 {
-  SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-               .getService(Components.interfaces.nsIPrefBranch)
+  SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+               .getService(SpecialPowers.Ci.nsIPrefBranch)
                .setBoolPref("dom.disable_window_flip", gOldPrefValue);
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 
 // dom.disable_window_flip has to be set to true for this test.
-var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                         .getService(Components.interfaces.nsIPrefBranch);
+var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                         .getService(SpecialPowers.Ci.nsIPrefBranch);
 gOldPrefValue = prefs.getBoolPref("dom.disable_window_flip");
 prefs.setBoolPref("dom.disable_window_flip", true);
 
 // test1 is going to call the next tests.
 SimpleTest.waitForFocus(test1);
 
 </script>
 </pre>
--- a/dom/tests/mochitest/bugs/test_bug534149.html
+++ b/dom/tests/mochitest/bugs/test_bug534149.html
@@ -40,39 +40,39 @@ is(i1inner, i1outer + 1, "For frame 1, i
 is(i2inner, i2outer + 1, "For frame 2, inner should come right after outer");
 is(i2outer, i1inner + 1, "Frame 2 comes right after frame 1");
 
 var innerWindowDestroyID;
 var outerWindowDestroyID;
 
 function outerObserver(id) {
   outerWindowDestroyID =
-    SpecialPowers.wrap(id).QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
+    SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
 }
 function innerObserver(id) {
   innerWindowDestroyID =
-   SpecialPowers.wrap(id).QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
+   SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
 }
 
 function removeFrame(iframe) {
-  var obsSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
-                         .getService(Components.interfaces.nsIObserverService);
+  var obsSvc = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
+                         .getService(SpecialPowers.Ci.nsIObserverService);
   obsSvc.addObserver(outerObserver, "outer-window-destroyed", false);
   obsSvc.addObserver(innerObserver, "inner-window-destroyed", false);
 
   iframe.parentNode.removeChild(iframe);
 }
 
 removeFrame(i1);
 SimpleTest.waitForExplicitFinish();
 SimpleTest.executeSoon(function() {
   is(innerWindowDestroyID, i1inner, "inner window of frame 1 should be destroyed");
   is(outerWindowDestroyID, i1outer, "outer window of frame 1 should be destroyed");
-  var obsSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
-                         .getService(Components.interfaces.nsIObserverService);
+  var obsSvc = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
+                         .getService(SpecialPowers.Ci.nsIObserverService);
   obsSvc.removeObserver(outerObserver, "outer-window-destroyed");
   obsSvc.removeObserver(innerObserver, "inner-window-destroyed");
   SimpleTest.finish();
 });
   
 
 </script>
 </pre>
--- a/dom/tests/mochitest/bugs/utils_bug260264.js
+++ b/dom/tests/mochitest/bugs/utils_bug260264.js
@@ -47,22 +47,22 @@ function alter_host(uri, host) {
 function alter_file(uri, file) {
   return _alter_helper(uri, function(splat) {
     splat[splat.length - 1] = file;
   });
 }
 
 (function() {
 
-  var prefService = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefService),
-      pm = SpecialPowers.wrap(Components).classes["@mozilla.org/permissionmanager;1"]
-                     .getService(Components.interfaces.nsIPermissionManager),
-      ioService = SpecialPowers.wrap(Components).classes["@mozilla.org/network/io-service;1"]
-                            .getService(Components.interfaces.nsIIOService);
+  var prefService = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                              .getService(SpecialPowers.Ci.nsIPrefService),
+      pm = SpecialPowers.Cc["@mozilla.org/permissionmanager;1"]
+                     .getService(SpecialPowers.Ci.nsIPermissionManager),
+      ioService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+                            .getService(SpecialPowers.Ci.nsIIOService);
 
   ALLOW_ACTION = pm.ALLOW_ACTION;
   DENY_ACTION = pm.DENY_ACTION;
   UNKNOWN_ACTION = pm.UNKNOWN_ACTION;
 
   /**
    * This ridiculously over-engineered function makes an accessor function from
    * any given preference string.  Such accessors may be passed as the first
@@ -93,18 +93,18 @@ function alter_file(uri, file) {
       if (arguments.length > 0)
         branch['set' + kind](basePref, value);
       return oldValue;
     };
   };
 
   makePopupPrivAccessor = function(uri) {
     uri = ioService.newURI(uri, null, null);
-    var principal = SpecialPowers.wrap(Components).classes["@mozilla.org/scriptsecuritymanager;1"]
-                      .getService(Components.interfaces.nsIScriptSecurityManager)
+    var principal = SpecialPowers.Cc["@mozilla.org/scriptsecuritymanager;1"]
+                      .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
                       .getNoAppCodebasePrincipal(uri);
 
     return function(permission) {
       var old = pm.testPermissionFromPrincipal(principal, "popup");
       if (arguments.length) {
         pm.removeFromPrincipal(principal, "popup");
         pm.addFromPrincipal(principal, "popup", permission);
       }
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -532,17 +532,17 @@ var interfaceNamesInGlobalScope =
     "MozMobileCellInfo",
     "MozCanvasPrintState",
     "TCPSocket",
     "MozTimeManager",
     "MozNavigatorTime",
     "PermissionSettings"
   ]
 
-for (var i in Components.interfaces) {
+for (var i in SpecialPowers.Components.interfaces) {
   var s = i.toString();
   var name = null;
   if (s.indexOf("nsIDOM") == 0) {
     name = s.substring("nsIDOM".length);
   } else if (s.indexOf("nsI") == 0) {
     name = s.substring("nsI".length);
   } 
   if (name && (name in window)) {
--- a/dom/tests/mochitest/geolocation/test_mozsettings.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettings.html
@@ -32,17 +32,17 @@ function toggleGeolocationSetting(value,
   }
 }
 
 SimpleTest.waitForExplicitFinish();
 resume_geolocationProvider();
 force_prompt(true);
 
 
-var comp = SpecialPowers.wrap(Components);
+var comp = SpecialPowers.wrap(SpecialPowers.Components);
 SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
 SpecialPowers.addPermission("settings", true, document);
 comp.utils.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 
 toggleGeolocationSetting(false, function() {
     ok(true, "turned off geolocation via mozSettings");
     setTimeout(function() {
 	navigator.geolocation.getCurrentPosition(successCallbackAfterMozsetting, failureCallbackAfterMozsetting);
--- a/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
@@ -32,17 +32,17 @@ function toggleGeolocationSetting(value,
   }
 }
 
 SimpleTest.waitForExplicitFinish();
 resume_geolocationProvider();
 force_prompt(true);
 
 
-var comp = SpecialPowers.wrap(Components);
+var comp = SpecialPowers.wrap(SpecialPowers.Components);
 SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
 SpecialPowers.addPermission("settings", true, document);
 comp.utils.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 
 toggleGeolocationSetting(false, function() {
     ok(true, "turned off geolocation via mozSettings");
     setTimeout(function() {
 	navigator.geolocation.watchPosition(successCallbackAfterMozsetting, failureCallbackAfterMozsetting);
--- a/dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html
+++ b/dom/tests/mochitest/localstorage/frameQuotaSessionOnly.html
@@ -1,17 +1,17 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>slave for sessionStorage test</title>
 
 <script type="text/javascript" src="interOriginFrame.js"></script>
 <script type="text/javascript">
 
 const DOM_QUOTA_REACHED = 2152924150;
-const Cc = SpecialPowers.wrap(Components).classes;
+const Cc = SpecialPowers.Cc;
 
 function checkException(func, exc)
 {
   var exceptionThrew = false;
   try {
     func();
   }
   catch (ex) {
@@ -19,22 +19,22 @@ function checkException(func, exc)
     is(ex.result, exc, "Expected "+exc+" exception");
   }
   ok(exceptionThrew, "Exception "+exc+" threw at "+location);
 }
 
 function doStep()
 {
   var io = Cc["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
+    .getService(SpecialPowers.Ci.nsIIOService);
   var uri = io.newURI(window.location, "", null);
   var cp = Cc["@mozilla.org/cookie/permission;1"]
-    .getService(Components.interfaces.nsICookiePermission);
+    .getService(SpecialPowers.Ci.nsICookiePermission);
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
 
   var query = location.search.substring(1);
   var queries = query.split("&");
 
   var operation = queries[0];
   var keyName = queries[1];
   var result = queries[2];
 
@@ -90,17 +90,17 @@ function doStep()
       break;
 
     case "":
     default:
       switch (operation)
       {
         case "clear":
           localStorage.clear();
-          cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+          cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
 
           break;
       }
 
       break;
   }
 
   // Just inform the master we are finished now
--- a/dom/tests/mochitest/localstorage/pbSwitch.js
+++ b/dom/tests/mochitest/localstorage/pbSwitch.js
@@ -1,40 +1,40 @@
 var _PBSvc = null;
 
 function get_PBSvc()
 {
   if (_PBSvc)
     return _PBSvc;
 
   try {
-    _PBSvc = Components.classes["@mozilla.org/privatebrowsing;1"].
-             getService(Components.interfaces.nsIPrivateBrowsingService);
+    _PBSvc = SpecialPowers.Components.classes["@mozilla.org/privatebrowsing;1"].
+             getService(SpecialPowers.Ci.nsIPrivateBrowsingService);
     return _PBSvc;
   }
   catch (ex) {
   }
 
   return null;
 }
 
 function enterPrivateBrowsing()
 {
   if (get_PBSvc()) {
-    var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].
-                     getService(Components.interfaces.nsIPrefBranch);
+    var prefBranch = SpecialPowers.Components.classes["@mozilla.org/preferences-service;1"].
+                     getService(SpecialPowers.Ci.nsIPrefBranch);
     prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
 
     get_PBSvc().privateBrowsingEnabled = true;
   }
 }
 
 function leavePrivateBrowsing()
 {
   if (get_PBSvc()) {
     get_PBSvc().privateBrowsingEnabled = false;
 
-    var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].
-                     getService(Components.interfaces.nsIPrefBranch);
+    var prefBranch = SpecialPowers.Components.classes["@mozilla.org/preferences-service;1"].
+                     getService(SpecialPowers.Ci.nsIPrefBranch);
     if (prefBranch.prefHasUserValue("browser.privatebrowsing.keep_current_session"))
       prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
   }
 }
--- a/dom/tests/mochitest/localstorage/test_cookieBlock.html
+++ b/dom/tests/mochitest/localstorage/test_cookieBlock.html
@@ -4,23 +4,23 @@
 
 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
 function startTest()
 {
-  var io = SpecialPowers.wrap(Components).classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
+  var io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+    .getService(SpecialPowers.Ci.nsIIOService);
   var uri = io.newURI(window.location, "", null);
-  var cp = SpecialPowers.wrap(Components).classes["@mozilla.org/cookie/permission;1"]
-    .getService(Components.interfaces.nsICookiePermission);
+  var cp = SpecialPowers.Cc["@mozilla.org/cookie/permission;1"]
+    .getService(SpecialPowers.Ci.nsICookiePermission);
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DENY);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DENY);
 
   try {
     localStorage.setItem("blocked", "blockedvalue");
     ok(false, "Exception for localStorage.setItem, ACCESS_DENY");
   }
   catch (ex) {
     ok(true, "Exception for localStorage.setItem, ACCESS_DENY");
   }
@@ -28,17 +28,17 @@ function startTest()
   try {
     localStorage.getItem("blocked");
     ok(false, "Exception for localStorage.getItem, ACCESS_DENY");
   }
   catch (ex) {
     ok(true, "Exception for localStorage.getItem, ACCESS_DENY");
   }
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 
--- a/dom/tests/mochitest/localstorage/test_cookieSession-phase1.html
+++ b/dom/tests/mochitest/localstorage/test_cookieSession-phase1.html
@@ -14,22 +14,22 @@
   storage.
  */
 
 function startTest()
 {
   localStorage.setItem("persistent1", "persistent value 1");
   localStorage.setItem("persistent2", "persistent value 2");
 
-  var io = SpecialPowers.wrap(Components).classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
+  var io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+    .getService(SpecialPowers.Ci.nsIIOService);
   var uri = io.newURI(window.location, "", null);
-  var cp = SpecialPowers.wrap(Components).classes["@mozilla.org/cookie/permission;1"]
-    .getService(Components.interfaces.nsICookiePermission);
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+  var cp = SpecialPowers.Cc["@mozilla.org/cookie/permission;1"]
+    .getService(SpecialPowers.Ci.nsICookiePermission);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
 
   localStorage.setItem("session only", "session value");
   is(localStorage.getItem("session only"), "session value");
   is(localStorage.getItem("persistent1"), "persistent value 1");
   is(localStorage.getItem("persistent2"), "persistent value 2");
 
   SimpleTest.finish();
 }
--- a/dom/tests/mochitest/localstorage/test_cookieSession-phase2.html
+++ b/dom/tests/mochitest/localstorage/test_cookieSession-phase2.html
@@ -4,21 +4,21 @@
 
 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
 function startTest()
 {
-  var io = SpecialPowers.wrap(Components).classes["@mozilla.org/network/io-service;1"]
-    .getService(Components.interfaces.nsIIOService);
+  var io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+    .getService(SpecialPowers.Ci.nsIIOService);
   var uri = io.newURI(window.location, "", null);
-  var cp = SpecialPowers.wrap(Components).classes["@mozilla.org/cookie/permission;1"]
-    .getService(Components.interfaces.nsICookiePermission);
+  var cp = SpecialPowers.Cc["@mozilla.org/cookie/permission;1"]
+    .getService(SpecialPowers.Ci.nsICookiePermission);
 
   is(localStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
   is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
   is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
 
   localStorage.setItem("persistent1", "changed persistent value 1");
   localStorage.removeItem("persistent2");
 
@@ -30,46 +30,46 @@ function startTest()
   localStorage.clear();
 
   is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
   is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
   is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
 
   localStorage.setItem("session only 2", "must be deleted on drop of session-only cookies permissions");
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
 
   is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
   is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
   is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
   is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
 
   is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
   is(localStorage.getItem("session only 2"), null, "Value not present when cookies in session-only mode after delete");
   is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present again");
   is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present again");
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
 
   localStorage.clear();
 
   is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
   is(localStorage.getItem("persistent1"), null, "Persistent value not present after delete");
   is(localStorage.getItem("persistent2"), null, "Persistent value not present after delete");
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
 
   is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
   is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
   is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
   is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
 
-  cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+  cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 
--- a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly2.html
@@ -3,26 +3,26 @@
 <title>localStorage and DOM quota test</title>
 
 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <script type="text/javascript" src="interOriginTest.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
-const Cc = SpecialPowers.wrap(Components).classes;
+const Cc = SpecialPowers.Cc;
 
 var currentTest = 1;
 var prefs = Cc["@mozilla.org/preferences-service;1"]
-            .getService(Components.interfaces.nsIPrefBranch);
+            .getService(SpecialPowers.Ci.nsIPrefBranch);
 var io = Cc["@mozilla.org/network/io-service;1"]
-  .getService(Components.interfaces.nsIIOService);
+  .getService(SpecialPowers.Ci.nsIIOService);
 var uri = io.newURI(window.location, "", null);
 var cp = Cc["@mozilla.org/cookie/permission;1"]
-  .getService(Components.interfaces.nsICookiePermission);
+  .getService(SpecialPowers.Ci.nsICookiePermission);
 
 var quota;
 
 function doNextTest()
 {
   slave = frame;
 
   switch (currentTest)
@@ -40,17 +40,17 @@ function doNextTest()
 
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
       break;
 
     // In subdomain now set another key with length 500 bytes, i.e.
     // allocate 501 bytes
     case 2:
-      cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+      cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
       break;
 
     // Try to set the same key value again to check we don't fail
     // even 1002 bytes has already been exhausted from the quota
     // We just change the value of an existing key.
     case 3:
@@ -83,22 +83,22 @@ function doNextTest()
       slaveOrigin = "https://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
       break;
 
     case 8:
       // Do a clean up...
       slaveOrigin = "http://example.com";
       slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
-      cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+      cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
       break;
 
     default:
       prefs.setIntPref("dom.storage.default_quota", quota);
-      cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
+      cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
       SimpleTest.finish();
   }
 
   ++currentTest;
 }
 
 function doStep()
 {
--- a/dom/tests/mochitest/whatwg/test_bug500328.html
+++ b/dom/tests/mochitest/whatwg/test_bug500328.html
@@ -149,24 +149,24 @@ function noPopStateExpected(msg) {
 
 function popstateExpected(msg) {
   is(gNumPopStates, 1, msg);
   gNumPopStates = 0;
 }
 
 function getColor(elem) {
   var utils = SpecialPowers.wrap(document).defaultView.
-                QueryInterface(Components.interfaces.nsIInterfaceRequestor).
-                getInterface(Components.interfaces.nsIDOMWindowUtils);
+                QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+                getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
   return utils.getVisitedDependentComputedStyle(elem, "", "color");
 }
 
 function getSHistory(theWindow)
 {
-  const Ci = Components.interfaces;
+  const Ci = SpecialPowers.Ci;
   var sh = SpecialPowers.wrap(theWindow.QueryInterface(Ci.nsIInterfaceRequestor))
                         .getInterface(Ci.nsIWebNavigation)
                         .sessionHistory;
   if (!sh || sh == null)
     throw("Couldn't get shistory for window!");
 
   return sh;
 }
--- a/editor/composer/test/test_bug519928.html
+++ b/editor/composer/test/test_bug519928.html
@@ -17,19 +17,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 var iframe = document.getElementById("load-frame");
 
 function enableJS() allowJS(true, iframe);
 function disableJS() allowJS(false, iframe);
 function allowJS(allow, frame) {
-  SpecialPowers.wrap(frame.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
-               .getInterface(Components.interfaces.nsIWebNavigation)
-               .QueryInterface(Components.interfaces.nsIDocShell)
+  SpecialPowers.wrap(frame.contentWindow.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor))
+               .getInterface(SpecialPowers.Ci.nsIWebNavigation)
+               .QueryInterface(SpecialPowers.Ci.nsIDocShell)
                .allowJavascript = allow;
 }
 function expectJSAllowed(allowed, testCondition, callback) {
   window.ICanRunMyJS = false;
   var self_ = window;
   testCondition();
 
   var doc = iframe.contentDocument;
--- a/editor/libeditor/html/tests/test_bug432225.html
+++ b/editor/libeditor/html/tests/test_bug432225.html
@@ -29,17 +29,17 @@ function getEdit() {
   return document.getElementById('edit');
 }
 
 function editDoc() {
   return getEdit().contentDocument;
 }
 
 function getSpellCheckSelection() {
-  var Ci = Components.interfaces;
+  var Ci = SpecialPowers.Ci;
   var win = editDoc().defaultView;
   var editingSession = SpecialPowers.wrap(win.QueryInterface(Ci.nsIInterfaceRequestor))
                                     .getInterface(Ci.nsIWebNavigation)
                                     .QueryInterface(Ci.nsIInterfaceRequestor)
                                     .getInterface(Ci.nsIEditingSession);
   var editor = editingSession.getEditorForWindow(win);
   var selcon = editor.selectionController;
   return selcon.getSelection(selcon.SELECTION_SPELLCHECK);  
--- a/editor/libeditor/html/tests/test_bug468353.html
+++ b/editor/libeditor/html/tests/test_bug468353.html
@@ -36,18 +36,18 @@ function checkStylesheets() {
     removed++;
   }
   catch (ex) { }
 
   is(removed, 0, "Should have thrown if stylesheet was not there");
 }
 
 function runTest() {
-  const Ci = Components.interfaces;
-  const Cc = Components.classes;
+  const Ci = SpecialPowers.Ci;
+  const Cc = SpecialPowers.Components.classes;
 
   /** Found while fixing bug 440614 **/
   var editframe = window.frames[0];
   var editdoc = editframe.document;
   var editor = null;
   editdoc.write('');
   editdoc.close();
 
--- a/editor/libeditor/html/tests/test_bug520189.html
+++ b/editor/libeditor/html/tests/test_bug520189.html
@@ -544,58 +544,58 @@ function doNextTest() {
   }
 
   runTest(tests[testCounter]);
 
   doNextTest();
 }
 
 function getLoadContext() {
-  const Ci = Components.interfaces;
+  const Ci = SpecialPowers.Ci;
   return SpecialPowers.wrap(window)
                .QueryInterface(Ci.nsIInterfaceRequestor)
                .getInterface(Ci.nsIWebNavigation)
                .QueryInterface(Ci.nsILoadContext);
 }
 
 function runTest(test) {
   var elem = document.getElementById(test.id);
   if ("isIFrame" in test) {
     elem.contentDocument.designMode = "on";
     elem.contentWindow.focus();
   } else
     elem.focus();
 
-  var trans = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/transferable;1"]
-                           .createInstance(Components.interfaces.nsITransferable);
+  var trans = SpecialPowers.Cc["@mozilla.org/widget/transferable;1"]
+                           .createInstance(SpecialPowers.Ci.nsITransferable);
   trans.init(getLoadContext());
-  var data = SpecialPowers.wrap(Components).classes["@mozilla.org/supports-string;1"]
-                          .createInstance(Components.interfaces.nsISupportsString);
+  var data = SpecialPowers.Cc["@mozilla.org/supports-string;1"]
+                          .createInstance(SpecialPowers.Ci.nsISupportsString);
   data.data = test.payload;
   trans.addDataFlavor("text/html");
   trans.setTransferData("text/html", data, data.data.length * 2);
 
   if ("indirectPaste" in test) {
     var editor, win;
     if ("isIFrame" in test) {
       win = elem.contentDocument.defaultView;
     } else {
       getSelection().collapse(elem, 0);
       win = window;
     }
-    editor = SpecialPowers.wrap(win).QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                          .getInterface(Components.interfaces.nsIWebNavigation)
-                          .QueryInterface(Components.interfaces.nsIEditorDocShell)
+    editor = SpecialPowers.wrap(win).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+                          .getInterface(SpecialPowers.Ci.nsIWebNavigation)
+                          .QueryInterface(SpecialPowers.Ci.nsIEditorDocShell)
                           .editor;
     editor.pasteTransferable(trans);
   } else {
-    var clipboard = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/clipboard;1"]
-                                 .getService(Components.interfaces.nsIClipboard);
+    var clipboard = SpecialPowers.Cc["@mozilla.org/widget/clipboard;1"]
+                                 .getService(SpecialPowers.Ci.nsIClipboard);
 
-    clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
+    clipboard.setData(trans, null, SpecialPowers.Ci.nsIClipboard.kGlobalClipboard);
 
     synthesizeKey("V", {accelKey: true});
   }
 
   if ("checkResult" in test) {
     if ("isIFrame" in test) {
       test.checkResult(elem.contentDocument.documentElement.innerHTML,
         elem.contentDocument.documentElement.textContent);
--- a/editor/libeditor/html/tests/test_bug525389.html
+++ b/editor/libeditor/html/tests/test_bug525389.html
@@ -3,19 +3,19 @@
 <title>Test for bug 525389</title>
 <style src="/tests/SimpleTest/test.css" type="text/css"></style>
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
 
 <script class="testbody" type="application/javascript">
 
   var utils = SpecialPowers.wrap(window)
-                .QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
-  var Cc = SpecialPowers.wrap(Components).classes;
-  var Ci = Components.interfaces;
+                .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
+  var Cc = SpecialPowers.Cc;
+  var Ci = SpecialPowers.Ci;
 
 function getLoadContext() {
   return SpecialPowers.wrap(window)
                .QueryInterface(Ci.nsIInterfaceRequestor)
                .getInterface(Ci.nsIWebNavigation)
                .QueryInterface(Ci.nsILoadContext);
 }
 
@@ -82,17 +82,17 @@ function runTest() {
       selection.selectAllChildren(doc.body);
     } else {
       var range = document.createRange();
       range.selectNode(doc.getElementById(target_id));
       selection.addRange(range);
     }
 
     // We cannot use plain strings, we have to use nsSupportsString.
-    var supportsStringClass = Components.classes["@mozilla.org/supports-string;1"];
+    var supportsStringClass = SpecialPowers.Components.classes["@mozilla.org/supports-string;1"];
     var ssData = supportsStringClass.createInstance(Ci.nsISupportsString);
 
     // Create the transferable.
     var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);  
     trans.init(getLoadContext());
 
     // Add the data to the transferable.
     if (asHTML) {
--- a/editor/libeditor/html/tests/test_root_element_replacement.html
+++ b/editor/libeditor/html/tests/test_root_element_replacement.html
@@ -79,23 +79,23 @@ const kTests = [
 var gIFrame;
 var gSetFocusToIFrame = false;
 
 function onLoadIFrame()
 {
   var frameDoc = gIFrame.contentWindow.document;
 
   var selCon = SpecialPowers.wrap(gIFrame).contentWindow.
-    QueryInterface(Components.interfaces.nsIInterfaceRequestor).
-    getInterface(Components.interfaces.nsIWebNavigation).
-    QueryInterface(Components.interfaces.nsIInterfaceRequestor).
-    getInterface(Components.interfaces.nsISelectionDisplay).
-    QueryInterface(Components.interfaces.nsISelectionController);
+    QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+    getInterface(SpecialPowers.Ci.nsIWebNavigation).
+    QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+    getInterface(SpecialPowers.Ci.nsISelectionDisplay).
+    QueryInterface(SpecialPowers.Ci.nsISelectionController);
   var utils = SpecialPowers.getDOMWindowUtils(window);
-  const nsIDOMNode = Components.interfaces.nsIDOMNode;
+  const nsIDOMNode = SpecialPowers.Ci.nsIDOMNode;
 
   // move focus to the HTML editor
   const kTest = kTests[gTestIndex];
   ok(true, "Running " + kTest.description);
   if (kTest.args.length == 1) {
     kTest.initializer(frameDoc, gSetFocusToIFrame, kTest.args[0]);
     ok(selCon.caretVisible, "caret isn't visible -- " + kTest.description);
   } else {
--- a/js/xpconnect/tests/mochitest/test_bug772288.html
+++ b/js/xpconnect/tests/mochitest/test_bug772288.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 772288 **/
 SimpleTest.waitForExplicitFinish();
 
-const Cu = SpecialPowers.wrap(Components).utils;
+const Cu = SpecialPowers.Cu;
 
 function doTest() {
     msg = "Services should be imported on window";
     try {
       Cu.import("resource://gre/modules/Services.jsm", window);
       ok(Services, msg);
     } catch (ex) {
       ok(false, msg + " : " + ex);
--- a/js/xpconnect/tests/mochitest/test_lookupMethod.html
+++ b/js/xpconnect/tests/mochitest/test_lookupMethod.html
@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=774245">Mozilla Bug 774245</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-/** Test for Components.lookupMethod in content scope. **/
+/** Test for SpecialPowers.Components.lookupMethod in content scope. **/
 SimpleTest.waitForExplicitFinish();
 
 // We're testing things from an unprivileged perspective, so don't use
 // SpecialPowers.Cu and friends, since those are SpecialPowers-wrapped versions
 // that allow unprivileged tests to do privileged things.
 var SC = SpecialPowers.Components;
 
 var gLoaded = 0;
--- a/layout/base/tests/bug585922-ref.html
+++ b/layout/base/tests/bug585922-ref.html
@@ -5,17 +5,17 @@
   </head>
   <body onload="doTest()">
     <input type=text>
     <script>
       function doTest() {
         var d = document.querySelector("input");
         d.value = "b";
         d.focus();
-        var editor = SpecialPowers.wrap(d).QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
+        var editor = SpecialPowers.wrap(d).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
         var sel = editor.selection;
         var t = editor.rootElement.firstChild;
         sel.collapse(t, 1); // put the caret at the end of the textbox
         document.documentElement.removeAttribute("class");
       }
     </script>
   </body>
 </html>
--- a/layout/base/tests/bug585922.html
+++ b/layout/base/tests/bug585922.html
@@ -10,17 +10,17 @@
         function enableCaret(aEnable) {
           var selCon = editor.selectionController;
           selCon.setCaretEnabled(aEnable);
         }
 
         var d = document.querySelector("input");
         d.value = "a";
         d.focus();
-        var editor = SpecialPowers.wrap(d).QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
+        var editor = SpecialPowers.wrap(d).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
         var sel = editor.selection;
         var t = editor.rootElement.firstChild;
         sel.collapse(t, 1); // put the caret at the end of the div
         setTimeout(function() {
           enableCaret(false);enableCaret(true);// force a caret display
           enableCaret(false); // hide the caret
           t.replaceData(0, 1, "b"); // replace the text node data
           // at this point, the selection is collapsed to offset 0
--- a/layout/base/tests/test_bug449781.html
+++ b/layout/base/tests/test_bug449781.html
@@ -33,21 +33,21 @@ addLoadEvent(function() {
 
   var equal, str1, str2;
   [equal, str1, str2] = compareSnapshots(s1, s2, true);
   ok(equal, "Show/hide should have no effect",
      "got " + str1 + " but expected " + str2);
 
   var viewer =
     SpecialPowers.wrap($("ourFrame")).contentWindow
-                 .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                 .getInterface(Components.interfaces.nsIWebNavigation)
-                 .QueryInterface(Components.interfaces.nsIDocShell)
+                 .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+                 .getInterface(SpecialPowers.Ci.nsIWebNavigation)
+                 .QueryInterface(SpecialPowers.Ci.nsIDocShell)
                  .contentViewer
-                 .QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
+                 .QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
   viewer.fullZoom = 2;
   
   s3 = snapshotWindow(window);
 
   [equal, str1, str2] = compareSnapshots(s1, s3, true);
   ok(equal, "Zoom should have no effect",
      "got " + str1 + " but expected " + str2);
 
--- a/layout/forms/test/test_bug348236.html
+++ b/layout/forms/test/test_bug348236.html
@@ -32,17 +32,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="text/javascript">
 
   /** Test for Bug 348236 **/
 
 SimpleTest.waitForExplicitFinish()
 addLoadEvent(function test() {
 
     var
-        CI = Components.interfaces,
+        CI = SpecialPowers.Components.interfaces,
         WinUtils = SpecialPowers.getDOMWindowUtils(window),
         sec = netscape.security,
         eSelect = $("eSelect"),
         IDOMEvent = CI.nsIDOMEvent,
         IDOMKeyEvent = CI.nsIDOMKeyEvent,
         timeout = 0 // Choose a larger value like 500 ms if you want to see what's happening.
 
     function keypressOnSelect(key, modifiers) {
--- a/layout/forms/test/test_bug411236.html
+++ b/layout/forms/test/test_bug411236.html
@@ -23,30 +23,30 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 window.oTarget = null;
 window.fileInputGotClick = false;
 
 // accessibility.tabfocus must be set to value 7 before running test also
 // on a mac.
 function setOrRestoreTabFocus(newValue) {
   const prefSvcContractID = "@mozilla.org/preferences-service;1";
-  const prefSvcIID = Components.interfaces.nsIPrefService;
-  var prefs = SpecialPowers.wrap(Components).classes[prefSvcContractID].getService(prefSvcIID)
+  const prefSvcIID = SpecialPowers.Ci.nsIPrefService;
+  var prefs = SpecialPowers.Cc[prefSvcContractID].getService(prefSvcIID)
                                                    .getBranch("accessibility.");
   if (!newValue) {
     prefs.clearUserPref("tabfocus");
   } else {
     prefs.setIntPref("tabfocus", newValue);
   }
 }
 
 function tab() {
   var utils = SpecialPowers.DOMWindowUtils;
   // Send tab key events.
-  var key = Components.interfaces.nsIDOMKeyEvent.DOM_VK_TAB;
+  var key = SpecialPowers.Ci.nsIDOMKeyEvent.DOM_VK_TAB;
   utils.sendKeyEvent("keydown", key, 0, 0);
   utils.sendKeyEvent("keypress", key, 0, 0);
   utils.sendKeyEvent("keyup", key, 0, 0);
 }
 
 function test() {
   // Try to find the 'Browse...' using tabbing.
   var i = 0;
--- a/layout/generic/test/test_bug348681.html
+++ b/layout/generic/test/test_bug348681.html
@@ -294,17 +294,17 @@ https://bugzilla.mozilla.org/show_bug.cg
        selection.addRange(range2);
        selection.addRange(range3);
        var range8 = document.createRange();
        range8.setStart(testNode, 10);
        range8.setEnd(testNode, 12);
        selection.addRange(range8);
        intervalChecker.reset();
        intervalChecker.addExpected(testNode, 8, 10);
-       var privSel = selection.QueryInterface(Components.interfaces.nsISelectionPrivate);
+       var privSel = selection.QueryInterface(SpecialPowers.Ci.nsISelectionPrivate);
        ok(privSel, "Test 17 - QIed to instance of nsISelection2 interface");
        var numResults = {};
        var results = privSel.GetRangesForInterval(testNode, 8, testNode, 10,
                                                   false, numResults);
        intervalChecker.check(17, results);
 
        // Test 18. Check GetRangesForInterval returns correct results.
        // Part 2 - Test interval matches a range, adjacent ranges allowed.
--- a/toolkit/components/passwordmgr/test/prompt_common.js
+++ b/toolkit/components/passwordmgr/test/prompt_common.js
@@ -1,11 +1,11 @@
-var Ci = Components.interfaces;
+var Ci = SpecialPowers.Ci;
 ok(Ci != null, "Access Ci");
-var Cc = SpecialPowers.wrap(Components).classes;
+var Cc = SpecialPowers.Cc;
 ok(Cc != null, "Access Cc");
 
 var didDialog;
 
 var timer; // keep in outer scope so it's not GC'd before firing
 function startCallbackTimer() {
     didDialog = false;
 
@@ -19,17 +19,17 @@ function startCallbackTimer() {
 
 
 var observer = {
     QueryInterface : function (iid) {
         const interfaces = [Ci.nsIObserver,
                             Ci.nsISupports, Ci.nsISupportsWeakReference];
 
         if (!interfaces.some( function(v) { return iid.equals(v) } ))
-            throw Components.results.NS_ERROR_NO_INTERFACE;
+            throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
         return this;
     },
 
     observe : function (subject, topic, data) {
         var doc = getDialogDoc();
         if (doc)
             handleDialog(doc, testNum);
         else
--- a/toolkit/components/passwordmgr/test/test_bug_627616.html
+++ b/toolkit/components/passwordmgr/test/test_bug_627616.html
@@ -5,17 +5,17 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
   <script type="text/javascript" src="prompt_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <script class="testbody" type="text/javascript">
     SimpleTest.waitForExplicitFinish();
 
-    var Cc = SpecialPowers.wrap(Components).classes;
+    var Cc = SpecialPowers.Cc;
 
     testNum = 1;
 
     var login, login2;
     function init() {
         var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
         var pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService();
 
@@ -77,17 +77,17 @@
       SpecialPowers.wrap(xhr).channel.loadFlags |= Ci.nsIChannel.LOAD_ANONYMOUS;
       xhr.send();
     }
 
     var gExpectedDialogs = 0;
     var gCurrentTest;
     function runNextTest() {
       is(gExpectedDialogs, 0, "received expected number of auth dialogs");
-      Cc["@mozilla.org/network/http-auth-manager;1"].getService(Components.interfaces.nsIHttpAuthManager).clearAll();
+      Cc["@mozilla.org/network/http-auth-manager;1"].getService(SpecialPowers.Ci.nsIHttpAuthManager).clearAll();
       if (pendingTests.length > 0) {
         ({expectedDialogs: gExpectedDialogs,
           test: gCurrentTest}) = pendingTests.shift();
         gCurrentTest.call(this);
       } else {
         cleanup();
         SimpleTest.finish();
       }
--- a/toolkit/components/passwordmgr/test/test_prompt.html
+++ b/toolkit/components/passwordmgr/test/test_prompt.html
@@ -132,17 +132,17 @@ function addNotificationCallback(cb)
 var storageObserver = {
   notificationCallbacks: [],
 
   QueryInterface : function (iid) {
     const interfaces = [Ci.nsIObserver,
                         Ci.nsISupports, Ci.nsISupportsWeakReference];
 
     if (!interfaces.some( function(v) { return iid.equals(v) } ))
-      throw Components.results.NS_ERROR_NO_INTERFACE;
+      throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
     return this;
   },
 
   observe : function (subject, topic, data) {
     ok(true, ".");
     ok(true, "observer for " + topic + " / " + data);
     ok(true, "Time is " + (new Date()).toUTCString());
     var wrapped = SpecialPowers.wrap(subject);
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -8,17 +8,17 @@
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
     <script class="testbody" type="text/javascript">
         SimpleTest.waitForExplicitFinish();
 
         // Class monitoring number of open dialog windows
         // It checks there is always open just a single dialog per application
         function dialogMonitor() {
-            var observerService = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
+            var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                                .getService(Ci.nsIObserverService);
             observerService.addObserver(this, "domwindowopened", false);
             observerService.addObserver(this, "domwindowclosed", false);
         }
 
         /*
          * As documented in Bug 718543, checking equality of objects pulled
          * from SpecialPowers-wrapped objects is unreliable.  Because of that,
@@ -28,17 +28,17 @@
         dialogMonitor.prototype = {
             windowsOpen : 0,
             windowsRegistered : 0,
 
             QueryInterface : function (iid) {
                 const interfaces = [Ci.nsIObserver, Ci.nsISupports];
 
                 if (!interfaces.some( function(v) { return iid.equals(v) } ))
-                        throw Components.results.NS_ERROR_NO_INTERFACE;
+                        throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
                 return this;
             },
 
             observe: function(subject, topic, data) {
                 if (topic === "domwindowopened") {
                     this.windowsOpen++;
                     ok(this.windowsOpen == 1, "Didn't open more then one dialog at a time");
                     this.windowsRegistered++;
@@ -46,50 +46,50 @@
                 }
                 if (topic === "domwindowclosed") {
                     this.windowsOpen--;
                     return;
                 }
             },
 
             shutdown: function() {
-                var observerService = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
+                var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                                .getService(Ci.nsIObserverService);
                 observerService.removeObserver(this, "domwindowopened");
                 observerService.removeObserver(this, "domwindowclosed");
             },
 
             reset: function() {
                 this.windowsOpen = 0;
                 this.windowsRegistered = 0;
             }
         }
 
         var monitor = new dialogMonitor();
 
         var pwmgr, logins = [];
 
         function initLogins() {
-            pwmgr = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager;1"]
+            pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
                                  .getService(Ci.nsILoginManager);
 
             function addLogin(host, realm, user, pass) {
-                var login = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager/loginInfo;1"]
+                var login = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                                          .createInstance(Ci.nsILoginInfo);
                 login.init(host, null, realm, user, pass, "", "");
                 pwmgr.addLogin(login);
                 logins.push(login);
             }
 
             //need to allow for arbitrary network servers defined in PAC instead of a hardcoded moz-proxy.
-            var ios = SpecialPowers.wrap(Components)
+            var ios = SpecialPowers.wrap(SpecialPowers.Components)
                                    .classes["@mozilla.org/network/io-service;1"]
-                                   .getService(Components.interfaces.nsIIOService);
+                                   .getService(SpecialPowers.Ci.nsIIOService);
 
-            var pps = SpecialPowers.wrap(Components)
+            var pps = SpecialPowers.wrap(SpecialPowers.Components)
                                    .classes["@mozilla.org/network/protocol-proxy-service;1"]
                                    .getService();
 
             var uri = ios.newURI("http://example.com", null, null);
             var pi = pps.resolve(uri, 0);
             var mozproxy = "moz-proxy://" + pi.host + ":" + pi.port;
 
             addLogin(mozproxy, "proxy_realm",
@@ -116,17 +116,17 @@
                      "user6name", "user6pass");
         }
 
         function finishTest() {
             ok(true, "finishTest removing testing logins...");
             for (i in logins)
                 pwmgr.removeLogin(logins[i]);
 
-            var authMgr = SpecialPowers.wrap(Components).classes['@mozilla.org/network/http-auth-manager;1']
+            var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
                                        .getService(Ci.nsIHttpAuthManager);
             authMgr.clearAll();
 
             monitor.shutdown();
             SimpleTest.finish();
         }
 
 
--- a/toolkit/components/passwordmgr/test/test_xml_load.html
+++ b/toolkit/components/passwordmgr/test/test_xml_load.html
@@ -17,22 +17,22 @@ Login Manager test: XML prompt
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: XML prompts. **/
 var pwmgr, login1, login2;
 
 function initLogins() {
-  pwmgr = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager;1"]
+  pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
                        .getService(Ci.nsILoginManager);
 
-  login1 = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager/loginInfo;1"]
+  login1 = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                         .createInstance(Ci.nsILoginInfo);
-  login2 = SpecialPowers.wrap(Components).classes["@mozilla.org/login-manager/loginInfo;1"]
+  login2 = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                         .createInstance(Ci.nsILoginInfo);
 
   login1.init("http://mochi.test:8888", null, "xml",
                "xmluser1", "xmlpass1", "", "");
   login2.init("http://mochi.test:8888", null, "xml2",
                "xmluser2", "xmlpass2", "", "");
 
   pwmgr.addLogin(login1);
@@ -159,18 +159,18 @@ function makeRequest(uri) {
   xmlDoc.load(uri);
 }
 
 
 initLogins();
 
 // clear plain HTTP auth sessions before the test, to allow
 // running them more than once.
-var authMgr = SpecialPowers.wrap(Components).classes['@mozilla.org/network/http-auth-manager;1']
-                           .getService(Components.interfaces.nsIHttpAuthManager);
+var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
+                           .getService(SpecialPowers.Ci.nsIHttpAuthManager);
 authMgr.clearAll();
 
 // start the tests
 testNum = 0;
 doTest();
 
 SimpleTest.waitForExplicitFinish();
 </script>
--- a/toolkit/components/prompts/test/test_bug620145.html
+++ b/toolkit/components/prompts/test/test_bug620145.html
@@ -26,17 +26,17 @@
 SimpleTest.waitForExplicitFinish();
 
 var selectionTest = false;
 var testNum = 0;
 var utils = SpecialPowers.DOMWindowUtils;
 
 function hasTabModalPrompts() {
   var prefName = "prompts.tab_modal.enabled";
-  var Services = SpecialPowers.wrap(Components).utils
+  var Services = SpecialPowers.Cu
                               .import("resource://gre/modules/Services.jsm")
                               .Services;
   return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
          Services.prefs.getBoolPref(prefName);
 }
 
 function openAlert() {
   ok(true, "opening alert...");
--- a/toolkit/components/satchel/test/satchel_common.js
+++ b/toolkit/components/satchel/test/satchel_common.js
@@ -33,51 +33,51 @@ function $_(formNum, name) {
 
   return element;
 }
 
 // Mochitest gives us a sendKey(), but it's targeted to a specific element.
 // This basically sends an untargeted key event, to whatever's focused.
 function doKey(aKey, modifier) {
     var keyName = "DOM_VK_" + aKey.toUpperCase();
-    var key = Components.interfaces.nsIDOMKeyEvent[keyName];
+    var key = SpecialPowers.Ci.nsIDOMKeyEvent[keyName];
 
     // undefined --> null
     if (!modifier)
         modifier = null;
 
     // Window utils for sending fake sey events.
     var wutils = SpecialPowers.getDOMWindowUtils(window);
 
     wutils.sendKeyEvent("keydown",  key, 0, modifier);
     wutils.sendKeyEvent("keypress", key, 0, modifier);
     wutils.sendKeyEvent("keyup",    key, 0, modifier);
 }
 
 
 function getAutocompletePopup() {
-    var Ci = Components.interfaces;
+    var Ci = SpecialPowers.Ci;
     chromeWin = SpecialPowers.wrap(window)
                     .QueryInterface(Ci.nsIInterfaceRequestor)
                     .getInterface(Ci.nsIWebNavigation)
                     .QueryInterface(Ci.nsIDocShellTreeItem)
                     .rootTreeItem
                     .QueryInterface(Ci.nsIInterfaceRequestor)
                     .getInterface(Ci.nsIDOMWindow)
                     .QueryInterface(Ci.nsIDOMChromeWindow);
     autocompleteMenu = chromeWin.document.getElementById("PopupAutoComplete");
     ok(autocompleteMenu, "Got autocomplete popup");
 
     return autocompleteMenu;
 }
 
 
 function cleanUpFormHist() {
-  var formhist = SpecialPowers.wrap(Components).classes["@mozilla.org/satchel/form-history;1"].
-                 getService(Components.interfaces.nsIFormHistory2);
+  var formhist = SpecialPowers.Cc["@mozilla.org/satchel/form-history;1"].
+                 getService(SpecialPowers.Ci.nsIFormHistory2);
   formhist.removeAllEntries();
 }
 cleanUpFormHist();
 
 
 var checkObserver = {
   verifyStack: [],
   callback: null,
--- a/toolkit/components/satchel/test/test_bug_511615.html
+++ b/toolkit/components/satchel/test/test_bug_511615.html
@@ -31,18 +31,18 @@ Form History test: form field autocomple
 /** Test for Form History autocomplete **/
 
 var autocompletePopup = getAutocompletePopup();
 autocompletePopup.style.direction = "ltr";
 
 var input = $_(1, "field1");
 
 // Get the form history service
-var fh = SpecialPowers.wrap(Components).classes["@mozilla.org/satchel/form-history;1"].
-         getService(Components.interfaces.nsIFormHistory2);
+var fh = SpecialPowers.Cc["@mozilla.org/satchel/form-history;1"].
+         getService(SpecialPowers.Ci.nsIFormHistory2);
 ok(fh != null, "got form history service");
 
 fh.removeAllEntries();
 fh.addEntry("field1", "value1");
 fh.addEntry("field1", "value2");
 fh.addEntry("field1", "value3");
 fh.addEntry("field1", "value4");
 fh.addEntry("field1", "value5");
--- a/toolkit/content/tests/widgets/popup_shared.js
+++ b/toolkit/content/tests/widgets/popup_shared.js
@@ -246,31 +246,31 @@ function goNext()
 
 function openMenu(menu)
 {
   if ("open" in menu) {
     menu.open = true;
   }
   else {
     var bo = menu.boxObject;
-    if (bo instanceof Components.interfaces.nsIMenuBoxObject)
+    if (bo instanceof SpecialPowers.Ci.nsIMenuBoxObject)
       bo.openMenu(true);
     else
       synthesizeMouse(menu, 4, 4, { });
   }
 }
 
 function closeMenu(menu, popup)
 {
   if ("open" in menu) {
     menu.open = false;
   }
   else {
     var bo = menu.boxObject;
-    if (bo instanceof Components.interfaces.nsIMenuBoxObject)
+    if (bo instanceof SpecialPowers.Ci.nsIMenuBoxObject)
       bo.openMenu(false);
     else
       popup.hidePopup();
   }
 }
 
 function checkActive(popup, id, testname)
 {
@@ -287,26 +287,26 @@ function checkActive(popup, id, testname
   ok(activeok, testname + " item " + (id ? id : "none") + " active");
 }
 
 function checkOpen(menuid, testname)
 {
   var menu = document.getElementById(menuid);
   if ("open" in menu)
     ok(menu.open, testname + " " + menuid + " menu is open");
-  else if (menu.boxObject instanceof Components.interfaces.nsIMenuBoxObject)
+  else if (menu.boxObject instanceof SpecialPowers.Ci.nsIMenuBoxObject)
     ok(menu.getAttribute("open") == "true", testname + " " + menuid + " menu is open");
 }
 
 function checkClosed(menuid, testname)
 {
   var menu = document.getElementById(menuid);
   if ("open" in menu)
     ok(!menu.open, testname + " " + menuid + " menu is open");
-  else if (menu.boxObject instanceof Components.interfaces.nsIMenuBoxObject)
+  else if (menu.boxObject instanceof SpecialPowers.Ci.nsIMenuBoxObject)
     ok(!menu.hasAttribute("open"), testname + " " + menuid + " menu is closed");
 }
 
 function convertPosition(anchor, align)
 {
   if (anchor == "topleft" && align == "topleft") return "overlap";
   if (anchor == "topleft" && align == "topright") return "start_before";
   if (anchor == "topleft" && align == "bottomleft") return "before_start";
--- a/toolkit/content/tests/widgets/use_large_cache.js
+++ b/toolkit/content/tests/widgets/use_large_cache.js
@@ -1,12 +1,12 @@
 (function() {
   // Set cache size to something large
-  var prefService = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
-                               .getService(Components.interfaces.nsIPrefService);
+  var prefService = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
+                               .getService(SpecialPowers.Ci.nsIPrefService);
   var branch = prefService.getBranch("media.");
   var oldSize = branch.getIntPref("cache_size");
   branch.setIntPref("cache_size", 40000);
 
   window.addEventListener("unload", function() {
     branch.setIntPref("cache_size", oldSize);
   }, false);
  })();
--- a/toolkit/identity/tests/mochitest/head_identity.js
+++ b/toolkit/identity/tests/mochitest/head_identity.js
@@ -1,19 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /** Helper functions for identity mochitests **/
 /** Please keep functions in-sync with unit/head_identity.js **/
 
 "use strict";
 
-const Cc = SpecialPowers.wrap(Components).classes;
-const Ci = Components.interfaces;
-const Cu = SpecialPowers.wrap(Components).utils;
+const Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
+const Cu = SpecialPowers.Cu;
 
 const TEST_URL = "http://mochi.test:8888";
 const TEST_URL2 = "https://myfavoritebaconinacan.com";
 const TEST_USER = "user@example.com";
 const TEST_PRIVKEY = "fake-privkey";
 const TEST_CERT = "fake-cert";
 const TEST_IDPPARAMS = {
   domain: "example.com",
--- a/uriloader/exthandler/tests/mochitest/handlerApps.js
+++ b/uriloader/exthandler/tests/mochitest/handlerApps.js
@@ -1,72 +1,72 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // handlerApp.xhtml grabs this for verification purposes via window.opener
 var testURI = "webcal://127.0.0.1/rheeeeet.html";
 
-const Cc = SpecialPowers.wrap(Components).classes;
+const Cc = SpecialPowers.Cc;
 
 function test() {
 
   const isOSXMtnLion = navigator.userAgent.indexOf("Mac OS X 10.8") != -1;
   if (isOSXMtnLion) {
     todo(false, "This test fails on OS X 10.8, see bug 786938");
     SimpleTest.finish();
     return;
   }
 
   // set up the web handler object
   var webHandler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
-    createInstance(Components.interfaces.nsIWebHandlerApp);
+    createInstance(SpecialPowers.Ci.nsIWebHandlerApp);
   webHandler.name = "Test Web Handler App";
   webHandler.uriTemplate =
       "http://mochi.test:8888/tests/uriloader/exthandler/tests/mochitest/" + 
       "handlerApp.xhtml?uri=%s";
   
   // set up the uri to test with
   var ioService = Cc["@mozilla.org/network/io-service;1"].
-    getService(Components.interfaces.nsIIOService);
+    getService(SpecialPowers.Ci.nsIIOService);
   var uri = ioService.newURI(testURI, null, null);
 
   // create a window, and launch the handler in it
   var newWindow = window.open("", "handlerWindow", "height=300,width=300");
   var windowContext = 
-    SpecialPowers.wrap(newWindow).QueryInterface(Components.interfaces.nsIInterfaceRequestor).
-    getInterface(Components.interfaces.nsIWebNavigation).
-    QueryInterface(Components.interfaces.nsIDocShell);
+    SpecialPowers.wrap(newWindow).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
+    getInterface(SpecialPowers.Ci.nsIWebNavigation).
+    QueryInterface(SpecialPowers.Ci.nsIDocShell);
  
   webHandler.launchWithURI(uri, windowContext); 
 
   // if we get this far without an exception, we've at least partly passed
   // (remaining check in handlerApp.xhtml)
   ok(true, "webHandler launchWithURI (existing window/tab) started");
 
   // make the web browser launch in its own window/tab
   webHandler.launchWithURI(uri);
   
   // if we get this far without an exception, we've passed
   ok(true, "webHandler launchWithURI (new window/tab) test started");
 
   // set up the local handler object
   var localHandler = Cc["@mozilla.org/uriloader/local-handler-app;1"].
-    createInstance(Components.interfaces.nsILocalHandlerApp);
+    createInstance(SpecialPowers.Ci.nsILocalHandlerApp);
   localHandler.name = "Test Local Handler App";
   
   // get a local app that we know will be there and do something sane
   var osString = Cc["@mozilla.org/xre/app-info;1"].
-                 getService(Components.interfaces.nsIXULRuntime).OS;
+                 getService(SpecialPowers.Ci.nsIXULRuntime).OS;
 
   var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
-               getService(Components.interfaces.nsIDirectoryServiceProvider);
+               getService(SpecialPowers.Ci.nsIDirectoryServiceProvider);
   if (osString == "WINNT") {
     var windowsDir = dirSvc.getFile("WinD", {});
-    var exe = windowsDir.clone().QueryInterface(Components.interfaces.nsILocalFile);
+    var exe = windowsDir.clone().QueryInterface(SpecialPowers.Ci.nsILocalFile);
     exe.appendRelativePath("SYSTEM32\\HOSTNAME.EXE");
 
   } else if (osString == "Darwin") { 
     var localAppsDir = dirSvc.getFile("LocApp", {});
     exe = localAppsDir.clone();
     exe.append("iCal.app"); // lingers after the tests finish, but this seems
                             // seems better than explicitly killing it, since
                             // developers who run the tests locally may well
@@ -74,42 +74,42 @@ function test() {
 
     if (navigator.userAgent.match(/ SeaMonkey\//)) {
       // SeaMonkey tinderboxes don't like to have iCal lingering (and focused)
       // on next test suite run(s).
       todo(false, "On SeaMonkey, testing OS X as generic Unix. (Bug 749872)");
 
       // assume a generic UNIX variant
       exe = Cc["@mozilla.org/file/local;1"].
-            createInstance(Components.interfaces.nsILocalFile);
+            createInstance(SpecialPowers.Ci.nsILocalFile);
       exe.initWithPath("/bin/echo");
     }
   } else {
     // assume a generic UNIX variant
     exe = Cc["@mozilla.org/file/local;1"].
-          createInstance(Components.interfaces.nsILocalFile);
+          createInstance(SpecialPowers.Ci.nsILocalFile);
     exe.initWithPath("/bin/echo");
   }
 
   localHandler.executable = exe;
   localHandler.launchWithURI(ioService.newURI(testURI, null, null));
 
   // if we get this far without an exception, we've passed
   ok(true, "localHandler launchWithURI test");
 
   // if we ever decide that killing iCal is the right thing to do, change 
   // the if statement below from "NOTDarwin" to "Darwin"
   if (osString == "NOTDarwin") {
 
     var killall = Cc["@mozilla.org/file/local;1"].
-                  createInstance(Components.interfaces.nsILocalFile);
+                  createInstance(SpecialPowers.Ci.nsILocalFile);
     killall.initWithPath("/usr/bin/killall");
   
     var process = Cc["@mozilla.org/process/util;1"].
-                  createInstance(Components.interfaces.nsIProcess);
+                  createInstance(SpecialPowers.Ci.nsIProcess);
     process.init(killall);
     
     var args = ['iCal'];
     process.run(false, args, args.length);
   }
 
   SimpleTest.waitForExplicitFinish();
 }