Bug 1353542 - script-generated patch to remove .bind(this) calls we no longer need now that generator functions have been replaced with async functions, r=Mossop.

This commit is contained in:
Florian Quèze 2017-05-12 14:47:41 +02:00
parent 16530fa1e3
commit 1d0e28a791
56 changed files with 244 additions and 244 deletions

View File

@ -357,9 +357,9 @@ var StarUI = {
return;
if (PlacesUIUtils.useAsyncTransactions) {
this._batchBlockingDeferred = PromiseUtils.defer();
PlacesTransactions.batch(async function() {
PlacesTransactions.batch(async () => {
await this._batchBlockingDeferred.promise;
}.bind(this));
});
} else {
PlacesUtils.transactionManager.beginBatch(null);
}

View File

@ -245,7 +245,7 @@ CustomizeMode.prototype = {
let resetButton = this.document.getElementById("customization-reset-button");
resetButton.setAttribute("disabled", "true");
(async function() {
(async () => {
// We shouldn't start customize mode until after browser-delayed-startup has finished:
if (!this.window.gBrowserInit.delayedStartupFinished) {
await new Promise(resolve => {
@ -404,7 +404,7 @@ CustomizeMode.prototype = {
if (!this._wantToBeInCustomizeMode) {
this.exit();
}
}.bind(this))().then(null, e => {
})().then(null, e => {
log.error("Error entering customize mode", e);
// We should ensure this has been called, and calling it again doesn't hurt:
window.PanelUI.endBatchUpdate();
@ -481,7 +481,7 @@ CustomizeMode.prototype = {
this._transitioning = true;
(async function() {
(async () => {
await this.depopulatePalette();
await this._doTransition(false);
@ -574,7 +574,7 @@ CustomizeMode.prototype = {
if (this._wantToBeInCustomizeMode) {
this.enter();
}
}.bind(this))().then(null, e => {
})().then(null, e => {
log.error("Error exiting customize mode", e);
if (!gPhotonStructure) {
// We should ensure this has been called, and calling it again doesn't hurt:
@ -816,7 +816,7 @@ CustomizeMode.prototype = {
},
depopulatePalette() {
return (async function() {
return (async () => {
this.visiblePalette.hidden = true;
let paletteChild = this.visiblePalette.firstChild;
let nextChild;
@ -842,7 +842,7 @@ CustomizeMode.prototype = {
}
this.visiblePalette.hidden = false;
this.window.gNavToolbox.palette = this._stowedPalette;
}.bind(this))().then(null, log.error);
})().then(null, log.error);
},
isCustomizableItem(aNode) {
@ -1115,7 +1115,7 @@ CustomizeMode.prototype = {
},
_unwrapToolbarItems() {
return (async function() {
return (async () => {
for (let target of this.areas) {
for (let toolbarItem of target.children) {
if (this.isWrappedToolbarItem(toolbarItem)) {
@ -1125,7 +1125,7 @@ CustomizeMode.prototype = {
this._removeDragHandlers(target);
}
this.areas.clear();
}.bind(this))().then(null, log.error);
})().then(null, log.error);
},
_removeExtraToolbarsIfEmpty() {
@ -1159,7 +1159,7 @@ CustomizeMode.prototype = {
let btn = this.document.getElementById("customization-reset-button");
BrowserUITelemetry.countCustomizationEvent("reset");
btn.disabled = true;
return (async function() {
return (async () => {
this._removePanelCustomizationPlaceholders();
await this.depopulatePalette();
await this._unwrapToolbarItems();
@ -1181,13 +1181,13 @@ CustomizeMode.prototype = {
if (!this._wantToBeInCustomizeMode) {
this.exit();
}
}.bind(this))().then(null, log.error);
})().then(null, log.error);
},
undoReset() {
this.resetting = true;
return (async function() {
return (async () => {
this._removePanelCustomizationPlaceholders();
await this.depopulatePalette();
await this._unwrapToolbarItems();
@ -1205,7 +1205,7 @@ CustomizeMode.prototype = {
this._updateUndoResetButton();
this._updateEmptyPaletteNotice();
this.resetting = false;
}.bind(this))().then(null, log.error);
})().then(null, log.error);
},
_onToolbarVisibilityChange(aEvent) {

View File

@ -360,7 +360,7 @@ this.PanelMultiView = class {
showSubView(aViewId, aAnchor, aPreviousView, aAdopted = false) {
const {document, window} = this;
return (async function() {
return (async () => {
// Support passing in the node directly.
let viewNode = typeof aViewId == "string" ? this.node.querySelector("#" + aViewId) : aViewId;
if (!viewNode) {
@ -577,7 +577,7 @@ this.PanelMultiView = class {
subtree: true
});
}
}.bind(this))();
})();
}
_setViewContainerHeight(aHeight) {

View File

@ -407,7 +407,7 @@ const PanelUI = {
this._isReady = true;
return this._readyPromise;
}
this._readyPromise = (async function() {
this._readyPromise = (async () => {
if (!this._initialized) {
await new Promise(resolve => {
let delayedStartupObserver = (aSubject, aTopic, aData) => {
@ -455,7 +455,7 @@ const PanelUI = {
this._updateQuitTooltip();
this.panel.hidden = false;
this._isReady = true;
}.bind(this))().then(null, Cu.reportError);
})().then(null, Cu.reportError);
return this._readyPromise;
},

View File

@ -447,7 +447,7 @@ class ViewPopup extends BasePopup {
* should be closed, or `true` otherwise.
*/
attach(viewNode) {
return (async function() {
return (async () => {
this.viewNode = viewNode;
this.viewNode.addEventListener(this.DESTROY_EVENT, this);
@ -529,7 +529,7 @@ class ViewPopup extends BasePopup {
this.browser.dispatchEvent(event);
return true;
}.bind(this))();
})();
}
destroy() {

View File

@ -118,7 +118,7 @@ class DevToolsPage extends HiddenExtensionPage {
}
build() {
return (async function() {
return (async () => {
await this.createBrowserElement();
// Listening to new proxy contexts.
@ -147,7 +147,7 @@ class DevToolsPage extends HiddenExtensionPage {
this.browser.loadURI(this.url);
await this.waitForTopLevelContext;
}.bind(this))();
})();
}
close() {

View File

@ -109,7 +109,7 @@ Bookmarks.prototype = {
},
migrate(aCallback) {
return (async function() {
return (async () => {
let idToGuid = new Map();
let folderGuid = PlacesUtils.bookmarks.toolbarGuid;
if (!MigrationUtils.isStartupMigration) {
@ -175,7 +175,7 @@ Bookmarks.prototype = {
} finally {
await connection.close();
}
}.bind(this))().then(() => aCallback(true),
})().then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
}
};

View File

@ -363,7 +363,7 @@ Bookmarks.prototype = {
},
migrate: function B_migrate(aCallback) {
return (async function() {
return (async () => {
// Import to the bookmarks menu.
let folderGuid = PlacesUtils.bookmarks.menuGuid;
if (!MigrationUtils.isStartupMigration) {
@ -371,7 +371,7 @@ Bookmarks.prototype = {
await MigrationUtils.createImportedBookmarksFolder(this.importedAppLabel, folderGuid);
}
await this._migrateFolder(this._favoritesFolder, folderGuid);
}.bind(this))().then(() => aCallback(true),
})().then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
},

View File

@ -35,7 +35,7 @@ Bookmarks.prototype = {
type: MigrationUtils.resourceTypes.BOOKMARKS,
migrate: function B_migrate(aCallback) {
return (async function() {
return (async () => {
let dict = await new Promise(resolve =>
PropertyListUtils.read(this._file, resolve)
);
@ -48,7 +48,7 @@ Bookmarks.prototype = {
let collection = dict.get("Title") == "com.apple.ReadingList" ?
this.READING_LIST_COLLECTION : this.ROOT_COLLECTION;
await this._migrateCollection(children, collection);
}.bind(this))().then(() => aCallback(true),
})().then(() => aCallback(true),
e => { Cu.reportError(e); aCallback(false) });
},

View File

@ -29,7 +29,7 @@ SearchProvider.prototype = {
// all other topics are not relevant to content searches and can be
// ignored by NewTabSearchProvider
if (data === "engine-current" && topic === CURRENT_ENGINE) {
(async function() {
(async () => {
try {
let state = await ContentSearch.currentStateObj(true);
let engine = state.currentEngine;
@ -37,7 +37,7 @@ SearchProvider.prototype = {
} catch (e) {
Cu.reportError(e);
}
}.bind(this))();
})();
}
},

View File

@ -1496,7 +1496,7 @@ BrowserGlue.prototype = {
() => BookmarkHTMLUtils.exportToFile(BookmarkHTMLUtils.defaultPath));
}
(async function() {
(async () => {
// Check if Safe Mode or the user has required to restore bookmarks from
// default profile's bookmarks.html
let restoreDefaultBookmarks = false;
@ -1631,7 +1631,7 @@ BrowserGlue.prototype = {
this._idleService.addIdleObserver(this, this._bookmarksBackupIdleTime);
}
}.bind(this))().catch(ex => {
})().catch(ex => {
Cu.reportError(ex);
}).then(() => {
// NB: deliberately after the catch so that we always do this, even if

View File

@ -380,9 +380,9 @@ var BookmarkPropertiesPanel = {
return;
if (PlacesUIUtils.useAsyncTransactions) {
this._batchBlockingDeferred = PromiseUtils.defer();
PlacesTransactions.batch(async function() {
PlacesTransactions.batch(async () => {
await this._batchBlockingDeferred.promise;
}.bind(this));
});
} else {
PlacesUtils.transactionManager.beginBatch(null);
}

View File

@ -799,11 +799,11 @@ var gEditItemOverlay = {
if (PlacesUtils.bookmarks.getFolderIdForItem(this._paneInfo.itemId) != containerId &&
this._paneInfo.itemId != containerId) {
if (PlacesUIUtils.useAsyncTransactions) {
(async function() {
(async () => {
let newParentGuid = await PlacesUtils.promiseItemGuid(containerId);
let guid = this._paneInfo.itemGuid;
await PlacesTransactions.Move({ guid, newParentGuid }).transact();
}.bind(this))();
})();
} else {
let txn = new PlacesMoveItemTransaction(this._paneInfo.itemId,
containerId,

View File

@ -45,7 +45,7 @@ var gMoveBookmarksDialog = {
return;
}
PlacesTransactions.batch(async function() {
PlacesTransactions.batch(async () => {
let newParentGuid = await PlacesUtils.promiseItemGuid(selectedFolderId);
for (let node of this._nodes) {
// Nothing to do if the node is already under the selected folder.
@ -54,7 +54,7 @@ var gMoveBookmarksDialog = {
await PlacesTransactions.Move({ guid: node.bookmarkGuid
, newParentGuid }).transact();
}
}.bind(this)).then(null, Components.utils.reportError);
}).then(null, Components.utils.reportError);
},
newFolder: function MBD_newFolder() {

View File

@ -58,7 +58,7 @@ this.BingTranslator.prototype = {
* task is finished.
*/
translate() {
return (async function() {
return (async () => {
let currentIndex = 0;
this._onFinishedDeferred = Promise.defer();
@ -90,7 +90,7 @@ this.BingTranslator.prototype = {
}
return this._onFinishedDeferred.promise;
}.bind(this))();
})();
},
/**
@ -285,7 +285,7 @@ BingRequest.prototype = {
* Initiates the request
*/
fireRequest() {
return (async function() {
return (async () => {
// Prepare authentication.
let token = await BingTokenManager.getToken();
let auth = "Bearer " + token;
@ -337,7 +337,7 @@ BingRequest.prototype = {
request.overrideMimeType("text/xml");
this.networkRequest = request;
return deferred.promise;
}.bind(this))();
})();
}
};

View File

@ -208,7 +208,7 @@ this.TranslationDocument.prototype = {
* or "original".
*/
_swapDocumentContent(target) {
(async function() {
(async () => {
// Let the event loop breath on every 100 nodes
// that are replaced.
const YIELD_INTERVAL = 100;
@ -221,7 +221,7 @@ this.TranslationDocument.prototype = {
await CommonUtils.laterTickResolvingPromise();
}
}
}.bind(this))();
})();
}
};

View File

@ -76,7 +76,7 @@ this.YandexTranslator.prototype = {
* task is finished.
*/
translate() {
return (async function() {
return (async () => {
let currentIndex = 0;
this._onFinishedDeferred = Promise.defer();
@ -108,7 +108,7 @@ this.YandexTranslator.prototype = {
}
return this._onFinishedDeferred.promise;
}.bind(this))();
})();
},
/**
@ -292,7 +292,7 @@ YandexRequest.prototype = {
* Initiates the request
*/
fireRequest() {
return (async function() {
return (async () => {
// Prepare URL.
let url = getUrlParam("https://translate.yandex.net/api/v1.5/tr.json/translate",
"browser.translation.yandex.translateURLOverride");
@ -326,7 +326,7 @@ YandexRequest.prototype = {
this.networkRequest = httpRequest(url, options);
return deferred.promise;
}.bind(this))();
})();
}
};

View File

@ -1881,7 +1881,7 @@ this.UITour = {
},
getAvailableTargets(aMessageManager, aChromeWindow, aCallbackID) {
(async function() {
(async () => {
let window = aChromeWindow;
let data = this.availableTargetsCache.get(window);
if (data) {
@ -1907,7 +1907,7 @@ this.UITour = {
};
this.availableTargetsCache.set(window, data);
this.sendPageCallback(aMessageManager, aCallbackID, data);
}.bind(this))().catch(err => {
})().catch(err => {
log.error(err);
this.sendPageCallback(aMessageManager, aCallbackID, {
targets: [],

View File

@ -615,7 +615,7 @@ Experiments.Experiments.prototype = {
* @return Promise<Array<ExperimentInfo>> Array of experiment info objects.
*/
getExperiments() {
return (async function() {
return (async () => {
await this._loadTask;
let list = [];
@ -639,7 +639,7 @@ Experiments.Experiments.prototype = {
// Sort chronologically, descending.
list.sort((a, b) => b.endDate - a.endDate);
return list;
}.bind(this))();
})();
},
/**
@ -733,7 +733,7 @@ Experiments.Experiments.prototype = {
* @return Promise<object>
*/
lastActiveToday() {
return (async function getMostRecentActiveExperimentTask() {
return (async () => {
let experiments = await this.getExperiments();
// Assumption: Ordered chronologically, descending, with active always
@ -748,14 +748,14 @@ Experiments.Experiments.prototype = {
}
}
return null;
}.bind(this))();
})();
},
_run() {
this._log.trace("_run");
this._checkForShutdown();
if (!this._mainTask) {
this._mainTask = (async function() {
this._mainTask = (async () => {
try {
await this._main();
} catch (e) {
@ -776,7 +776,7 @@ Experiments.Experiments.prototype = {
throw ex;
}
}
}.bind(this))();
})();
}
return this._mainTask;
},

View File

@ -350,7 +350,7 @@ this.ContentSearch = {
let event = this._eventQueue.shift();
this._currentEventPromise = (async function() {
this._currentEventPromise = (async () => {
try {
await this["_on" + event.type](event.data);
} catch (err) {
@ -359,7 +359,7 @@ this.ContentSearch = {
this._currentEventPromise = null;
this._processEventQueue();
}
}.bind(this))();
})();
},
_cancelSuggestions(msg) {

View File

@ -330,7 +330,7 @@ var DirectoryLinksProvider = {
this._directoryFilePath = OS.Path.join(OS.Constants.Path.localProfileDir, DIRECTORY_LINKS_FILE);
this._lastDownloadMS = 0;
return (async function() {
return (async () => {
// get the last modified time of the links file if it exists
let doesFileExists = await OS.File.exists(this._directoryFilePath);
if (doesFileExists) {
@ -339,7 +339,7 @@ var DirectoryLinksProvider = {
}
// fetch directory on startup without force
await this._fetchAndCacheLinksIfNecessary();
}.bind(this))();
})();
},
/**

View File

@ -326,7 +326,7 @@ this.CrashManager.prototype = Object.freeze({
return this._aggregatePromise;
}
return this._aggregatePromise = (async function() {
return this._aggregatePromise = (async () => {
if (this._aggregatePromise) {
return this._aggregatePromise;
}
@ -394,7 +394,7 @@ this.CrashManager.prototype = Object.freeze({
this._aggregatePromise = false;
this._storeProtectedCount--;
}
}.bind(this))();
})();
},
/**
@ -405,23 +405,23 @@ this.CrashManager.prototype = Object.freeze({
* than this will be pruned.
*/
pruneOldCrashes(date) {
return (async function() {
return (async () => {
let store = await this._getStore();
store.pruneOldCrashes(date);
await store.save();
}.bind(this))();
})();
},
/**
* Run tasks that should be periodically performed.
*/
runMaintenanceTasks() {
return (async function() {
return (async () => {
await this.aggregateEventsFiles();
let offset = this.PURGE_OLDER_THAN_DAYS * MILLISECONDS_IN_DAY;
await this.pruneOldCrashes(new Date(Date.now() - offset));
}.bind(this))();
})();
},
/**
@ -455,7 +455,7 @@ this.CrashManager.prototype = Object.freeze({
* @return promise<null> Resolved when the store has been saved.
*/
addCrash(processType, crashType, id, date, metadata) {
let promise = (async function() {
let promise = (async () => {
let store = await this._getStore();
if (store.addCrash(processType, crashType, id, date, metadata)) {
await store.save();
@ -473,7 +473,7 @@ this.CrashManager.prototype = Object.freeze({
processType === this.PROCESS_TYPE_GPU) {
this._sendCrashPing(id, processType, date, metadata);
}
}.bind(this))();
})();
return promise;
},
@ -578,7 +578,7 @@ this.CrashManager.prototype = Object.freeze({
* The promise-resolved array is sorted by file mtime, oldest to newest.
*/
_getUnprocessedEventsFiles() {
return (async function() {
return (async () => {
let entries = [];
for (let dir of this._eventsDirs) {
@ -590,12 +590,12 @@ this.CrashManager.prototype = Object.freeze({
entries.sort((a, b) => { return a.date - b.date; });
return entries;
}.bind(this))();
})();
},
// See docs/crash-events.rst for the file format specification.
_processEventFile(entry) {
return (async function() {
return (async () => {
let data = await OS.File.read(entry.path);
let store = await this._getStore();
@ -630,7 +630,7 @@ this.CrashManager.prototype = Object.freeze({
let payload = data.substring(start);
return this._handleEventFilePayload(store, entry, type, date, payload);
}.bind(this))();
})();
},
_filterAnnotations(annotations) {
@ -793,7 +793,7 @@ this.CrashManager.prototype = Object.freeze({
return this._getStoreTask;
}
return this._getStoreTask = (async function() {
return this._getStoreTask = (async () => {
try {
if (!this._store) {
await OS.File.makeDir(this._storeDir, {
@ -840,7 +840,7 @@ this.CrashManager.prototype = Object.freeze({
} finally {
this._getStoreTask = null;
}
}.bind(this))();
})();
},
/**
@ -849,19 +849,19 @@ this.CrashManager.prototype = Object.freeze({
* Returns an array of CrashRecord instances. Instances are read-only.
*/
getCrashes() {
return (async function() {
return (async () => {
let store = await this._getStore();
return store.crashes;
}.bind(this))();
})();
},
getCrashCountsByDay() {
return (async function() {
return (async () => {
let store = await this._getStore();
return store._countsByDay;
}.bind(this))();
})();
},
});
@ -934,7 +934,7 @@ CrashStore.prototype = Object.freeze({
* @return Promise
*/
load() {
return (async function() {
return (async () => {
// Loading replaces data.
this.reset();
@ -1025,7 +1025,7 @@ CrashStore.prototype = Object.freeze({
this._data.corruptDate = new Date();
}
}
}.bind(this))();
})();
},
/**
@ -1034,7 +1034,7 @@ CrashStore.prototype = Object.freeze({
* @return Promise<null>
*/
save() {
return (async function() {
return (async () => {
if (!this._data) {
return;
}
@ -1089,7 +1089,7 @@ CrashStore.prototype = Object.freeze({
if (this._telemetrySizeKey) {
Services.telemetry.getHistogramById(this._telemetrySizeKey).add(size);
}
}.bind(this))();
})();
},
/**

View File

@ -317,7 +317,7 @@ this.ExtensionData = class {
}
readDirectory(path) {
return (async function() {
return (async () => {
if (this.rootURI instanceof Ci.nsIFileURL) {
let uri = NetUtil.newURI(this.rootURI.resolve("./" + path));
let fullPath = uri.QueryInterface(Ci.nsIFileURL).file.path;
@ -378,7 +378,7 @@ this.ExtensionData = class {
} finally {
zipReader.close();
}
}.bind(this))();
})();
}
readJSON(path) {
@ -570,7 +570,7 @@ this.ExtensionData = class {
// Reads the locale file for the given Gecko-compatible locale code, and
// stores its parsed contents in |this.localeMessages.get(locale)|.
readLocaleFile(locale) {
return (async function() {
return (async () => {
let locales = await this.promiseLocales();
let dir = locales.get(locale) || locale;
let file = `_locales/${dir}/messages.json`;
@ -582,7 +582,7 @@ this.ExtensionData = class {
this.packagingError(`Loading locale file ${file}: ${e}`);
return new Map();
}
}.bind(this))();
})();
}
// Reads the list of locales available in the extension, and returns a
@ -593,7 +593,7 @@ this.ExtensionData = class {
// Map(gecko-locale-code -> locale-directory-name)
promiseLocales() {
if (!this._promiseLocales) {
this._promiseLocales = (async function() {
this._promiseLocales = (async () => {
let locales = new Map();
let entries = await this.readDirectory("_locales");
@ -611,7 +611,7 @@ this.ExtensionData = class {
});
return locales;
}.bind(this))();
})();
}
return this._promiseLocales;
@ -622,7 +622,7 @@ this.ExtensionData = class {
// is a Gecko-compatible locale code, and each value is a locale data object
// as returned by |readLocaleFile|.
initAllLocales() {
return (async function() {
return (async () => {
let locales = await this.promiseLocales();
await Promise.all(Array.from(locales.keys(),
@ -641,7 +641,7 @@ this.ExtensionData = class {
}
return this.localeData.messages;
}.bind(this))();
})();
}
// Reads the locale file for the given Gecko-compatible locale code, or the
@ -653,7 +653,7 @@ this.ExtensionData = class {
//
// If no locales are unavailable, resolves to |null|.
initLocale(locale = this.defaultLocale) {
return (async function() {
return (async () => {
if (locale == null) {
return null;
}
@ -669,7 +669,7 @@ this.ExtensionData = class {
this.localeData.selectedLocale = locale;
return results[0];
}.bind(this))();
})();
}
};

View File

@ -21,7 +21,7 @@ const RequestAutocompleteDialog = {
autofillData: null,
onLoad() {
(async function() {
(async () => {
let args = window.arguments[0].wrappedJSObject;
this.resolveFn = args.resolveFn;
this.autofillData = args.autofillData;
@ -30,7 +30,7 @@ const RequestAutocompleteDialog = {
Services.obs.notifyObservers(window,
"formautofill-window-initialized");
}.bind(this))().catch(Cu.reportError);
})().catch(Cu.reportError);
},
onAccept() {

View File

@ -428,7 +428,7 @@ this.Download.prototype = {
// Now that we stored the promise in the download object, we can start the
// task that will actually execute the download.
deferAttempt.resolve((async function task_D_start() {
deferAttempt.resolve((async () => {
// Wait upon any pending operation before restarting.
if (this._promiseCanceled) {
await this._promiseCanceled;
@ -554,7 +554,7 @@ this.Download.prototype = {
}
}
}
}.bind(this))());
})());
// Notify the new download state before returning.
this._notifyChange();
@ -629,7 +629,7 @@ this.Download.prototype = {
"unblock may only be called on Downloads with blocked data."));
}
this._promiseUnblock = (async function() {
this._promiseUnblock = (async () => {
try {
await OS.File.move(this.target.partFilePath, this.target.path);
await this.target.refresh();
@ -643,7 +643,7 @@ this.Download.prototype = {
this.hasBlockedData = false;
this._notifyChange();
await this._succeed();
}.bind(this))();
})();
return this._promiseUnblock;
},
@ -673,7 +673,7 @@ this.Download.prototype = {
"confirmBlock may only be called on Downloads with blocked data."));
}
this._promiseConfirmBlock = (async function() {
this._promiseConfirmBlock = (async () => {
try {
await OS.File.remove(this.target.partFilePath);
} catch (ex) {
@ -684,7 +684,7 @@ this.Download.prototype = {
this.hasBlockedData = false;
this._notifyChange();
}.bind(this))();
})();
return this._promiseConfirmBlock;
},
@ -849,7 +849,7 @@ this.Download.prototype = {
this._promiseRemovePartialData = promiseRemovePartialData;
deferRemovePartialData.resolve(
(async function task_D_removePartialData() {
(async () => {
try {
// Wait upon any pending cancellation request.
if (this._promiseCanceled) {
@ -866,7 +866,7 @@ this.Download.prototype = {
} finally {
this._promiseRemovePartialData = null;
}
}.bind(this))());
})());
}
return promiseRemovePartialData;
@ -910,7 +910,7 @@ this.Download.prototype = {
* @rejects Never.
*/
refresh() {
return (async function() {
return (async () => {
if (!this.stopped || this._finalized) {
return;
}
@ -959,7 +959,7 @@ this.Download.prototype = {
this._notifyChange();
}
}.bind(this))().then(null, Cu.reportError);
})().then(null, Cu.reportError);
},
/**
@ -1892,7 +1892,7 @@ this.DownloadCopySaver.prototype = {
let partFilePath = download.target.partFilePath;
let keepPartialData = download.tryToKeepPartialData;
return (async function task_DCS_execute() {
return (async () => {
// Add the download to history the first time it is started in this
// session. If the download is restarted in a different session, a new
// history visit will be added. We do this just to avoid the complexity
@ -2165,7 +2165,7 @@ this.DownloadCopySaver.prototype = {
}
throw ex;
}
}.bind(this))();
})();
},
/**
@ -2233,7 +2233,7 @@ this.DownloadCopySaver.prototype = {
* Implements "DownloadSaver.removePartialData".
*/
removePartialData() {
return (async function task_DCS_removePartialData() {
return (async () => {
if (this.download.target.partFilePath) {
try {
await OS.File.remove(this.download.target.partFilePath);
@ -2243,7 +2243,7 @@ this.DownloadCopySaver.prototype = {
}
}
}
}.bind(this))();
})();
},
/**
@ -2496,7 +2496,7 @@ this.DownloadLegacySaver.prototype = {
this.onProgressBytes(this.currentBytes, this.totalBytes);
}
return (async function task_DLS_execute() {
return (async () => {
try {
// Wait for the component that executes the download to finish.
await this.deferExecuted.promise;
@ -2564,7 +2564,7 @@ this.DownloadLegacySaver.prototype = {
// Allow the download to restart through a DownloadCopySaver.
this.firstExecutionFinished = true;
}
}.bind(this))();
})();
},
_checkReputationAndMove() {
@ -2702,7 +2702,7 @@ this.DownloadPDFSaver.prototype = {
* Implements "DownloadSaver.execute".
*/
execute(aSetProgressBytesFn, aSetPropertiesFn) {
return (async function task_DCS_execute() {
return (async () => {
if (!this.download.source.windowRef) {
throw new DownloadError({
message: "PDF saver must be passed an open window, and cannot be restarted.",
@ -2782,7 +2782,7 @@ this.DownloadPDFSaver.prototype = {
let fileInfo = await OS.File.stat(targetPath);
aSetProgressBytesFn(fileInfo.size, fileInfo.size, false);
}.bind(this))();
})();
},
/**

View File

@ -66,7 +66,7 @@ this.DownloadImport.prototype = {
* the DownloadList)
*/
import() {
return (async function task_DI_import() {
return (async () => {
let connection = await Sqlite.openConnection({ path: this.path });
try {
@ -184,7 +184,7 @@ this.DownloadImport.prototype = {
} finally {
await connection.close();
}
}.bind(this))();
})();
}
}

View File

@ -226,7 +226,7 @@ this.DownloadList.prototype = {
* additional filter.
*/
removeFinished: function DL_removeFinished(aFilterFn) {
(async function() {
(async () => {
let list = await this.getAll();
for (let download of list) {
// Remove downloads that have been canceled, even if the cancellation
@ -244,7 +244,7 @@ this.DownloadList.prototype = {
download.finalize(true).then(null, Cu.reportError);
}
}
}.bind(this))().then(null, Cu.reportError);
})().then(null, Cu.reportError);
},
};

View File

@ -97,7 +97,7 @@ this.DownloadStore.prototype = {
* @rejects JavaScript exception.
*/
load: function DS_load() {
return (async function task_DS_load() {
return (async () => {
let bytes;
try {
bytes = await OS.File.read(this.path);
@ -136,7 +136,7 @@ this.DownloadStore.prototype = {
Cu.reportError(ex);
}
}
}.bind(this))();
})();
},
/**
@ -149,7 +149,7 @@ this.DownloadStore.prototype = {
* @rejects JavaScript exception.
*/
save: function DS_save() {
return (async function task_DS_save() {
return (async () => {
let downloads = await this.list.getAll();
// Take a static snapshot of the current state of all the downloads.
@ -193,6 +193,6 @@ this.DownloadStore.prototype = {
// file error if the file existed before, and was recently deleted.
}
}
}.bind(this))();
})();
},
};

View File

@ -169,7 +169,7 @@ this.Downloads = {
*/
getList(aType) {
if (!this._promiseListsInitialized) {
this._promiseListsInitialized = (async function() {
this._promiseListsInitialized = (async () => {
let publicList = new DownloadList();
let privateList = new DownloadList();
let combinedList = new DownloadCombinedList(publicList, privateList);
@ -193,7 +193,7 @@ this.Downloads = {
this._lists[Downloads.PUBLIC] = publicList;
this._lists[Downloads.PRIVATE] = privateList;
this._lists[Downloads.ALL] = combinedList;
}.bind(this))();
})();
}
return this._promiseListsInitialized.then(() => this._lists[aType]);

View File

@ -279,7 +279,7 @@ var Scheduler = this.Scheduler = {
let savedQueue = this.queue;
this.queue = deferred.promise;
return this._killQueue = (async function() {
return this._killQueue = (async () => {
await killQueue;
// From this point, and until the end of the Task, we are the
@ -359,7 +359,7 @@ var Scheduler = this.Scheduler = {
deferred.resolve();
}
}.bind(this))();
})();
},
/**
@ -404,7 +404,7 @@ var Scheduler = this.Scheduler = {
}
Scheduler.Debugging.messagesQueued++;
return this.push(async function() {
return this.push(async () => {
if (this.shutdown) {
LOG("OS.File is not available anymore. The following request has been rejected.",
method, args);
@ -440,7 +440,7 @@ var Scheduler = this.Scheduler = {
}
Scheduler.restartTimer();
}
}.bind(this));
});
},
/**

View File

@ -400,14 +400,14 @@ var LoginManagerContent = {
log("Creating a DeferredTask to call _fetchLoginsFromParentAndFillForm soon");
this._formLikeByRootElement.set(formLike.rootElement, formLike);
deferredTask = new DeferredTask(function deferredInputProcessing() {
deferredTask = new DeferredTask(() => {
// Get the updated formLike instead of the one at the time of creating the DeferredTask via
// a closure since it could be stale since FormLike.elements isn't live.
let formLike2 = this._formLikeByRootElement.get(formLike.rootElement);
log("Running deferred processing of onDOMInputPasswordAdded", formLike2);
this._deferredPasswordAddedTasksByRootElement.delete(formLike2.rootElement);
this._fetchLoginsFromParentAndFillForm(formLike2, window);
}.bind(this), PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS);
}, PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS);
this._deferredPasswordAddedTasksByRootElement.set(formLike.rootElement, deferredTask);
}

View File

@ -163,13 +163,13 @@ LoginManager.prototype = {
delete this._pwmgr._prefBranch;
this._pwmgr = null;
} else if (topic == "passwordmgr-storage-replace") {
(async function() {
(async () => {
await this._pwmgr._storage.terminate();
this._pwmgr._initStorage();
await this._pwmgr.initializationPromise;
Services.obs.notifyObservers(null,
"passwordmgr-storage-replace-complete");
}.bind(this))();
})();
} else if (topic == "gather-telemetry") {
// When testing, the "data" parameter is a string containing the
// reference time in milliseconds for time-based statistics.

View File

@ -51,7 +51,7 @@ this.LoginManagerStorage_json.prototype = {
"logins.json");
this._store = new LoginStore(jsonPath);
return (async function() {
return (async () => {
// Load the data asynchronously.
this.log("Opening database at", this._store.path);
await this._store.load();
@ -83,7 +83,7 @@ this.LoginManagerStorage_json.prototype = {
// We won't attempt import again on next startup.
Services.prefs.setBoolPref("signon.importedFromSqlite", true);
}.bind(this))().catch(Cu.reportError);
})().catch(Cu.reportError);
} catch (e) {
this.log("Initialization failed:", e);
throw new Error("Initialization failed");

View File

@ -1003,7 +1003,7 @@ function BookmarkExporter(aBookmarksTree) {
BookmarkExporter.prototype = {
exportToFile: function exportToFile(aFilePath) {
return (async function() {
return (async () => {
// Create a file that can be accessed by the current user only.
let out = FileUtils.openAtomicFileOutputStream(new FileUtils.File(aFilePath));
try {
@ -1031,7 +1031,7 @@ BookmarkExporter.prototype = {
} finally {
out.close();
}
}.bind(this))();
})();
},
_converterOut: null,

View File

@ -177,7 +177,7 @@ var Bookmarks = Object.freeze({
, source: { defaultValue: this.SOURCES.DEFAULT }
});
return (async function() {
return (async () => {
// Ensure the parent exists.
let parent = await fetchBookmark({ guid: insertInfo.parentGuid });
if (!parent)
@ -221,7 +221,7 @@ var Bookmarks = Object.freeze({
// Remove non-enumerable properties.
delete item.source;
return Object.assign({}, item);
}.bind(this))();
})();
},
@ -455,7 +455,7 @@ var Bookmarks = Object.freeze({
if (Object.keys(updateInfo).length < 3)
throw new Error("Not enough properties to update");
return (async function() {
return (async () => {
// Ensure the item exists.
let item = await fetchBookmark(updateInfo);
if (!item)
@ -482,7 +482,7 @@ var Bookmarks = Object.freeze({
});
return PlacesUtils.withConnectionWrapper("Bookmarks.jsm: update",
async function(db) {
async db => {
let parent;
if (updateInfo.hasOwnProperty("parentGuid")) {
if (item.type == this.TYPE_FOLDER) {
@ -586,8 +586,8 @@ var Bookmarks = Object.freeze({
// Remove non-enumerable properties.
delete updatedItem.source;
return Object.assign({}, updatedItem);
}.bind(this));
}.bind(this))();
});
})();
},
/**
@ -914,7 +914,7 @@ var Bookmarks = Object.freeze({
throw new Error("Invalid GUID found in the sorted children array.");
}
return (async function() {
return (async () => {
let parent = await fetchBookmark(info);
if (!parent || parent.type != this.TYPE_FOLDER)
throw new Error("No folder found for the provided GUID.");
@ -934,7 +934,7 @@ var Bookmarks = Object.freeze({
child.parentGuid,
source ]);
}
}.bind(this))();
})();
},
/**

View File

@ -123,7 +123,7 @@ this.PlacesBackups = {
* @resolve the folder (the folder string path).
*/
getBackupFolder: function PB_getBackupFolder() {
return (async function() {
return (async () => {
if (this._backupFolder) {
return this._backupFolder;
}
@ -131,7 +131,7 @@ this.PlacesBackups = {
let backupsDirPath = OS.Path.join(profileDir, this.profileRelativeFolderPath);
await OS.File.makeDir(backupsDirPath, { ignoreExisting: true });
return this._backupFolder = backupsDirPath;
}.bind(this))();
})();
},
get profileRelativeFolderPath() {
@ -183,7 +183,7 @@ this.PlacesBackups = {
* @resolve a sorted array of string paths.
*/
getBackupFiles: function PB_getBackupFiles() {
return (async function() {
return (async () => {
if (this._backupFiles)
return this._backupFiles;
@ -219,7 +219,7 @@ this.PlacesBackups = {
});
return this._backupFiles;
}.bind(this))();
})();
},
/**
@ -301,7 +301,7 @@ this.PlacesBackups = {
* @result the path to the file.
*/
getMostRecentBackup: function PB_getMostRecentBackup() {
return (async function() {
return (async () => {
let entries = await this.getBackupFiles();
for (let entry of entries) {
let rx = /\.json(lz4)?$/;
@ -310,7 +310,7 @@ this.PlacesBackups = {
}
}
return null;
}.bind(this))();
})();
},
/**
@ -331,7 +331,7 @@ this.PlacesBackups = {
"https://developer.mozilla.org/docs/JavaScript_OS.File");
aFilePath = aFilePath.path;
}
return (async function() {
return (async () => {
let { count: nodeCount, hash: hash } =
await BookmarkJSONUtils.exportToFile(aFilePath);
@ -379,7 +379,7 @@ this.PlacesBackups = {
}
return nodeCount;
}.bind(this))();
})();
},
/**
@ -398,7 +398,7 @@ this.PlacesBackups = {
* @return {Promise}
*/
create: function PB_create(aMaxBackups, aForceBackup) {
let limitBackups = async function() {
let limitBackups = async () => {
let backupFiles = await this.getBackupFiles();
if (typeof aMaxBackups == "number" && aMaxBackups > -1 &&
backupFiles.length >= aMaxBackups) {
@ -409,9 +409,9 @@ this.PlacesBackups = {
await OS.File.remove(oldestBackup);
}
}
}.bind(this);
};
return (async function() {
return (async () => {
if (aMaxBackups === 0) {
// Backups are disabled, delete any existing one and bail out.
await limitBackups(0);
@ -480,7 +480,7 @@ this.PlacesBackups = {
// Limit the number of backups.
await limitBackups(aMaxBackups);
}.bind(this))();
})();
},
/**

View File

@ -515,7 +515,7 @@ var TransactionsManager = {
// sameTxn.transact(); sameTxn.transact();
this._executedTransactions.add(rawTxn);
let promise = this._transactEnqueuer.enqueue(async function() {
let promise = this._transactEnqueuer.enqueue(async () => {
// Don't try to catch exceptions. If execute fails, we better not add the
// transaction to the undo stack.
let retval = await rawTxn.execute();
@ -527,13 +527,13 @@ var TransactionsManager = {
this._updateCommandsOnActiveWindow();
return retval;
}.bind(this));
});
this._mainEnqueuer.alsoWaitFor(promise);
return promise;
},
batch(aTask) {
return this._mainEnqueuer.enqueue(async function() {
return this._mainEnqueuer.enqueue(async () => {
this._batching = true;
this._createdBatchEntry = false;
let rv;
@ -545,14 +545,14 @@ var TransactionsManager = {
this._createdBatchEntry = false;
}
return rv;
}.bind(this));
});
},
/**
* Undo the top undo entry, if any, and update the undo position accordingly.
*/
undo() {
let promise = this._mainEnqueuer.enqueue(async function() {
let promise = this._mainEnqueuer.enqueue(async () => {
let entry = TransactionsHistory.topUndoEntry;
if (!entry)
return;
@ -571,7 +571,7 @@ var TransactionsManager = {
}
TransactionsHistory._undoPosition++;
this._updateCommandsOnActiveWindow();
}.bind(this));
});
this._transactEnqueuer.alsoWaitFor(promise);
return promise;
},
@ -580,7 +580,7 @@ var TransactionsManager = {
* Redo the top redo entry, if any, and update the undo position accordingly.
*/
redo() {
let promise = this._mainEnqueuer.enqueue(async function() {
let promise = this._mainEnqueuer.enqueue(async () => {
let entry = TransactionsHistory.topRedoEntry;
if (!entry)
return;
@ -603,7 +603,7 @@ var TransactionsManager = {
}
TransactionsHistory._undoPosition--;
this._updateCommandsOnActiveWindow();
}.bind(this));
});
this._transactEnqueuer.alsoWaitFor(promise);
return promise;

View File

@ -2558,7 +2558,7 @@ var GuidHelper = {
let uncachedGuids = aGuids.filter(guid => !this.idsForGuids.has(guid));
if (uncachedGuids.length) {
await PlacesUtils.withConnectionWrapper("GuidHelper.getItemId",
async function(db) {
async db => {
while (uncachedGuids.length) {
let chunk = uncachedGuids.splice(0, 100);
let rows = await db.executeCached(
@ -2571,7 +2571,7 @@ var GuidHelper = {
this.updateCache(row.getResultByIndex(0), row.getResultByIndex(1));
}
}
}.bind(this));
});
}
return new Map(aGuids.map(guid => [guid, this.idsForGuids.get(guid)]));
},
@ -3544,7 +3544,7 @@ PlacesEditBookmarkKeywordTransaction.prototype = {
doTransaction: function EBKTXN_doTransaction() {
let done = false;
(async function() {
(async () => {
if (this.item.keyword) {
let oldEntry = await PlacesUtils.keywords.fetch(this.item.keyword);
this.item.postData = oldEntry.postData;
@ -3558,7 +3558,7 @@ PlacesEditBookmarkKeywordTransaction.prototype = {
postData: this.new.postData || this.item.postData
});
}
}.bind(this))().catch(Cu.reportError)
})().catch(Cu.reportError)
.then(() => done = true);
// TODO: Until we can move to PlacesTransactions.jsm, we must spin the
// events loop :(
@ -3571,7 +3571,7 @@ PlacesEditBookmarkKeywordTransaction.prototype = {
undoTransaction: function EBKTXN_undoTransaction() {
let done = false;
(async function() {
(async () => {
if (this.new.keyword) {
await PlacesUtils.keywords.remove(this.new.keyword);
}
@ -3583,7 +3583,7 @@ PlacesEditBookmarkKeywordTransaction.prototype = {
postData: this.item.postData
});
}
}.bind(this))().catch(Cu.reportError)
})().catch(Cu.reportError)
.then(() => done = true);
// TODO: Until we can move to PlacesTransactions.jsm, we must spin the
// events loop :(

View File

@ -181,7 +181,7 @@ LivemarkService.prototype = {
throw new Components.Exception("Invalid arguments", Cr.NS_ERROR_INVALID_ARG);
}
return (async function() {
return (async () => {
if (!aLivemarkInfo.parentGuid)
aLivemarkInfo.parentGuid = await PlacesUtils.promiseItemGuid(aLivemarkInfo.parentId);
@ -234,7 +234,7 @@ LivemarkService.prototype = {
livemarksMap.set(folder.guid, livemark);
return livemark;
}.bind(this))();
})();
},
removeLivemark(aLivemarkInfo) {
@ -250,7 +250,7 @@ LivemarkService.prototype = {
throw new Components.Exception("Invalid arguments", Cr.NS_ERROR_INVALID_ARG);
}
return (async function() {
return (async () => {
if (!aLivemarkInfo.guid)
aLivemarkInfo.guid = await PlacesUtils.promiseItemGuid(aLivemarkInfo.id);
@ -260,7 +260,7 @@ LivemarkService.prototype = {
await PlacesUtils.bookmarks.remove(aLivemarkInfo.guid,
{ source: aLivemarkInfo.source });
}.bind(this))();
})();
},
reloadLivemarks(aForceUpdate) {
@ -293,7 +293,7 @@ LivemarkService.prototype = {
throw new Components.Exception("Invalid arguments", Cr.NS_ERROR_INVALID_ARG);
}
return (async function() {
return (async () => {
if (!aLivemarkInfo.guid)
aLivemarkInfo.guid = await PlacesUtils.promiseItemGuid(aLivemarkInfo.id);
@ -302,7 +302,7 @@ LivemarkService.prototype = {
throw new Components.Exception("Invalid livemark", Cr.NS_ERROR_INVALID_ARG);
return livemarksMap.get(aLivemarkInfo.guid);
}.bind(this))();
})();
},
// nsINavBookmarkObserver

View File

@ -922,7 +922,7 @@ nsPlacesExpiration.prototype = {
*/
_expireWithActionAndLimit:
function PEX__expireWithActionAndLimit(aAction, aLimit) {
(async function() {
(async () => {
// Ensure that we'll run statements with the most up-to-date pref values.
// On shutdown we cannot do this, since we must enqueue the expiration
// statements synchronously before the connection goes away.
@ -947,7 +947,7 @@ nsPlacesExpiration.prototype = {
// Execute statements asynchronously in a transaction.
this._db.executeAsync(boundStatements, boundStatements.length, this);
}.bind(this))().catch(Cu.reportError);
})().catch(Cu.reportError);
},
/**

View File

@ -93,7 +93,7 @@ function loadNextTest()
function test()
{
SimpleTest.waitForExplicitFinish();
(async function() {
(async () => {
await PlacesTestUtils.clearHistory();
info("Inserting new visit");
@ -127,7 +127,7 @@ function test()
// And start our test process.
loadNextTest();
}.bind(this))();
})();
}
]]>

View File

@ -3099,7 +3099,7 @@ SearchService.prototype = {
// Start by clearing the initialized state, so we don't abort early.
gInitialized = false;
(async function() {
(async () => {
try {
if (this._batchTask) {
LOG("finalizing batch task");
@ -3143,7 +3143,7 @@ SearchService.prototype = {
} finally {
Services.obs.notifyObservers(null, SEARCH_SERVICE_TOPIC, "reinit-complete");
}
}.bind(this))();
})();
},
/**
@ -4670,7 +4670,7 @@ SearchService.prototype = {
};
OS.File.profileBeforeChange.addBlocker(
"Search service: shutting down",
() => (async function() {
() => (async () => {
if (this._batchTask) {
shutdownState.step = "Finalizing batched task";
try {
@ -4689,7 +4689,7 @@ SearchService.prototype = {
Promise.reject(ex);
}
}
}.bind(this))(),
})(),
() => shutdownState
);

View File

@ -707,7 +707,7 @@ var Impl = {
// run various late initializers. Otherwise our gathered memory
// footprint and other numbers would be too optimistic.
this._delayedInitTaskDeferred = Promise.defer();
this._delayedInitTask = new DeferredTask(async function() {
this._delayedInitTask = new DeferredTask(async () => {
try {
// TODO: This should probably happen after all the delayed init here.
this._initialized = true;
@ -746,7 +746,7 @@ var Impl = {
} finally {
this._delayedInitTask = null;
}
}.bind(this), this._testMode ? TELEMETRY_TEST_DELAY : TELEMETRY_DELAY);
}, this._testMode ? TELEMETRY_TEST_DELAY : TELEMETRY_DELAY);
AsyncShutdown.sendTelemetry.addBlocker("TelemetryController: shutting down",
() => this.shutdown(),
@ -891,7 +891,7 @@ var Impl = {
return;
}
let p = (async function() {
let p = (async () => {
try {
// Clear the current pings.
await TelemetrySend.clearCurrentPings();
@ -905,7 +905,7 @@ var Impl = {
this._log.trace("_onUploadPrefChange - Sending deletion ping.");
this.submitExternalPing(PING_TYPE_DELETION, {}, { addClientId: true });
}
}.bind(this))();
})();
this._shutdownBarrier.client.addBlocker(
"TelemetryController: removing pending pings after data upload was disabled", p);
@ -987,13 +987,13 @@ var Impl = {
const sendDelay =
Preferences.get(PREF_NEWPROFILE_PING_DELAY, NEWPROFILE_PING_DEFAULT_DELAY);
this._delayedNewPingTask = new DeferredTask(async function() {
this._delayedNewPingTask = new DeferredTask(async () => {
try {
await this.sendNewProfilePing();
} finally {
this._delayedNewPingTask = null;
}
}.bind(this), sendDelay);
}, sendDelay);
this._delayedNewPingTask.arm();
},

View File

@ -907,7 +907,7 @@ var TelemetrySendImpl = {
for (let current of currentPings) {
let ping = current;
let p = (async function() {
let p = (async () => {
try {
await this._doPing(ping, ping.id, false);
} catch (ex) {
@ -917,7 +917,7 @@ var TelemetrySendImpl = {
} finally {
this._currentPings.delete(ping.id);
}
}.bind(this))();
})();
this._trackPendingPingTask(p);
pingSends.push(p);

View File

@ -1618,7 +1618,7 @@ var Impl = {
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS, this);
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_USS, this);
let delayedTask = new DeferredTask(function() {
let delayedTask = new DeferredTask(() => {
this._initialized = true;
this.attachObservers();
@ -1627,7 +1627,7 @@ var Impl = {
if (Telemetry.canRecordExtended) {
GCTelemetry.init();
}
}.bind(this), testing ? TELEMETRY_TEST_DELAY : TELEMETRY_DELAY);
}, testing ? TELEMETRY_TEST_DELAY : TELEMETRY_DELAY);
delayedTask.arm();
},

View File

@ -270,7 +270,7 @@ this.PageThumbs = {
// participate in this service's telemetry, which is why this method exists.
_captureToCanvas(aBrowser, aCanvas, aArgs, aCallback) {
if (aBrowser.isRemoteBrowser) {
(async function() {
(async () => {
let data =
await this._captureRemoteThumbnail(aBrowser, aCanvas.width,
aCanvas.height, aArgs);
@ -283,7 +283,7 @@ this.PageThumbs = {
if (aCallback) {
aCallback(aCanvas);
}
}.bind(this))();
})();
return;
}
// The content is a local page, grab a thumbnail sync.
@ -372,7 +372,7 @@ this.PageThumbs = {
let originalURL;
let channelError = false;
((async function task() {
(async () => {
if (!aBrowser.isRemoteBrowser) {
let channel = aBrowser.docShell.currentDocumentChannel;
originalURL = channel.originalURI.spec;
@ -404,7 +404,7 @@ this.PageThumbs = {
if (aCallback) {
aCallback(isSuccess);
}
}).bind(this))();
})();
},
/**

View File

@ -270,7 +270,7 @@ this.DeferredTask.prototype = {
this._armed = false;
this._runningPromise = runningDeferred.promise;
runningDeferred.resolve((async function() {
runningDeferred.resolve((async () => {
// Execute the provided function asynchronously.
await (this._taskFn)().then(null, Cu.reportError);
@ -291,6 +291,6 @@ this.DeferredTask.prototype = {
// Indicate that the execution of the task has finished. This happens
// synchronously with the previous state changes in the function.
this._runningPromise = null;
}.bind(this))().then(null, Cu.reportError));
})().then(null, Cu.reportError));
},
};

View File

@ -312,11 +312,11 @@ JSONFile.prototype = {
// possible if `finalize` is called concurrently with shutdown.
return this._finalizePromise;
}
this._finalizePromise = (async function() {
this._finalizePromise = (async () => {
await this._saver.finalize();
this._data = null;
this.dataReady = false;
}.bind(this))();
})();
return this._finalizePromise;
},

View File

@ -864,7 +864,7 @@ FileAppender.prototype = {
__proto__: Appender.prototype,
_openFile() {
return (async function _openFile() {
return (async () => {
try {
this._file = await OS.File.open(this._path,
{truncate: true});
@ -875,7 +875,7 @@ FileAppender.prototype = {
throw err;
}
}
}.bind(this))();
})();
},
_getFile() {

View File

@ -379,13 +379,13 @@ ConnectionData.prototype = Object.freeze({
fetchState: () => status
});
return (async function() {
return (async () => {
try {
return (await promiseResult);
} finally {
this._barrier.client.removeBlocker(key, promiseComplete)
}
}.bind(this))();
})();
},
close() {
this._closeRequested = true;
@ -558,7 +558,7 @@ ConnectionData.prototype = Object.freeze({
throw new Error("Transaction canceled due to a closed connection.");
}
let transactionPromise = (async function() {
let transactionPromise = (async () => {
// At this point we should never have an in progress transaction, since
// they are enqueued.
if (this._hasInProgressTransaction) {
@ -629,7 +629,7 @@ ConnectionData.prototype = Object.freeze({
} finally {
this._hasInProgressTransaction = false;
}
}.bind(this))();
})();
// If a transaction yields on a never resolved promise, or is mistakenly
// nested, it could hang the transactions queue forever. Thus we timeout

View File

@ -248,7 +248,7 @@ nsUnknownContentTypeDialog.prototype = {
}
}
(async function() {
(async () => {
if (!aForcePrompt) {
// Check to see if the user wishes to auto save to the default download
// folder without prompting. Note that preference might not be set.
@ -362,7 +362,7 @@ nsUnknownContentTypeDialog.prototype = {
aLauncher.saveDestinationAvailable(result);
});
});
}.bind(this))().then(null, Components.utils.reportError);
})().then(null, Components.utils.reportError);
},
getFinalLeafName: function (aLeafName, aFileExt)

View File

@ -1354,7 +1354,7 @@ var AddonManagerInternal = {
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
let buPromise = (async function() {
let buPromise = (async () => {
let hotfixID = this.hotfixID;
let appUpdateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED) &&
@ -1513,7 +1513,7 @@ var AddonManagerInternal = {
logger.debug("Background update check complete");
Services.obs.notifyObservers(null,
"addons-background-update-complete");
}.bind(this))();
})();
// Fork the promise chain so we can log the error and let our caller see it too.
buPromise.then(null, e => logger.warn("Error in background update", e));
return buPromise;
@ -1744,14 +1744,14 @@ var AddonManagerInternal = {
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
return (async function() {
return (async () => {
for (let provider of this.providers) {
await promiseCallProvider(provider, "updateAddonRepositoryData");
}
// only tests should care about this
Services.obs.notifyObservers(null, "TEST:addon-repository-data-updated");
}.bind(this))();
})();
},
/**
@ -1846,7 +1846,7 @@ var AddonManagerInternal = {
throw Components.Exception("aMimetype must be a string or null",
Cr.NS_ERROR_INVALID_ARG);
return (async function() {
return (async () => {
for (let provider of this.providers) {
let install = await promiseCallProvider(
provider, "getInstallForFile", aFile);
@ -1856,7 +1856,7 @@ var AddonManagerInternal = {
}
return null;
}.bind(this))();
})();
},
/**
@ -1876,7 +1876,7 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
return (async function() {
return (async () => {
let installs = [];
for (let provider of this.providers) {
@ -1888,7 +1888,7 @@ var AddonManagerInternal = {
}
return installs;
}.bind(this))();
})();
},
/**
@ -2432,7 +2432,7 @@ var AddonManagerInternal = {
throw Components.Exception("aGUID must be a non-empty string",
Cr.NS_ERROR_INVALID_ARG);
return (async function() {
return (async () => {
for (let provider of this.providers) {
let addon = await promiseCallProvider(
provider, "getAddonBySyncGUID", aGUID);
@ -2442,7 +2442,7 @@ var AddonManagerInternal = {
}
return null;
}.bind(this))();
})();
},
/**
@ -2483,7 +2483,7 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
return (async function() {
return (async () => {
let addons = [];
for (let provider of this.providers) {
@ -2495,7 +2495,7 @@ var AddonManagerInternal = {
}
return addons;
}.bind(this))();
})();
},
/**
@ -2525,7 +2525,7 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
return (async function() {
return (async () => {
let addons = [];
for (let provider of this.providers) {
@ -2537,7 +2537,7 @@ var AddonManagerInternal = {
}
return addons;
}.bind(this))();
})();
},
/**

View File

@ -1548,7 +1548,7 @@ var AddonDatabase = {
*/
openConnection() {
if (!this.connectionPromise) {
this.connectionPromise = (async function() {
this.connectionPromise = (async () => {
this.DB = BLANK_DB();
let inputDB, schema;
@ -1609,7 +1609,7 @@ var AddonDatabase = {
}
return this.DB;
}.bind(this))();
})();
}
return this.connectionPromise;

View File

@ -444,7 +444,7 @@ var AddonTestUtils = {
let realCertDB = factory.createInstance(null, Ci.nsIX509CertDB);
let verifyCert = async function(file, result, cert, callback) {
let verifyCert = async (file, result, cert, callback) => {
if (result == Cr.NS_ERROR_SIGNED_JAR_NOT_SIGNED &&
!this.useRealCertChecks && callback.wrappedJSObject) {
// Bypassing XPConnect allows us to create a fake x509 certificate from JS
@ -468,7 +468,7 @@ var AddonTestUtils = {
}
return [callback, result, cert];
}.bind(this);
};
function FakeCertDB() {

View File

@ -276,7 +276,7 @@ GMPWrapper.prototype = {
return this._updateTask;
}
this._updateTask = (async function() {
this._updateTask = (async () => {
this._log.trace("findUpdates() - updateTask");
try {
let installManager = new GMPInstallManager();
@ -299,7 +299,7 @@ GMPWrapper.prototype = {
this._updateTask = null;
}
return true;
}.bind(this))();
})();
return this._updateTask;
},
@ -582,7 +582,7 @@ var GMPProvider = {
this._log.trace("shutdown");
Services.prefs.removeObserver(GMPPrefs.KEY_LOG_BASE, configureLogging);
let shutdownTask = (async function() {
let shutdownTask = (async () => {
this._log.trace("shutdown - shutdownTask");
let shutdownSucceeded = true;
@ -599,7 +599,7 @@ var GMPProvider = {
if (!shutdownSucceeded) {
throw new Error("Shutdown failed");
}
}.bind(this))();
})();
return shutdownTask;
},

View File

@ -5651,7 +5651,7 @@ class AddonInstall {
* XPI is incorrectly signed
*/
loadManifest(file) {
return ((async function() {
return (async () => {
let zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
createInstance(Ci.nsIZipReader);
try {
@ -5753,7 +5753,7 @@ class AddonInstall {
null;
this.addon.appDisabled = !isUsableAddon(this.addon);
return undefined;
}).bind(this))();
})();
}
getIcon(desiredSize = 64) {
@ -5776,7 +5776,7 @@ class AddonInstall {
* and has been verified).
*/
checkPrompt() {
((async function() {
(async () => {
if (this.promptHandler) {
let info = {
existingAddon: this.existingAddon ? this.existingAddon.wrapper : null,
@ -5797,7 +5797,7 @@ class AddonInstall {
}
this.state = AddonManager.STATE_PROMPTS_DONE;
this.install();
}).bind(this))();
})();
}
/**
@ -5863,7 +5863,7 @@ class AddonInstall {
let stagedAddon = this.installLocation.getStagingDir();
((async function() {
(async () => {
let installedUnpacked = 0;
await this.installLocation.requestStagingDir();
@ -5979,7 +5979,7 @@ class AddonInstall {
if (isTheme(this.addon.type) && this.addon.active)
AddonManagerPrivate.notifyAddonChanged(this.addon.id, this.addon.type, requiresRestart);
}
}).bind(this))().then(null, (e) => {
})().then(null, (e) => {
logger.warn(`Failed to install ${this.file.path} from ${this.sourceURI.spec} to ${stagedAddon.path}`, e);
if (stagedAddon.exists())
@ -6002,7 +6002,7 @@ class AddonInstall {
* Stages an upgrade for next application restart.
*/
stageInstall(restartRequired, stagedAddon, isUpgrade) {
return ((async function() {
return (async () => {
let stagedJSON = stagedAddon.clone();
stagedJSON.leafName = this.addon.id + ".json";
@ -6038,14 +6038,14 @@ class AddonInstall {
}
return installedUnpacked;
}).bind(this))();
})();
}
/**
* Removes any previously staged upgrade.
*/
unstageInstall(stagedAddon) {
return ((async function() {
return (async () => {
let stagedJSON = stagedAddon.clone();
let removedAddon = stagedAddon.clone();
@ -6059,7 +6059,7 @@ class AddonInstall {
await removeAsync(removedAddon);
removedAddon.leafName = this.addon.id + ".xpi";
await removeAsync(removedAddon);
}).bind(this))();
})();
}
/**
@ -6069,7 +6069,7 @@ class AddonInstall {
* when resuming.
*/
postpone(resumeFn) {
return ((async function() {
return (async () => {
this.state = AddonManager.STATE_POSTPONED;
let stagingDir = this.installLocation.getStagingDir();
@ -6110,7 +6110,7 @@ class AddonInstall {
// it will not be removed until resumed or installed by restart.
// See also cleanStagingDir()
this.installLocation.releaseStagingDir();
}).bind(this))();
})();
}
}
@ -6122,7 +6122,7 @@ class LocalAddonInstall extends AddonInstall {
* A Promise that resolves when the object is ready to use.
*/
init() {
return ((async function() {
return (async () => {
this.file = this.sourceURI.QueryInterface(Ci.nsIFileURL).file;
if (!this.file.exists()) {
@ -6208,7 +6208,7 @@ class LocalAddonInstall extends AddonInstall {
this.wrapper);
}
}).bind(this))();
})();
}
install() {