зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
bef719c2d9
Коммит
517f335b43
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче