Bug 1772101 - Part 27: Use plain object for lazy getter in toolkit/components/osfile/. r=mossop

Differential Revision: https://phabricator.services.mozilla.com/D147968
This commit is contained in:
Tooru Fujisawa 2022-06-07 04:31:00 +00:00
Родитель bef719c2d9
Коммит 517f335b43
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -51,9 +51,11 @@ var Type = SysAll.Type;
var Path = ChromeUtils.import("resource://gre/modules/osfile/ospath.jsm");
const lazy = {};
// The library of promises.
ChromeUtils.defineModuleGetter(
this,
lazy,
"PromiseUtils",
"resource://gre/modules/PromiseUtils.jsm"
);
@ -293,7 +295,7 @@ var Scheduler = {
// to an obsolete worker (we reactivate it in the `finally`).
// This needs to be done right now so that we maintain relative
// ordering with calls to post(), etc.
let deferred = PromiseUtils.defer();
let deferred = lazy.PromiseUtils.defer();
let savedQueue = this.queue;
this.queue = deferred.promise;

Просмотреть файл

@ -30,11 +30,13 @@ var { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const lazy = {};
/**
* The native service holding the implementation of the functions.
*/
XPCOMUtils.defineLazyServiceGetter(
this,
lazy,
"Internals",
"@mozilla.org/toolkit/osfile/native-internals;1",
"nsINativeOSFileInternalsService"
@ -58,7 +60,7 @@ var read = function(path, options = {}) {
}
return new Promise((resolve, reject) => {
Internals.read(
lazy.Internals.read(
path,
options,
function onSuccess(success) {
@ -105,7 +107,7 @@ var writeAtomic = function(path, buffer, options = {}) {
}
return new Promise((resolve, reject) => {
Internals.writeAtomic(
lazy.Internals.writeAtomic(
path,
buffer,
options,