зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1610653 - Part 10: Do not use global this property assignment to define global variable in toolkit/components. r=Standard8,pip-reviewers,mhowell
Differential Revision: https://phabricator.services.mozilla.com/D144117
This commit is contained in:
Родитель
acaf6f75b5
Коммит
c9c694b6b3
|
@ -72,7 +72,7 @@ class Feature {
|
|||
}
|
||||
}
|
||||
|
||||
this.PartitioningExceptionListService = function() {};
|
||||
function PartitioningExceptionListService() {}
|
||||
|
||||
PartitioningExceptionListService.prototype = {
|
||||
classID: Components.ID("{ab94809d-33f0-4f28-af38-01efbd3baf22}"),
|
||||
|
|
|
@ -43,7 +43,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
"privacy.purge_trackers.consider_entity_list"
|
||||
);
|
||||
|
||||
this.PurgeTrackerService = function() {};
|
||||
function PurgeTrackerService() {}
|
||||
|
||||
PurgeTrackerService.prototype = {
|
||||
classID: Components.ID("{90d1fd17-2018-4e16-b73c-a04a26fa6dd4}"),
|
||||
|
|
|
@ -117,9 +117,9 @@ async function removeRecordsSince(db, date) {
|
|||
await db.execute(SQL.removeRecordsSince, { date });
|
||||
}
|
||||
|
||||
this.TrackingDBService = function() {
|
||||
function TrackingDBService() {
|
||||
this._initPromise = this._initialize();
|
||||
};
|
||||
}
|
||||
|
||||
TrackingDBService.prototype = {
|
||||
classID: Components.ID("{3c9c43b6-09eb-4ed2-9b87-e29f4221eef0}"),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
this.URLDecorationAnnotationsService = function() {};
|
||||
function URLDecorationAnnotationsService() {}
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
|
|
|
@ -1495,9 +1495,9 @@ const FLAGS_MAP = [
|
|||
},
|
||||
];
|
||||
|
||||
this.ClearDataService = function() {
|
||||
function ClearDataService() {
|
||||
this._initialize();
|
||||
};
|
||||
}
|
||||
|
||||
ClearDataService.prototype = Object.freeze({
|
||||
classID: Components.ID("{0c06583d-7dd8-4293-b1a5-912205f779aa}"),
|
||||
|
|
|
@ -146,4 +146,4 @@ class PrincipalsCollector {
|
|||
}
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["PrincipalsCollector"];
|
||||
const EXPORTED_SYMBOLS = ["PrincipalsCollector"];
|
||||
|
|
|
@ -22,7 +22,7 @@ if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
|||
);
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ServiceWorkerCleanUp"];
|
||||
const EXPORTED_SYMBOLS = ["ServiceWorkerCleanUp"];
|
||||
|
||||
function unregisterServiceWorker(aSW) {
|
||||
return new Promise(resolve => {
|
||||
|
@ -56,7 +56,7 @@ function unregisterServiceWorkersMatching(filterFn) {
|
|||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
this.ServiceWorkerCleanUp = {
|
||||
const ServiceWorkerCleanUp = {
|
||||
removeFromHost(aHost) {
|
||||
return unregisterServiceWorkersMatching(sw =>
|
||||
Services.eTLD.hasRootDomain(sw.principal.host, aHost)
|
||||
|
|
|
@ -15,7 +15,7 @@ var EXPORTED_SYMBOLS = ["Corroborate"];
|
|||
/**
|
||||
* Tools for verifying internal files in Mozilla products.
|
||||
*/
|
||||
this.Corroborate = {
|
||||
const Corroborate = {
|
||||
async init() {},
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,9 +161,9 @@ function processExtraFile(extraPath) {
|
|||
*
|
||||
* It is a service because some background activity will eventually occur.
|
||||
*/
|
||||
this.CrashService = function() {
|
||||
function CrashService() {
|
||||
Services.obs.addObserver(this, "quit-application");
|
||||
};
|
||||
}
|
||||
|
||||
CrashService.prototype = Object.freeze({
|
||||
classID: Components.ID("{92668367-1b17-4190-86b2-1061b2179744}"),
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
* values that correspond to the prefs to be set.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ExtensionPreferencesManager"];
|
||||
const EXPORTED_SYMBOLS = ["ExtensionPreferencesManager"];
|
||||
let ExtensionPreferencesManager;
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
@ -218,7 +219,7 @@ async function processSetting(id, name, action) {
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ExtensionPreferencesManager = {
|
||||
ExtensionPreferencesManager = {
|
||||
/**
|
||||
* Adds a setting to the settingsMap. This is how an API tells the
|
||||
* preferences manager what its setting object is. The preferences
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ExtensionStorageIDB"];
|
||||
const EXPORTED_SYMBOLS = ["ExtensionStorageIDB"];
|
||||
let ExtensionStorageIDB;
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
|
@ -570,7 +571,7 @@ async function migrateJSONFileData(extension, storagePrincipal) {
|
|||
* This ExtensionStorage class implements a backend for the storage.local API which
|
||||
* uses IndexedDB to store the data.
|
||||
*/
|
||||
this.ExtensionStorageIDB = {
|
||||
ExtensionStorageIDB = {
|
||||
BACKEND_ENABLED_PREF,
|
||||
IDB_MIGRATED_PREF_BRANCH,
|
||||
IDB_MIGRATE_RESULT_HISTOGRAM,
|
||||
|
|
|
@ -97,9 +97,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["MessageChannel"];
|
||||
|
||||
/* globals MessageChannel */
|
||||
const EXPORTED_SYMBOLS = ["MessageChannel"];
|
||||
let MessageChannel;
|
||||
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
|
@ -570,7 +569,9 @@ class PendingMessage {
|
|||
}
|
||||
}
|
||||
|
||||
this.MessageChannel = {
|
||||
// Web workers has MessageChannel API, which is unrelated to this.
|
||||
// eslint-disable-next-line no-global-assign
|
||||
MessageChannel = {
|
||||
init() {
|
||||
Services.obs.addObserver(this, "message-manager-close");
|
||||
Services.obs.addObserver(this, "message-manager-disconnect");
|
||||
|
|
|
@ -55,7 +55,8 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
false
|
||||
);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SchemaRoot", "Schemas"];
|
||||
const EXPORTED_SYMBOLS = ["SchemaRoot", "Schemas"];
|
||||
let Schemas;
|
||||
|
||||
const KEY_CONTENT_SCHEMAS = "extensions-framework/schemas/content";
|
||||
const KEY_PRIVILEGED_SCHEMAS = "extensions-framework/schemas/privileged";
|
||||
|
@ -3605,7 +3606,7 @@ class SchemaRoot extends Namespace {
|
|||
}
|
||||
}
|
||||
|
||||
this.Schemas = {
|
||||
Schemas = {
|
||||
initialized: false,
|
||||
|
||||
REVOKE: Symbol("@@revoke"),
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["FormAutofillHeuristics", "FieldScanner"];
|
||||
const EXPORTED_SYMBOLS = ["FormAutofillHeuristics", "FieldScanner"];
|
||||
let FormAutofillHeuristics;
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
|
@ -565,7 +566,7 @@ class FieldScanner {
|
|||
/**
|
||||
* Returns the autocomplete information of fields according to heuristics.
|
||||
*/
|
||||
this.FormAutofillHeuristics = {
|
||||
FormAutofillHeuristics = {
|
||||
RULES: null,
|
||||
|
||||
CREDIT_CARD_FIELDNAMES: [],
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
const EXPORTED_SYMBOLS = [
|
||||
"FormAutofillStorageBase",
|
||||
"CreditCardsBase",
|
||||
"AddressesBase",
|
||||
|
|
|
@ -16,7 +16,7 @@ ChromeUtils.defineModuleGetter(
|
|||
|
||||
const { FIELD_STATES } = FormAutofillUtils;
|
||||
|
||||
this.CreditCardTelemetry = {
|
||||
const CreditCardTelemetry = {
|
||||
// Mapping of field name used in formautofill code to the field name
|
||||
// used in the telemetry.
|
||||
CC_FORM_V2_SUPPORTED_FIELDS: {
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["FormAutofillUtils", "AddressDataLoader", "LabelUtils"];
|
||||
const EXPORTED_SYMBOLS = [
|
||||
"FormAutofillUtils",
|
||||
"AddressDataLoader",
|
||||
"LabelUtils",
|
||||
];
|
||||
let FormAutofillUtils;
|
||||
|
||||
const ADDRESS_METADATA_PATH = "resource://autofill/addressmetadata/";
|
||||
const ADDRESS_REFERENCES = "addressReferences.js";
|
||||
|
@ -209,7 +214,7 @@ let AddressDataLoader = {
|
|||
},
|
||||
};
|
||||
|
||||
this.FormAutofillUtils = {
|
||||
FormAutofillUtils = {
|
||||
get AUTOFILL_FIELDS_THRESHOLD() {
|
||||
return 3;
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// We expose a singleton from this module. Some tests may import the
|
||||
// constructor via a backstage pass.
|
||||
this.EXPORTED_SYMBOLS = ["formAutofillStorage", "FormAutofillStorage"];
|
||||
const EXPORTED_SYMBOLS = ["formAutofillStorage", "FormAutofillStorage"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
|
@ -262,4 +262,4 @@ class FormAutofillStorage extends FormAutofillStorageBase {
|
|||
}
|
||||
|
||||
// The singleton exposed by this module.
|
||||
this.formAutofillStorage = new FormAutofillStorage();
|
||||
const formAutofillStorage = new FormAutofillStorage();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// We expose a singleton from this module. Some tests may import the
|
||||
// constructor via a backstage pass.
|
||||
this.EXPORTED_SYMBOLS = ["formAutofillStorage", "FormAutofillStorage"];
|
||||
const EXPORTED_SYMBOLS = ["formAutofillStorage", "FormAutofillStorage"];
|
||||
|
||||
const { FormAutofill } = ChromeUtils.import(
|
||||
"resource://autofill/FormAutofill.jsm"
|
||||
|
@ -289,6 +289,6 @@ class FormAutofillStorage extends FormAutofillStorageBase {
|
|||
}
|
||||
|
||||
// The singleton exposed by this module.
|
||||
this.formAutofillStorage = new FormAutofillStorage(
|
||||
const formAutofillStorage = new FormAutofillStorage(
|
||||
OS.Path.join(OS.Constants.Path.profileDir, PROFILE_JSON_FILE_NAME)
|
||||
);
|
||||
|
|
|
@ -34,7 +34,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
* A module that provides utility functions for form security.
|
||||
*
|
||||
*/
|
||||
this.InsecurePasswordUtils = {
|
||||
const InsecurePasswordUtils = {
|
||||
_formRootsWarned: new WeakMap(),
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
return LoginHelper.createLogger("LoginFormFactory");
|
||||
});
|
||||
|
||||
this.LoginFormFactory = {
|
||||
const LoginFormFactory = {
|
||||
/**
|
||||
* WeakMap of the root element of a LoginForm to the LoginForm representing its fields.
|
||||
*
|
||||
|
|
|
@ -357,7 +357,7 @@ class ImportRowProcessor {
|
|||
/**
|
||||
* Contains functions shared by different Login Manager components.
|
||||
*/
|
||||
this.LoginHelper = {
|
||||
const LoginHelper = {
|
||||
debug: null,
|
||||
enabled: null,
|
||||
storageEnabled: null,
|
||||
|
|
|
@ -520,7 +520,7 @@ const observer = {
|
|||
// Add this observer once for the process.
|
||||
Services.obs.addObserver(observer, "autocomplete-did-enter-text");
|
||||
|
||||
this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
|
||||
class LoginManagerChild extends JSWindowActorChild {
|
||||
/**
|
||||
* WeakMap of the root element of a LoginForm to the DeferredTask to fill its fields.
|
||||
*
|
||||
|
@ -3174,4 +3174,4 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
|
|||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
/**
|
||||
* Password manager object for the browser contextual menu.
|
||||
*/
|
||||
this.LoginManagerContextMenu = {
|
||||
const LoginManagerContextMenu = {
|
||||
/**
|
||||
* Look for login items and add them to the contextual menu.
|
||||
*
|
||||
|
|
|
@ -244,7 +244,7 @@ LoginRecipesParent.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
this.LoginRecipesContent = {
|
||||
const LoginRecipesContent = {
|
||||
_recipeCache: new WeakMap(),
|
||||
|
||||
_clearRecipeCache() {
|
||||
|
|
|
@ -667,7 +667,7 @@ function makeRuleset(coeffs, biases) {
|
|||
* ----- End of model -----
|
||||
*/
|
||||
|
||||
this.NewPasswordModel = {
|
||||
const NewPasswordModel = {
|
||||
type: "new",
|
||||
rules: makeRuleset([...coefficients.new], biases),
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ DEFAULT_RULES.set(MIN_LENGTH, REQUIRED_CHARACTER_CLASSES.length);
|
|||
DEFAULT_RULES.set(MAX_LENGTH, MAX_UINT8);
|
||||
DEFAULT_RULES.set(REQUIRED, [UPPER, LOWER, DIGIT]);
|
||||
|
||||
this.PasswordGenerator = {
|
||||
const PasswordGenerator = {
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {number} options.length - length of the generated password if there are no rules that override the length
|
||||
|
|
|
@ -42,7 +42,7 @@ const LoginInfo = Components.Constructor(
|
|||
"init"
|
||||
);
|
||||
|
||||
this.LoginTestUtils = {
|
||||
const LoginTestUtils = {
|
||||
setAssertReporter(reporterFunc) {
|
||||
Assert = new AssertCls(Cu.waiveXrays(reporterFunc));
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@ var EXPORTED_SYMBOLS = [
|
|||
];
|
||||
|
||||
// These denote which keyboard controls to show for a qualified video element.
|
||||
this.KEYBOARD_CONTROLS = {
|
||||
const KEYBOARD_CONTROLS = {
|
||||
NONE: 0,
|
||||
PLAY_PAUSE: 1 << 0,
|
||||
MUTE_UNMUTE: 1 << 1,
|
||||
|
@ -23,7 +23,7 @@ this.KEYBOARD_CONTROLS = {
|
|||
|
||||
// These are the possible toggle positions along the right side of
|
||||
// a qualified video element.
|
||||
this.TOGGLE_POLICIES = {
|
||||
const TOGGLE_POLICIES = {
|
||||
DEFAULT: 1,
|
||||
HIDDEN: 2,
|
||||
TOP: 3,
|
||||
|
@ -35,7 +35,7 @@ this.TOGGLE_POLICIES = {
|
|||
// These strings are used in the videocontrols.css stylesheet as
|
||||
// toggle policy attribute values for setting rules on the position
|
||||
// of the toggle.
|
||||
this.TOGGLE_POLICY_STRINGS = {
|
||||
const TOGGLE_POLICY_STRINGS = {
|
||||
[TOGGLE_POLICIES.DEFAULT]: "default",
|
||||
[TOGGLE_POLICIES.HIDDEN]: "hidden",
|
||||
[TOGGLE_POLICIES.TOP]: "top",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
* an error occurred.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["FormHistory"];
|
||||
const EXPORTED_SYMBOLS = ["FormHistory"];
|
||||
let FormHistory;
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
|
@ -1016,7 +1017,7 @@ var DB = {
|
|||
},
|
||||
};
|
||||
|
||||
this.FormHistory = {
|
||||
FormHistory = {
|
||||
get db() {
|
||||
return DB.conn;
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ const PREF_DISABLE_TEST_BACKOFF =
|
|||
*
|
||||
* @returns {function} A partially-applied form of the speficied function.
|
||||
*/
|
||||
this.BindToObject = function BindToObject(fn, self, opt_args) {
|
||||
function BindToObject(fn, self, opt_args) {
|
||||
var boundargs = fn.boundArgs_ || [];
|
||||
boundargs = boundargs.concat(
|
||||
Array.prototype.slice.call(arguments, 2, arguments.length)
|
||||
|
@ -54,7 +54,7 @@ this.BindToObject = function BindToObject(fn, self, opt_args) {
|
|||
newfn.boundFn_ = fn;
|
||||
|
||||
return newfn;
|
||||
};
|
||||
}
|
||||
|
||||
// This implements logic for stopping requests if the server starts to return
|
||||
// too many errors. If we get MAX_ERRORS errors in ERROR_PERIOD minutes, we
|
||||
|
@ -66,9 +66,9 @@ this.BindToObject = function BindToObject(fn, self, opt_args) {
|
|||
|
||||
// HTTP responses that count as an error. We also include any 5xx response
|
||||
// as an error.
|
||||
this.HTTP_FOUND = 302;
|
||||
this.HTTP_SEE_OTHER = 303;
|
||||
this.HTTP_TEMPORARY_REDIRECT = 307;
|
||||
const HTTP_FOUND = 302;
|
||||
const HTTP_SEE_OTHER = 303;
|
||||
const HTTP_TEMPORARY_REDIRECT = 307;
|
||||
|
||||
/**
|
||||
* @param maxErrors Number of times to request before backing off.
|
||||
|
@ -81,7 +81,7 @@ this.HTTP_TEMPORARY_REDIRECT = 307;
|
|||
* @param maxTimeout Number time (ms) maximum timeout period
|
||||
* @param tolerance Checking next request tolerance.
|
||||
*/
|
||||
this.RequestBackoff = function RequestBackoff(
|
||||
function RequestBackoff(
|
||||
maxErrors,
|
||||
retryIncrement,
|
||||
maxRequests,
|
||||
|
@ -116,7 +116,7 @@ this.RequestBackoff = function RequestBackoff(
|
|||
return this.canMakeRequestDefault();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the object for reuse. This deliberately doesn't clear requestTimes_.
|
||||
|
@ -226,4 +226,4 @@ function UrlClassifierLib() {
|
|||
}
|
||||
UrlClassifierLib.prototype.QueryInterface = ChromeUtils.generateQI([]);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["UrlClassifierLib"];
|
||||
var EXPORTED_SYMBOLS = ["UrlClassifierLib", "BindToObject"];
|
||||
|
|
|
@ -31,7 +31,7 @@ let loggingEnabled = false;
|
|||
let BindToObject, RequestBackoffV4;
|
||||
|
||||
// Log only if browser.safebrowsing.debug is true
|
||||
this.log = function log(...stuff) {
|
||||
function log(...stuff) {
|
||||
if (!loggingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ this.log = function log(...stuff) {
|
|||
msg = Services.urlFormatter.trimSensitiveURLs(msg);
|
||||
Services.console.logStringMessage(msg);
|
||||
dump(msg + "\n");
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A ListManager keeps track of exception and block lists and knows
|
||||
|
@ -49,7 +49,7 @@ this.log = function log(...stuff) {
|
|||
*
|
||||
* @constructor
|
||||
*/
|
||||
this.PROT_ListManager = function PROT_ListManager() {
|
||||
function PROT_ListManager() {
|
||||
loggingEnabled = Services.prefs.getBoolPref(PREF_DEBUG_ENABLED);
|
||||
|
||||
log("Initializing list manager");
|
||||
|
@ -79,7 +79,7 @@ this.PROT_ListManager = function PROT_ListManager() {
|
|||
|
||||
Services.obs.addObserver(this, "quit-application");
|
||||
Services.prefs.addObserver(PREF_DEBUG_ENABLED, this);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new table table
|
||||
|
|
Загрузка…
Ссылка в новой задаче