зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1793227, part 7 - Manual fixes for XPCOMUtils.sys.mjs. r=kmag
One place was missing an explicit return. The eslint-disable-next-line is needed because the analysis doesn't seem to understand the non-static string. The return was split into a separate line because that made eslint complain that we needed to be consistent about returns, though the return type of defineModuleGetter is undefined. Finally, I updated the ChromeUtils.import() calls so they weren't using the deprecated argument. Differential Revision: https://phabricator.services.mozilla.com/D158506
This commit is contained in:
Родитель
c41c392332
Коммит
6667e48501
|
@ -55,6 +55,7 @@ export var XPCOMUtils = {
|
|||
redefining = true;
|
||||
return redefine(aObject, aName, aLambda.apply(aObject));
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
|
@ -124,6 +125,7 @@ export var XPCOMUtils = {
|
|||
this.defineLazyGetter(aObject, name, () => {
|
||||
if (!(name in global)) {
|
||||
let importName = EXTRA_GLOBAL_NAME_TO_IMPORT_NAME[name] || name;
|
||||
// eslint-disable-next-line mozilla/reject-importGlobalProperties, no-unused-vars
|
||||
Cu.importGlobalProperties([importName]);
|
||||
}
|
||||
return global[name];
|
||||
|
@ -216,7 +218,8 @@ export var XPCOMUtils = {
|
|||
aProxy
|
||||
) {
|
||||
if (arguments.length == 3) {
|
||||
return ChromeUtils.defineModuleGetter(aObject, aName, aResource);
|
||||
ChromeUtils.defineModuleGetter(aObject, aName, aResource);
|
||||
return;
|
||||
}
|
||||
|
||||
let proxy = aProxy || {};
|
||||
|
@ -228,7 +231,7 @@ export var XPCOMUtils = {
|
|||
this.defineLazyGetter(aObject, aName, () => {
|
||||
var temp = {};
|
||||
try {
|
||||
ChromeUtils.import(aResource, temp);
|
||||
temp = ChromeUtils.import(aResource);
|
||||
|
||||
if (typeof aPostLambda === "function") {
|
||||
aPostLambda.apply(proxy);
|
||||
|
@ -459,11 +462,7 @@ export var XPCOMUtils = {
|
|||
let initFunc = aInitFuncOrResource;
|
||||
|
||||
if (typeof aInitFuncOrResource == "string") {
|
||||
initFunc = function() {
|
||||
let tmp = {};
|
||||
ChromeUtils.import(aInitFuncOrResource, tmp);
|
||||
return tmp[aName];
|
||||
};
|
||||
initFunc = () => ChromeUtils.import(aInitFuncOrResource)[aName];
|
||||
}
|
||||
|
||||
let handler = new LazyProxyHandler(
|
||||
|
|
Загрузка…
Ссылка в новой задаче