Bug 1433175 - more aggressive scripted patch to replace remaining Components.classes, Components.interfaces, Components.utils and Components.results uses with Cc, Ci, Cu and Cr, r=Mossop.

This commit is contained in:
Florian Quèze 2018-02-28 18:51:35 +01:00
parent c546946f86
commit f3ee8dd20b
60 changed files with 90 additions and 90 deletions

View File

@ -96,7 +96,7 @@ var gConnectionsDialog = {
},
checkForSystemProxy() {
if ("@mozilla.org/system-proxy-settings;1" in Components.classes)
if ("@mozilla.org/system-proxy-settings;1" in Cc)
document.getElementById("systemPref").removeAttribute("hidden");
},

View File

@ -9,8 +9,8 @@ const { loadSubScript } = Cc["@mozilla.org/moz/jssubscript-loader;1"].
let EventUtils = {};
EventUtils.window = content;
EventUtils.parent = EventUtils.window;
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils._EU_Ci = Ci;
EventUtils._EU_Cc = Cc;
EventUtils.navigator = content.navigator;
EventUtils.KeyboardEvent = content.KeyboardEvent;
loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);

View File

@ -731,8 +731,8 @@ async function injectEventUtilsInContentTask(browser) {
EventUtils.window = {};
EventUtils.parent = EventUtils.window;
/* eslint-disable camelcase */
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils._EU_Ci = Ci;
EventUtils._EU_Cc = Cc;
/* eslint-enable camelcase */
// EventUtils' `sendChar` function relies on the navigator to synthetize events.
EventUtils.navigator = content.navigator;

View File

@ -16,8 +16,8 @@
let EventUtils = {};
EventUtils.window = content;
EventUtils.parent = EventUtils.window;
EventUtils._EU_Ci = Components.interfaces; // eslint-disable-line
EventUtils._EU_Cc = Components.classes; // eslint-disable-line
EventUtils._EU_Ci = Ci; // eslint-disable-line
EventUtils._EU_Cc = Cc; // eslint-disable-line
EventUtils.navigator = content.navigator;
EventUtils.KeyboardEvent = content.KeyboardEvent;

View File

@ -28,8 +28,8 @@ let EventUtils = {};
EventUtils.window = {};
EventUtils.parent = {};
/* eslint-disable camelcase */
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils._EU_Ci = Ci;
EventUtils._EU_Cc = Cc;
/* eslint-disable camelcase */
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);

View File

@ -101,8 +101,8 @@ add_task(async function () {
let EventUtils = {
window: content,
parent: content,
_EU_Ci: Components.interfaces,
_EU_Cc: Components.classes,
_EU_Ci: Ci,
_EU_Cc: Cc,
};
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
EventUtils.synthesizeMouseAtPoint(x, y, {type: "mousedown"}, win);

View File

@ -111,8 +111,8 @@ add_task(async function () {
let EventUtils = {
window: content,
parent: content,
_EU_Ci: Components.interfaces,
_EU_Cc: Components.classes,
_EU_Ci: Ci,
_EU_Cc: Cc,
};
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
EventUtils.synthesizeMouseAtPoint(x, y, {type: "mousedown"}, win);

View File

@ -99,8 +99,8 @@ add_task(async function () {
let EventUtils = {
window: content,
parent: content,
_EU_Ci: Components.interfaces,
_EU_Cc: Components.classes,
_EU_Ci: Ci,
_EU_Cc: Cc,
};
Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
EventUtils.synthesizeMouseAtPoint(x, y, {type: "mousedown"}, win);

View File

@ -4,8 +4,8 @@
* 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/. */
const I = Components.interfaces;
const C = Components.classes;
const I = Ci;
const C = Cc;
const nsIFile = I.nsIFile;
const nsIProperties = I.nsIProperties;

View File

@ -20,7 +20,7 @@
'Subject implements nsIPropertyBag2.');
var dumpID;
if ('nsICrashReporter' in Components.interfaces) {
if ('nsICrashReporter' in Ci) {
dumpID = subject.getPropertyAsAString('dumpID');
ok(dumpID, "dumpID is present and not an empty string");
}

View File

@ -10,7 +10,7 @@
testwindow.close();
SimpleTest.finish();
}
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
var isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
var testwindow = window.open("queryCaretRect" + (isWindows ? "Win" : "Unix") + ".html",
"_new", "width=800,height=800");
</script>

View File

@ -66,8 +66,8 @@ function runTest()
sendAsyncMessage("info", "sending key");
var EventUtils = {};
EventUtils.window = {};
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils._EU_Ci = Ci;
EventUtils._EU_Cc = Cc;
Cc['@mozilla.org/moz/jssubscript-loader;1']
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js",

View File

@ -4,7 +4,7 @@
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<div id="log"></div>
<script>
var c = Components.classes;
var c = Cc;
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");

View File

@ -5,7 +5,7 @@
function run_test() {
do_load_manifest("component-blob.manifest");
const contractID = "@mozilla.org/tests/component-blob;1";
Assert.ok(contractID in Components.classes);
Assert.ok(contractID in Cc);
var foo = Cc[contractID]
.createInstance(Ci.nsIClassInfo);
Assert.ok(Boolean(foo));

View File

@ -3,7 +3,7 @@ function run_test() {
createInstance(Ci.nsIPrincipal);
var s = Cu.Sandbox(sp);
s.a = [];
s.Cu = Components.utils;
s.Cu = Cu;
s.C = Components;
s.notEqual = notEqual;
Cu.evalInSandbox("notEqual(Cu.import, undefined);", s);

View File

@ -3,9 +3,9 @@ function check_cl(iface, desc) {
}
function run_test() {
check_cl(Components.interfaces, 'XPCComponents_Interfaces');
check_cl(Ci, 'XPCComponents_Interfaces');
check_cl(Components.interfacesByID, 'XPCComponents_InterfacesByID');
check_cl(Components.classes, 'XPCComponents_Classes');
check_cl(Cc, 'XPCComponents_Classes');
check_cl(Components.classesByID, 'XPCComponents_ClassesByID');
check_cl(Components.results, 'XPCComponents_Results');
check_cl(Cr, 'XPCComponents_Results');
}

View File

@ -5,7 +5,7 @@
add_task(function() {
do_load_manifest("component-file.manifest");
const contractID = "@mozilla.org/tests/component-file;1";
Assert.ok(contractID in Components.classes);
Assert.ok(contractID in Cc);
var foo = Cc[contractID]
.createInstance(Ci.nsIClassInfo);
Assert.ok(Boolean(foo));

View File

@ -55,7 +55,7 @@ function run_test() {
// try to create a component
do_load_manifest("component_import.manifest");
const contractID = "@mozilla.org/tests/module-importer;";
Assert.ok((contractID + "1") in Components.classes);
Assert.ok((contractID + "1") in Cc);
var foo = Cc[contractID + "1"]
.createInstance(Ci.nsIClassInfo);
Assert.ok(Boolean(foo));
@ -80,7 +80,7 @@ function run_test() {
Assert.ok(foo.contractID == contractID + "1");
// try to create another component which doesn't directly implement QI
Assert.ok((contractID + "2") in Components.classes);
Assert.ok((contractID + "2") in Cc);
var bar = Cc[contractID + "2"]
.createInstance(Ci.nsIClassInfo);
Assert.ok(Boolean(bar));

View File

@ -1,6 +1,6 @@
function run_test() {
Assert.ok("@mozilla.org/layout-debug/layout-debuggingtools;1" in
Components.classes);
Cc);
Assert.ok("@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug" in
Components.classes);
Cc);
}

View File

@ -11,7 +11,7 @@ const nsIAuthPromptAdapterFactory = Ci.nsIAuthPromptAdapterFactory;
function run_test() {
const contractID = "@mozilla.org/network/authprompt-adapter-factory;1";
if (!(contractID in Components.classes)) {
if (!(contractID in Cc)) {
print("No adapter factory found, skipping testing");
return;
}

View File

@ -36,10 +36,10 @@ function goQuitApplication() {
var appService;
var forceQuit;
if (kAppStartup in Components.classes) {
if (kAppStartup in Cc) {
appService = Services.startup;
forceQuit = Ci.nsIAppStartup.eForceQuit;
} else if (kAppShell in Components.classes) {
} else if (kAppShell in Cc) {
appService = Services.appShell;
forceQuit = Ci.nsIAppShellService.eForceQuit;
} else {

View File

@ -11,8 +11,8 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
var EventUtils = {};
EventUtils.window = {};
EventUtils.parent = EventUtils.window;
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils._EU_Ci = Ci;
EventUtils._EU_Cc = Cc;
// EventUtils' `sendChar` function relies on the navigator to synthetize events.
EventUtils.navigator = content.document.defaultView.navigator;
EventUtils.KeyboardEvent = content.document.defaultView.KeyboardEvent;

View File

@ -33,17 +33,17 @@ window.__defineGetter__('_EU_Ci', function() {
// placebo for compat. An easy way to differentiate this from the real thing
// is whether the property is read-only or not.
var c = Object.getOwnPropertyDescriptor(window, 'Components');
return c.value && !c.writable ? Components.interfaces : SpecialPowers.Ci;
return c.value && !c.writable ? Ci : SpecialPowers.Ci;
});
window.__defineGetter__('_EU_Cc', function() {
var c = Object.getOwnPropertyDescriptor(window, 'Components');
return c.value && !c.writable ? Components.classes : SpecialPowers.Cc;
return c.value && !c.writable ? Cc : SpecialPowers.Cc;
});
window.__defineGetter__('_EU_Cu', function() {
var c = Object.getOwnPropertyDescriptor(window, 'Components');
return c.value && !c.writable ? Components.utils : SpecialPowers.Cu;
return c.value && !c.writable ? Cu : SpecialPowers.Cu;
});
window.__defineGetter__("_EU_OS", function() {

View File

@ -659,7 +659,7 @@ SpecialPowersAPI.prototype = {
get Cc() { return wrapPrivileged(this.getFullComponents().classes); },
get Ci() {
return this.Components ? this.Components.interfaces
: Components.interfaces;
: Ci;
},
get Cu() { return wrapPrivileged(this.getFullComponents().utils); },
get Cr() { return wrapPrivileged(this.Components.results); },

View File

@ -67,10 +67,10 @@ function goQuitApplication() {
var appService;
var forceQuit;
if (kAppStartup in Components.classes) {
if (kAppStartup in Cc) {
appService = Services.startup;
forceQuit = Ci.nsIAppStartup.eForceQuit;
} else if (kAppShell in Components.classes) {
} else if (kAppShell in Cc) {
appService = Services.appShell;
forceQuit = Ci.nsIAppShellService.eForceQuit;
} else {

View File

@ -54,9 +54,9 @@ function goQuitApplication(waitForSafeBrowsing) {
const kAppShell = "@mozilla.org/appshell/appShellService;1";
var appService;
if (kAppStartup in Components.classes) {
if (kAppStartup in Cc) {
appService = Services.startup;
} else if (kAppShell in Components.classes) {
} else if (kAppShell in Cc) {
appService = Services.appShell;
} else {
throw "goQuitApplication: no AppStartup/appShell";

View File

@ -87,7 +87,7 @@ try {
// Only if building of places is enabled.
if (runningInParent &&
"mozIAsyncHistory" in Components.interfaces) {
"mozIAsyncHistory" in Ci) {
// Ensure places history is enabled for xpcshell-tests as some non-FF
// apps disable it.
_Services.prefs.setBoolPref("places.history.enabled", true);
@ -100,7 +100,7 @@ try {
_Services.prefs.setBoolPref("network.disable.ipc.security", true);
// Disable IPv6 lookups for 'localhost' on windows.
if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
if ("@mozilla.org/windows-registry-key;1" in Cc) {
_Services.prefs.setCharPref("network.dns.ipv4OnlyDomains", "localhost");
}
}
@ -113,7 +113,7 @@ try {
// crashreporter component.
try {
if (runningInParent &&
"@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
"@mozilla.org/toolkit/crash-reporter;1" in Cc) {
let crashReporter =
Cc["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Ci.nsICrashReporter);
@ -923,7 +923,7 @@ function legible_exception(exception) {
return exception.toString();
case "number":
for (let name in Components.results) {
for (let name in Cr) {
if (exception === Cr[name]) {
return "Components.results." + name;
}
@ -1132,7 +1132,7 @@ function do_get_profile(notifyProfileAfterChange = false) {
// We need to update the crash events directory when the profile changes.
if (runningInParent &&
"@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
"@mozilla.org/toolkit/crash-reporter;1" in Cc) {
let crashReporter =
Cc["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Ci.nsICrashReporter);

View File

@ -77,8 +77,8 @@ var NarrateTestUtils = {
getEventUtils(window) {
let eventUtils = {
"_EU_Ci": Components.interfaces,
"_EU_Cc": Components.classes,
"_EU_Ci": Ci,
"_EU_Cc": Cc,
window,
parent: window,
navigator: window.navigator,

View File

@ -7,7 +7,7 @@ function run_test() {
ChromeUtils.import("resource://gre/modules/osfile.jsm");
ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
// Test cases for filePathToURI
let paths = isWindows ? [

View File

@ -117,7 +117,7 @@ add_task(async function test_sort_date_site_grouping() {
// On Linux, the (local files) folder is shown after sites unlike Mac/Windows.
// Thus, we avoid running this test on Linux but this should be re-enabled
// after bug 624024 is resolved.
let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Components.classes);
let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
if (isLinux)
return;

View File

@ -238,7 +238,7 @@ CommonDialog.prototype = {
let button = this.ui["button" + b];
if (!this.hasInputField) {
let isOSX = ("nsILocalFileMac" in Components.interfaces);
let isOSX = ("nsILocalFileMac" in Ci);
if (isOSX)
this.ui.infoBody.focus();
else

View File

@ -170,7 +170,7 @@ var processInfo = {
_GetProcessIoCounters: null,
_GetCurrentProcess: null,
getCounters() {
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
if (isWindows)
return this.getCounters_Windows();
return null;

View File

@ -342,7 +342,7 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
Assert.ok(!failedProfileLocksFile.exists());
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
if (isWindows) {
Assert.ok(payload.simpleMeasurements.startupSessionRestoreReadBytes > 0);
Assert.ok(payload.simpleMeasurements.startupSessionRestoreWriteBytes > 0);

View File

@ -439,7 +439,7 @@
<property name="fastFind" readonly="true">
<getter><![CDATA[
if (!this._fastFind) {
if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
if (!("@mozilla.org/typeaheadfind;1" in Cc))
return null;
var tabBrowser = this.getTabBrowser();
@ -911,7 +911,7 @@
if (!this.docShell.securityUI) {
const SECUREBROWSERUI_CONTRACTID = "@mozilla.org/secure_browser_ui;1";
if (!this.hasAttribute("disablesecurity") &&
SECUREBROWSERUI_CONTRACTID in Components.classes) {
SECUREBROWSERUI_CONTRACTID in Cc) {
var securityUI = Cc[SECUREBROWSERUI_CONTRACTID]
.createInstance(Ci.nsISecureBrowserUI);
securityUI.init(this.contentWindow);

View File

@ -103,7 +103,7 @@
<getter>
<![CDATA[
if (!this._fastFind) {
if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
if (!("@mozilla.org/typeaheadfind;1" in Cc))
return null;
if (!this.docShell)

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_after_js_large_allocation_failure.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_after_js_oom_reporting.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_after_js_oom_recovered.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_after_js_oom_reported.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_after_js_oom_reported_2.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_oom.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,10 +1,10 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_purevirtual.js | Can't test crashreporter in a non-libxul build.\n");
return;
}
var isOSX = ("nsILocalFileMac" in Components.interfaces);
var isOSX = ("nsILocalFileMac" in Ci);
if (isOSX) {
dump("INFO | test_crash_purevirtual.js | TODO: purecalls not caught on OS X\n");
return;

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_thread_annotation.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_oom.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -1,5 +1,5 @@
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_crash_oom.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -2,7 +2,7 @@
load("../unit/head_crashreporter.js");
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -2,7 +2,7 @@
load("../unit/head_crashreporter.js");
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -2,7 +2,7 @@
load("../unit/head_crashreporter.js");
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_content_annotation.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -2,7 +2,7 @@
load("../unit/head_crashreporter.js");
function run_test() {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
dump("INFO | test_content_rust_panic.js | Can't test crashreporter in a non-libxul build.\n");
return;
}

View File

@ -118,7 +118,7 @@ var openFileOutputStream_defaultFlags = function(aKind, aFileName) {
// No nsIXULRuntime in xpcshell, so use this trick to determine whether we're
// on Windows.
if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
if ("@mozilla.org/windows-registry-key;1" in Cc) {
Assert.equal(file.permissions, 0o666);
} else {
Assert.equal(file.permissions, FileUtils.PERMS_FILE);

View File

@ -1070,7 +1070,7 @@ nsUnknownContentTypeDialog.prototype = {
// Remember the file they chose to run.
this.chosenApp = params.handlerApp;
}
} else if ("@mozilla.org/applicationchooser;1" in Components.classes) {
} else if ("@mozilla.org/applicationchooser;1" in Cc) {
var nsIApplicationChooser = Ci.nsIApplicationChooser;
var appChooser = Cc["@mozilla.org/applicationchooser;1"]
.createInstance(nsIApplicationChooser);

View File

@ -205,7 +205,7 @@ function run_test() {
testURI("jar:http://www.mozilla.com/file!/magic", "mozilla.com", "www.mozilla.com");
testURI("file:///C:/Cool/Stuff/", "local file", "local file");
// Don't test for moz-icon if we don't have a protocol handler for it (e.g. b2g):
if ("@mozilla.org/network/protocol;1?name=moz-icon" in Components.classes) {
if ("@mozilla.org/network/protocol;1?name=moz-icon" in Cc) {
testURI("moz-icon:file:///test.extension", "local file", "local file");
testURI("moz-icon://.extension", "moz-icon resource", "moz-icon resource");
}

View File

@ -1,4 +1,4 @@
var AM_Ci = Components.interfaces;
var AM_Ci = Ci;
const CERTDB_CONTRACTID = "@mozilla.org/security/x509certdb;1";
const CERTDB_CID = Components.ID("{fb0bbc5c-452e-4783-b32c-80124693d871}");

View File

@ -101,7 +101,7 @@ add_task(async function initializeState() {
// of experiments it doesn't know about. We remove it from the equation
// because here we are only concerned with core Addon Manager operation,
// not the superset Experiments Manager has imposed.
if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
if ("@mozilla.org/browser/experiments-service;1" in Cc) {
let tmp = {};
ChromeUtils.import("resource:///modules/experiments/Experiments.jsm", tmp);
// There is a race condition between XPCOM service initialization and

View File

@ -4,9 +4,9 @@
/* eslint no-unused-vars: ["error", {vars: "local", args: "none"}] */
var AM_Cc = Components.classes;
var AM_Ci = Components.interfaces;
var AM_Cu = Components.utils;
var AM_Cc = Cc;
var AM_Ci = Ci;
var AM_Cu = Cu;
AM_Cu.importGlobalProperties(["TextEncoder"]);

View File

@ -59,7 +59,7 @@ function pathHandler(metadata, response) {
var ABI = "noarch-spidermonkey";
// the blacklist service special-cases ABI for Universal binaries,
// so do the same here.
if ("@mozilla.org/xpcom/mac-utils;1" in Components.classes) {
if ("@mozilla.org/xpcom/mac-utils;1" in Cc) {
var macutils = Cc["@mozilla.org/xpcom/mac-utils;1"]
.getService(Ci.nsIMacUtils);
if (macutils.isUniversalBinary)

View File

@ -28,7 +28,7 @@ function run_test() {
// support NTFS permissions so we don't need to test there. OSX's isExecutable
// only tests if the file is an application so it is better to just check the
// raw permission bits
if (!("nsIWindowsRegKey" in Components.interfaces))
if (!("nsIWindowsRegKey" in Ci))
Assert.ok((file.permissions & 0o100) == 0o100);
executeSoon(do_test_finished);

View File

@ -2,8 +2,8 @@
* 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/. */
const C = Components.classes;
const I = Components.interfaces;
const C = Cc;
const I = Ci;
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");

View File

@ -7,8 +7,8 @@
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const C = Components.classes;
const I = Components.interfaces;
const C = Cc;
const I = Ci;
const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1";

View File

@ -3,7 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
const CWD = do_get_cwd();
function checkOS(os) {
const nsILocalFile_ = "nsILocalFile" + os;
return nsILocalFile_ in Components.interfaces &&
return nsILocalFile_ in Ci &&
CWD instanceof Ci[nsILocalFile_];
}