diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 81bd99e481c4..69b789cef2b1 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -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; diff --git a/toolkit/components/osfile/modules/osfile_native.jsm b/toolkit/components/osfile/modules/osfile_native.jsm index 41725aacd641..652455a458cb 100644 --- a/toolkit/components/osfile/modules/osfile_native.jsm +++ b/toolkit/components/osfile/modules/osfile_native.jsm @@ -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,