Bug 843711 - Fix up new |Components| culprits in test suite. r=mccr8
authorBobby Holley <bobbyholley@gmail.com>
Mon, 25 Feb 2013 10:43:03 -0800
changeset 122927 f66f6db7f212d02687071bd42072f428864a3553
parent 122926 10d6868530d7fa77bfacdc42f8b3b1664cf4af2f
child 122928 75ffb31383a742e6a87e1f1a9dc442756fa3e788
push id1387
push userphilringnalda@gmail.com
push dateTue, 26 Feb 2013 22:32:56 +0000
treeherderfx-team@ad4cc4e97774 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs843711
milestone22.0a1
Bug 843711 - Fix up new |Components| culprits in test suite. r=mccr8
browser/base/content/test/test_bug787619.html
content/base/test/test_XHR_anon.html
content/base/test/test_bug425013.html
content/base/test/test_bug429157.html
content/base/test/test_bug810494.html
content/base/test/test_child_process_shutdown_message.html
content/base/test/test_messagemanager_assertpermission.html
content/canvas/test/webgl/test_webgl_conformance_test_suite.html
content/xbl/test/test_bug397934.xhtml
dom/browser-element/mochitest/browserElement_AppFramePermission.js
dom/file/test/test_archivereader_nonUnicode.html
dom/indexedDB/test/helpers.js
dom/permission/tests/test_permission_basics.html
dom/settings/tests/test_settings_onsettingchange.html
dom/tests/mochitest/webapps/file_bug_779982.js
image/test/crashtests/ownerdiscard.html
js/xpconnect/tests/mochitest/Makefile.in
js/xpconnect/tests/mochitest/test_bug478438.html
js/xpconnect/tests/mochitest/test_bug553407.html
js/xpconnect/tests/mochitest/test_bug785096.html
layout/inspector/tests/test_bug462787.html
layout/inspector/tests/test_bug806192.html
toolkit/components/passwordmgr/test/test_bug_654348.html
toolkit/components/passwordmgr/test/test_bug_776171.html
toolkit/components/passwordmgr/test/test_notifications_popup.html
toolkit/components/passwordmgr/test/test_prompt_async.html
toolkit/identity/tests/chrome/sandbox_content_perms.html
--- a/browser/base/content/test/test_bug787619.html
+++ b/browser/base/content/test/test_bug787619.html
@@ -13,17 +13,17 @@
 
   <a id="wrapper">
     <embed id="plugin" style="width: 200px; height: 200px" type="application/x-test">
   </a>
 
   <script class="testbody" type="application/javascript;version=1.7">
   SimpleTest.waitForExplicitFinish();
 
-  const Ci = Components.interfaces;
+  const Ci = SpecialPowers.Ci;
   let wrapperClickCount = 0;
 
   function test1() {
     let plugin = document.getElementById('plugin');
     ok(plugin, 'got plugin element');
     let objLC = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(!objLC.activated, 'plugin should not be activated');
 
--- a/content/base/test/test_XHR_anon.html
+++ b/content/base/test/test_XHR_anon.html
@@ -19,20 +19,18 @@
 // An XHR with the anon flag set will not send cookie and auth information.
 const TEST_URL = "http://example.com/tests/content/base/test/file_XHR_anon.sjs";
 document.cookie = "foo=bar";
 
 let am = {
   authMgr: null,
 
   init: function() {
-    const {classes: Cc, interfaces: Ci} = SpecialPowers.wrap(Components);
-
-    this.authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
-                     .getService(Components.interfaces.nsIHttpAuthManager)
+    this.authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
+                                .getService(SpecialPowers.Ci.nsIHttpAuthManager)
   },
 
   addIdentity: function() {
     this.authMgr.setAuthIdentity("http", "example.com", -1, "basic", "testrealm",
                                  "", "example.com", "user1", "password1");
   },
 
   tearDown: function() {
--- a/content/base/test/test_bug425013.html
+++ b/content/base/test/test_bug425013.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="runtests();">
 
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=425013">Mozilla Bug 425013</a>
 <br>
 
 <script type="text/javascript;version=1.7">
 var missingPlugins = new Array();
-var OBJLC = Components.interfaces.nsIObjectLoadingContent;
+var OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
 
 function pluginBinding(event)
 {
   var plugin = event.target;
   plugin instanceof OBJLC;
   if (SpecialPowers.wrap(plugin).pluginFallbackType == OBJLC.PLUGIN_UNSUPPORTED)
     missingPlugins.push(plugin);
 }
--- a/content/base/test/test_bug429157.html
+++ b/content/base/test/test_bug429157.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body onload="runtests();">
 
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=429157">Mozilla Bug 429157</a>
 <br>
 
 <script>
 var missingPlugins = new Array();
-const OBJLC = Components.interfaces.nsIObjectLoadingContent;
+const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
 
 function pluginBindingAttached(event)
 {
   var plugin = event.target;
   plugin instanceof OBJLC;
   if (SpecialPowers.wrap(plugin).pluginFallbackType == OBJLC.PLUGIN_UNSUPPORTED)
     missingPlugins.push(plugin);
 }
--- a/content/base/test/test_bug810494.html
+++ b/content/base/test/test_bug810494.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=810494">Mozilla Bug 810494</a>
 <pre id="test">
 <script type="application/javascript;version=1.8">
 
 function test(tag, type) {
   "use strict";
   info("testing " + tag + " tag with type " + type);
 
-  const OBJLC = Components.interfaces.nsIObjectLoadingContent;
+  const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
   let obj = document.createElement(tag);
   obj.type = type;
   document.body.appendChild(obj);
 
   obj instanceof OBJLC;
   obj = SpecialPowers.wrap(obj);
 
   // We expect this tag to simply go to alternate content, not get a
--- a/content/base/test/test_child_process_shutdown_message.html
+++ b/content/base/test/test_child_process_shutdown_message.html
@@ -11,24 +11,22 @@
 <p id="display">
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = SpecialPowers.wrap(Components);
-
 const APP_URL = "http://example.org";
 const APP_MANIFEST = "http://example.org/manifest.webapp";
 const CHILD_PROCESS_SHUTDOWN_MESSAGE = "child-process-shutdown";
 
-let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
-             .getService(Ci.nsIMessageBroadcaster);
+let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
+                        .getService(SpecialPowers.Ci.nsIMessageBroadcaster);
 
 /**
  * Load the example.org site in an <iframe mozbrowser>
  *
  * @param isApp
  *        If true, the example.org site will be loaded as an app.
  */
 function loadBrowser(isApp, callback) {
--- a/content/base/test/test_messagemanager_assertpermission.html
+++ b/content/base/test/test_messagemanager_assertpermission.html
@@ -10,28 +10,26 @@
 <p id="display">
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = SpecialPowers.wrap(Components);
-
 const APP_URL = "http://example.org";
 const APP_MANIFEST = "http://example.org/manifest.webapp";
 const CHILD_PROCESS_SHUTDOWN_MESSAGE = "child-process-shutdown";
 
-let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
-             .getService(Ci.nsIMessageBroadcaster);
-let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
-             .getService(Ci.nsISyncMessageSender);
-let gAppsService = Cc["@mozilla.org/AppsService;1"]
-                     .getService(Ci.nsIAppsService);
+let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
+                        .getService(SpecialPowers.Ci.nsIMessageBroadcaster);
+let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
+                        .getService(SpecialPowers.Ci.nsISyncMessageSender);
+let gAppsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
+                     .getService(SpecialPowers.Ci.nsIAppsService);
 
 function setUp() {
   SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
   SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
   SpecialPowers.addPermission("browser", true, window.document);
   SpecialPowers.addPermission("embed-apps", true, window.document);
 
   let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
--- a/content/canvas/test/webgl/test_webgl_conformance_test_suite.html
+++ b/content/canvas/test/webgl/test_webgl_conformance_test_suite.html
@@ -40,18 +40,18 @@ var OPTIONS = {
       throw error;
     }
     return request.responseText;
   };
 
 SimpleTest.waitForExplicitFinish();
 
 function detectDriverType() {
-  const Cc = SpecialPowers.wrap(Components).classes;
-  const Ci = SpecialPowers.wrap(Components).interfaces;
+  const Cc = SpecialPowers.Cc;
+  const Ci = SpecialPowers.Ci;
   var doc = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser).parseFromString("<html/>", "text/html");
 
   var canvas = doc.createElement("canvas");
   canvas.width = 1;
   canvas.height = 1;
 
   var type = "";
   var gl;
@@ -100,25 +100,25 @@ function start() {
   // Set kMacVersion to the OS X version for Mac, and 0 otherwise.
   var osxmatch = /Mac OS X (\d+.\d+)/.exec(navigator.userAgent);
   var kMacVersion = osxmatch ? parseFloat(osxmatch[1]) : 0;
 
   var kIsWindowsVistaOrHigher = false;
   if (kIsWindows) {
     // code borrowed from browser/modules/test/browser_taskbar_preview.js
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-    var version = Components.classes["@mozilla.org/system-info;1"]
-                            .getService(Components.interfaces.nsIPropertyBag2)
+    var version = SpecialPowers.Cc["@mozilla.org/system-info;1"]
+                            .getService(SpecialPowers.Ci.nsIPropertyBag2)
                             .getProperty("version");
     kIsWindowsVistaOrHigher = (parseFloat(version) >= 6.0);
   }
 
   function getEnv(env) {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-    var envsvc = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
+    var envsvc = SpecialPowers.Cc["@mozilla.org/process/environment;1"].getService(SpecialPowers.Ci.nsIEnvironment);
     var val = envsvc.get(env);
     if (val == "")
       return null;
     return val;
   }
 
   var reportType = WebGLTestHarnessModule.TestHarness.reportType;
 
--- a/content/xbl/test/test_bug397934.xhtml
+++ b/content/xbl/test/test_bug397934.xhtml
@@ -73,17 +73,17 @@ addLoadEvent(function() {
      "test1" + ": First field wins even if undefined");
   is(typeof(d.emptyTest1), "undefined",
      "test1" + ": First field wins even if undefined, double-check");
   is(d.emptyTest2, "empty2",
      "test1" + ": First field wins");
   is(d.testAncestor, "ancestor",
      "test1" + ": Empty field should not override ancestor binding");
 
-  var win = XPCNativeWrapper.unwrap(window);
+  var win = window;
   win.counter = 0;
   d.testEvalOnce;
   d.testEvalOnce;
   is(win.counter, 1, "Field should have evaluated once and only once");
 
   d = $("display2");
   is(d.storage, undefined,
      "test2" +
--- a/dom/browser-element/mochitest/browserElement_AppFramePermission.js
+++ b/dom/browser-element/mochitest/browserElement_AppFramePermission.js
@@ -3,17 +3,17 @@
 
 // Bug 777384 - Test mozapp permission.
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 function makeAllAppsLaunchable() {
   var Webapps = {};
-  SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Webapps.jsm", Webapps);
+  SpecialPowers.Cu.import("resource://gre/modules/Webapps.jsm", Webapps);
   var appRegistry = SpecialPowers.wrap(Webapps.DOMApplicationRegistry);
 
   var originalValue = appRegistry.allAppsLaunchable;
   appRegistry.allAppsLaunchable = true;
 
   // Clean up after ourselves once tests are done so the test page is unloaded.
   window.addEventListener("unload", function restoreAllAppsLaunchable(event) {
     if (event.target == window.document) {
--- a/dom/file/test/test_archivereader_nonUnicode.html
+++ b/dom/file/test/test_archivereader_nonUnicode.html
@@ -6,18 +6,18 @@
 <head>
   <title>Archive Reader Non-Unicode 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 createNonUnicodeData() {
-    const Cc = SpecialPowers.wrap(Components).classes;
-    const Ci = SpecialPowers.wrap(Components).interfaces;
+    const Cc = SpecialPowers.Cc;
+    const 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_nonUnicode.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/indexedDB/test/helpers.js
+++ b/dom/indexedDB/test/helpers.js
@@ -5,17 +5,17 @@
 
 var testGenerator = testSteps();
 var archiveReaderEnabled = false;
 
 // The test js is shared between xpcshell (which has no SpecialPowers object)
 // and content mochitests (where the |Components| object is accessible only as
 // SpecialPowers.Components). Expose Components if necessary here to make things
 // work everywhere.
-if (typeof Components === 'undefined')
+if (typeof Components === 'undefined' && typeof SpecialPowers === 'object')
   Components = SpecialPowers.Components;
 
 function executeSoon(aFun)
 {
   let comp = SpecialPowers.wrap(Components);
 
   let thread = comp.classes["@mozilla.org/thread-manager;1"]
                    .getService(comp.interfaces.nsIThreadManager)
--- a/dom/permission/tests/test_permission_basics.html
+++ b/dom/permission/tests/test_permission_basics.html
@@ -25,23 +25,22 @@ var testPrivApp = {
   'manifestURL' : 'https://aprivileged.com/manifest.webapp'
 };
 
 var testCertApp = {
   'manifestURL' : 'https://acertified.com/manifest.webapp'
 };
 
 SpecialPowers.addPermission("permissions", true, document);
-var comp = SpecialPowers.wrap(Components);
 SpecialPowers.pushPrefEnv({ "set": [["dom.mozPermissionSettings.enabled", true]] },
                           function() {
                             SpecialPowers.removePermission("permissions", document);
                           });
 
-comp.utils.import("resource://gre/modules/PermissionSettings.jsm");
+SpecialPowers.Cu.import("resource://gre/modules/PermissionSettings.jsm");
 var mozPermissions = window.navigator.mozPermissionSettings;
 
 function permissionTest() {
   // Any permission explicit for privileged and implicit for certified serves
   var testPerm = "contacts-read";
   // Any permission explicit for privileged and certified apps
   var explicitPerm = "geolocation";
 
--- a/dom/settings/tests/test_settings_onsettingchange.html
+++ b/dom/settings/tests/test_settings_onsettingchange.html
@@ -16,18 +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);
-comp.utils.import("resource://gre/modules/SettingsChangeNotifier.jsm");
+SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
 SpecialPowers.addPermission("settings-write", true, document);
 SpecialPowers.addPermission("settings-read", true, document);
 
 var screenBright = {"screen.brightness": 0.7};
 
 function onFailure() {
   ok(false, "in on Failure!");
--- a/dom/tests/mochitest/webapps/file_bug_779982.js
+++ b/dom/tests/mochitest/webapps/file_bug_779982.js
@@ -1,11 +1,11 @@
 function makeAllAppsLaunchable() {
   var Webapps = {};
-  SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Webapps.jsm", Webapps);
+  SpecialPowers.Cu.import("resource://gre/modules/Webapps.jsm", Webapps);
   var appRegistry = SpecialPowers.wrap(Webapps.DOMApplicationRegistry);
 
   var originalValue = appRegistry.allAppsLaunchable;
   appRegistry.allAppsLaunchable = true;
 
   // Clean up after ourselves once tests are done so the test page is unloaded.
   window.addEventListener("unload", function restoreAllAppsLaunchable(event) {
     if (event.target == window.document) {
--- a/image/test/crashtests/ownerdiscard.html
+++ b/image/test/crashtests/ownerdiscard.html
@@ -1,18 +1,18 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
 <body>
   <div id=tCF0>
     <img id=victim src=ie.png>
     <iframe src=discardframe.htm></iframe>
   </div>
   <script>
-    const Ci = Components.interfaces;
-    const Cc = SpecialPowers.wrap(Components).classes;
+    const Ci = SpecialPowers.Ci;
+    const Cc = SpecialPowers.Cc;
 
     function ImageDecoderObserverStub()
     {
       this.sizeAvailable = function sizeAvailable(aRequest)   {}
       this.frameComplete = function frameComplete(aRequest)   {}
       this.decodeComplete = function decodeComplete(aRequest) {}
       this.loadComplete = function loadComplete(aRequest)     {}
       this.frameUpdate = function frameUpdate(aRequest)       {}
--- a/js/xpconnect/tests/mochitest/Makefile.in
+++ b/js/xpconnect/tests/mochitest/Makefile.in
@@ -38,17 +38,16 @@ MOCHITEST_FILES =	chrome_wrappers_helper
 		test_bug500691.html \
 		bug500931_helper.html \
 		test_bug502959.html \
 		test_bug503926.html \
 		test_bug504877.html \
 		bug504877_helper.html \
 		test_bug505915.html \
 		file_bug505915.html \
-		test_bug553407.html \
 		test_bug560351.html \
 		bug571849_helper.html \
 		test_bug585745.html \
 		test_bug589028.html \
 		bug589028_helper.html \
 		test_bug601299.html \
 		test_bug605167.html \
 		test_bug618017.html \
--- a/js/xpconnect/tests/mochitest/test_bug478438.html
+++ b/js/xpconnect/tests/mochitest/test_bug478438.html
@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     function pass(s, e) { ok(true, s) }
     (pass.opposite = fail).opposite = pass;
 
     function test() {
       if (test.calledAlready)
         return;
       test.calledAlready = true;
 
-      var iwin = (new XPCNativeWrapper(document)).getElementById("f").contentWindow;
+      var iwin = document.getElementById("f").contentWindow;
 
       function testOne(fn, onAllow, infinitive) {
         try { fn(); onAllow("able " + infinitive, "") }
         catch (e) { onAllow.opposite("unable " + infinitive, ": " + e) }
       }
 
       testOne(function() iwin.focus, pass,
               "to resolve/get allAccess property iwin.focus");
deleted file mode 100644
--- a/js/xpconnect/tests/mochitest/test_bug553407.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=517163
--->
-<head>
-  <title>Test for Bug 553407</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553407">Mozilla Bug 553407</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-  
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 553407 **/
-is(typeof new XPCNativeWrapper(location), "object", "XPCNativeWrapper(location) is an object")
-is(typeof new XPCNativeWrapper(XMLHttpRequest), "function", "XPCNativeWrapper(XMLHttpRequest) is a function")
-// We no longer support .wrappedJSObject on NW since for same-origin there is no wrapper in between.
-// is(typeof new XPCNativeWrapper(location).wrappedJSObject, "object", "XPCNativeWrapper(location).wrappedJSObject is an object")
-// is(typeof new XPCNativeWrapper(XMLHttpRequest).wrappedJSObject, "function", "XPCNativeWrapper(XMLHttpRequest).wrappedJSObject is a function")
-ok("a".replace("a", new XPCNativeWrapper(location)).indexOf("mochi.test") >= 0, "XPCNativeWrappers can be used as the replacement value for .replace");
-
-</script>
-</pre>
-</body>
-</html>
--- a/js/xpconnect/tests/mochitest/test_bug785096.html
+++ b/js/xpconnect/tests/mochitest/test_bug785096.html
@@ -19,20 +19,20 @@ SimpleTest.waitForExplicitFinish();
 
 function test()
 {
   var sel = document.createElementNS('http://www.w3.org/1999/xhtml', 'select');
   var option=document.createElement("option");
   option.text="Fubar";
   sel.options.add(option);
   try {
-    Components.lookupMethod(sel.options, "add")(option);
+    SpecialPowers.Components.lookupMethod(sel.options, "add")(option);
     ok(true, "function call should not throw")
   } catch(e) {
-    do_throw("this call should just work without any exceptions");
+    ok(false, "this call should just work without any exceptions");
   }
   SimpleTest.finish();
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/layout/inspector/tests/test_bug462787.html
+++ b/layout/inspector/tests/test_bug462787.html
@@ -18,17 +18,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="application/javascript">
 
 /** Test for Bug 462787 **/
 
 function do_test() {
   const INVALID_POINTER = 0x80004003;
 
   var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
-                             .getService(Components.interfaces.inIDOMUtils);
+                             .getService(SpecialPowers.Ci.inIDOMUtils);
   try {
     utils.getCSSStyleRules(null); 
     ok(false, "expected an exception"); 
   }
   catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
 
   try {
     utils.getRuleLine(null); 
--- a/layout/inspector/tests/test_bug806192.html
+++ b/layout/inspector/tests/test_bug806192.html
@@ -8,17 +8,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <pre id="test">
 <script type="application/javascript">
 
 const utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
-.getService(Components.interfaces.inIDOMUtils);
+.getService(SpecialPowers.Ci.inIDOMUtils);
 
 try {
     var res = utils.getBindingURLs({});
     ok(false, "didn't get error");
 }
 catch(e) { ok(true, "got expected exception"); }
 </script>
 </pre>
--- a/toolkit/components/passwordmgr/test/test_bug_654348.html
+++ b/toolkit/components/passwordmgr/test/test_bug_654348.html
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
  *    we must use the creds that are provided to the xhr witch are different and expected
  */
 
 SimpleTest.waitForExplicitFinish();
 
 function clearAuthCache()
 {
   var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
-                             .getService(Components.interfaces.nsIHttpAuthManager);
+                             .getService(SpecialPowers.Ci.nsIHttpAuthManager);
   authMgr.clearAll();
 }
 
 function doxhr(URL, user, pass, code, next)
 {
   var xhr = new XMLHttpRequest();
   if (user && pass)
     xhr.open("POST", URL, true, user, pass);
--- a/toolkit/components/passwordmgr/test/test_bug_776171.html
+++ b/toolkit/components/passwordmgr/test/test_bug_776171.html
@@ -23,17 +23,17 @@ https://bugzilla.mozilla.org/show_bug.cg
  *    for this path (that is a parent for auth2 path in the first step)
  */
 
 SimpleTest.waitForExplicitFinish();
 
 function clearAuthCache()
 {
   var authMgr = SpecialPowers.Cc['@mozilla.org/network/http-auth-manager;1']
-                             .getService(Components.interfaces.nsIHttpAuthManager);
+                             .getService(SpecialPowers.Ci.nsIHttpAuthManager);
   authMgr.clearAll();
 }
 
 function doxhr(URL, user, pass, next)
 {
   var xhr = new XMLHttpRequest();
   if (user && pass)
     xhr.open("POST", URL, true, user, pass);
--- a/toolkit/components/passwordmgr/test/test_notifications_popup.html
+++ b/toolkit/components/passwordmgr/test/test_notifications_popup.html
@@ -158,28 +158,28 @@ function checkTest() {
         break;
 
       default:
         ok(false, "Unexpected call to checkTest for test #" + testNum);
 
     }
 }
 
-const Ci = Components.interfaces;
-const Cc = SpecialPowers.wrap(Components).classes;
+const Ci = SpecialPowers.Ci;
+const Cc = SpecialPowers.Cc;
 ok(Ci != null, "Access Ci");
 ok(Cc != null, "Access Cc");
 
 var pwmgr = Cc["@mozilla.org/login-manager;1"].
             getService(Ci.nsILoginManager);
 ok(pwmgr != null, "Access pwmgr");
 
 pwmgr.removeAllLogins();
 
-var nsLoginInfo = new SpecialPowers.wrap(Components).
+var nsLoginInfo = new SpecialPowers.wrap(SpecialPowers.Components).
                       Constructor("@mozilla.org/login-manager/loginInfo;1",
                                   Ci.nsILoginInfo, "init");
 var login1 = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null,
                              "notifyu1", "notifyp1", "user", "pass");
 var login2 = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null,
                              "notifyu2", "notifyp2", "user", "pass");
 
 var observerService = Cc["@mozilla.org/observer-service;1"].
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -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 SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+                        throw SpecialPowers.Cr.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++;
@@ -120,34 +120,32 @@
             SimpleTest.finish();
         }
 
 	var resolveCallback = {
 	QueryInterface : function (iid) {
 	const interfaces = [Ci.nsIProtocolProxyCallback, Ci.nsISupports];
 
         if (!interfaces.some( function(v) { return iid.equals(v) } ))
-          throw Components.results.NS_ERROR_NO_INTERFACE;
+          throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
 	  return this;
 	},
 
 	onProxyAvailable : function (req, uri, pi, status) {
           initLogins(pi);
           doTest(testNum);
 	}
 	};
 
 	function startup() {
             //need to allow for arbitrary network servers defined in PAC instead of a hardcoded moz-proxy.
-            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 pps = SpecialPowers.wrap(Components)
-                                   .classes["@mozilla.org/network/protocol-proxy-service;1"]
+            var pps = SpecialPowers.Cc["@mozilla.org/network/protocol-proxy-service;1"]
                                    .getService();
 
             var uri = ios.newURI("http://example.com", null, null);
             pps.asyncResolve(uri, 0, resolveCallback);
 	}
 
         // --------------- Test loop spin ----------------
         var testNum = 1;
--- a/toolkit/identity/tests/chrome/sandbox_content_perms.html
+++ b/toolkit/identity/tests/chrome/sandbox_content_perms.html
@@ -14,16 +14,20 @@
           aFunc();
         } catch (ex) {
           return true;
         }
         return false;
       }
 
       function CcDenied() {
+        // Once Components goes away in content, the question of whether or not
+        // Components.classes throws is not well-formed.
+        if (typeof Components === 'undefined')
+          return true;
         try {
           Components.classes;
           return false;
         } catch (e) {
           return !!/denied/.exec(e);
         }
       }