Bug 1230369 - Manually fix some remaining instances of Ci/Cc/Cu definitions and switch Components.* to using the shorthand in some places. r=florian

MozReview-Commit-ID: 9SmoR9RlvZE

--HG--
extra : rebase_source : 054e14150921615ed67415ddb91b45169cc868d4
This commit is contained in:
Mark Banner 2018-02-07 09:24:15 +00:00
parent 196444ef40
commit 606beee3f2
12 changed files with 8 additions and 25 deletions

View File

@ -2,8 +2,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var {Ci: interfaces, Cc: classes} = Components;
var HasFindClipboard = Services.clipboard.supportsFindClipboard();
add_task(async function() {

View File

@ -683,7 +683,6 @@ var gMainPane = {
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_NOW:
const Cc = Components.classes, Ci = Components.interfaces;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
@ -886,11 +885,8 @@ var gMainPane = {
},
_getTabsForHomePage() {
var win;
var tabs = [];
const Cc = Components.classes, Ci = Components.interfaces;
win = Services.wm.getMostRecentWindow("navigator:browser");
var win = Services.wm.getMostRecentWindow("navigator:browser");
if (win && win.document.documentElement
.getAttribute("windowtype") == "navigator:browser") {

View File

@ -8,8 +8,8 @@ updateAppInfo({
registerManifests([do_get_file("data/test_abi.manifest")]);
const catman = Components.classes["@mozilla.org/categorymanager;1"].
getService(Components.interfaces.nsICategoryManager);
const catman = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
function is_registered(name) {
try {

View File

@ -6,8 +6,6 @@
/* globals gChromeWin */
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -2,8 +2,6 @@
* 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/. */
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
ChromeUtils.import("resource://services-common/utils.js"); /* global: CommonUtils */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -7,6 +7,7 @@
/* import-globals-from ../../devtools/server/main.js */
/* eslint "mozilla/use-chromeutils-import": ["error", {allowCu: true}] */
// eslint-disable-next-line mozilla/no-define-cc-etc
const Cu = Components.utils;
const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});

View File

@ -22,12 +22,6 @@
// Boilerplate used to be able to import this module both from the main
// thread and from worker threads.
// Since const is lexically scoped, hoist the
// conditionally-useful definition ourselves.
const Cu = typeof Components != "undefined" ? Components.utils : undefined;
const Ci = typeof Components != "undefined" ? Components.interfaces : undefined;
const Cc = typeof Components != "undefined" ? Components.classes : undefined;
/**
* A constructor for messages that require transfers instead of copies.
*

View File

@ -4,8 +4,6 @@
"use strict";
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "AboutReader" ];
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");

View File

@ -4,8 +4,6 @@
this.EXPORTED_SYMBOLS = ["PopupNotifications"];
var Cc = Components.classes, Ci = Components.interfaces, Cu = Components.utils;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");

View File

@ -44,9 +44,11 @@
// This is allowed in workers.
/* global setImmediate:false */
/* eslint-disable mozilla/no-define-cc-etc */
var Cu = this.require ? require("chrome").Cu : Components.utils;
var Cc = this.require ? require("chrome").Cc : Components.classes;
var Ci = this.require ? require("chrome").Ci : Components.interfaces;
/* eslint-enable mozilla/no-define-cc-etc */
// If we can access Components, then we use it to capture an async
// parent stack trace; see scheduleWalkerLoop. However, as it might
// not be available (see above), users of this must check it first.

View File

@ -7,7 +7,7 @@ function run_test() {
do_test_pending();
sendCommand("let v = 'test';", function() {
let codeCoverage = Components.classes["@mozilla.org/tools/code-coverage;1"].getService(Components.interfaces.nsICodeCoverage);
let codeCoverage = Cc["@mozilla.org/tools/code-coverage;1"].getService(Ci.nsICodeCoverage);
codeCoverage.dumpCounters();
codeCoverage.resetCounters();

View File

@ -14,7 +14,7 @@ QuitterObserver.prototype = {
classDescription: "Quitter Observer for use in testing.",
classID: Components.ID("{c235a986-5ac1-4f28-ad73-825dae9bad90}"),
contractID: "@mozilla.org/quitter-observer;1",
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
_xpcom_categories: [{category: "profile-after-change", service: true }],
isFrameScriptLoaded: false,