mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1355056 - replace (function(args) { /* do stuff using this */ }).bind(this) with arrow functions, r=jaws.
This commit is contained in:
parent
4d7b007f4f
commit
4b1556a5f2
@ -381,7 +381,7 @@
|
||||
{
|
||||
this.txt = null;
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, function() { return this.txt; }.bind(this))
|
||||
new invokerChecker(EVENT_HIDE, () => { return this.txt; })
|
||||
];
|
||||
|
||||
this.invoke = function hideNDestroyDoc_invoke()
|
||||
@ -405,7 +405,7 @@
|
||||
{
|
||||
this.target = null;
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_HIDE, function() { return this.target; }.bind(this))
|
||||
new invokerChecker(EVENT_HIDE, () => { return this.target; })
|
||||
];
|
||||
|
||||
this.invoke = function hideHideNDestroyDoc_invoke()
|
||||
|
@ -162,12 +162,12 @@ JsonStore.prototype = {
|
||||
// Finally, write.
|
||||
let stream = file.open(this.filename, "w");
|
||||
try {
|
||||
stream.writeAsync(JSON.stringify(this.root), function writeAsync(err) {
|
||||
stream.writeAsync(JSON.stringify(this.root), err => {
|
||||
if (err)
|
||||
console.error("Error writing simple storage file: " + this.filename);
|
||||
else if (this.onWrite)
|
||||
this.onWrite(this);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
// writeAsync closes the stream after it's done, so only close on error.
|
||||
|
@ -155,10 +155,10 @@ var FullZoom = {
|
||||
let token = this._getBrowserToken(browser);
|
||||
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
||||
handleResult() { hasPref = true; },
|
||||
handleCompletion: function() {
|
||||
handleCompletion: () => {
|
||||
if (!hasPref && token.isCurrent)
|
||||
this._applyPrefToZoom(undefined, browser);
|
||||
}.bind(this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -224,14 +224,14 @@ var FullZoom = {
|
||||
let token = this._getBrowserToken(browser);
|
||||
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
|
||||
handleResult(resultPref) { value = resultPref.value; },
|
||||
handleCompletion: function() {
|
||||
handleCompletion: () => {
|
||||
if (!token.isCurrent) {
|
||||
this._notifyOnLocationChange(browser);
|
||||
return;
|
||||
}
|
||||
this._applyPrefToZoom(value, browser,
|
||||
this._notifyOnLocationChange.bind(this, browser));
|
||||
}.bind(this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -364,9 +364,9 @@ var FullZoom = {
|
||||
this._cps2.set(browser.currentURI.spec, this.name,
|
||||
ZoomManager.getZoomForBrowser(browser),
|
||||
this._loadContextFromBrowser(browser), {
|
||||
handleCompletion: function() {
|
||||
handleCompletion: () => {
|
||||
this._isNextContentPrefChangeInternal = true;
|
||||
}.bind(this),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@ -381,9 +381,9 @@ var FullZoom = {
|
||||
return;
|
||||
let ctxt = this._loadContextFromBrowser(browser);
|
||||
this._cps2.removeByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
|
||||
handleCompletion: function() {
|
||||
handleCompletion: () => {
|
||||
this._isNextContentPrefChangeInternal = true;
|
||||
}.bind(this),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -239,7 +239,7 @@ var StarUI = {
|
||||
this._overlayLoading = true;
|
||||
document.loadOverlay(
|
||||
"chrome://browser/content/places/editBookmarkOverlay.xul",
|
||||
(function(aSubject, aTopic, aData) {
|
||||
(aSubject, aTopic, aData) => {
|
||||
// Move the header (star, title, button) into the grid,
|
||||
// so that it aligns nicely with the other items (bug 484022).
|
||||
let header = this._element("editBookmarkPanelHeader");
|
||||
@ -250,7 +250,7 @@ var StarUI = {
|
||||
this._overlayLoading = false;
|
||||
this._overlayLoaded = true;
|
||||
this._doShowEditBookmarkPanel(aNode, aAnchorElement, aPosition);
|
||||
}).bind(this)
|
||||
}
|
||||
);
|
||||
}),
|
||||
|
||||
|
@ -133,10 +133,10 @@ var gBrowserThumbnails = {
|
||||
else
|
||||
aBrowser.addEventListener("scroll", this, true);
|
||||
|
||||
let timeout = setTimeout(function() {
|
||||
let timeout = setTimeout(() => {
|
||||
this._clearTimeout(aBrowser);
|
||||
this._capture(aBrowser);
|
||||
}.bind(this), this._captureDelayMS);
|
||||
}, this._captureDelayMS);
|
||||
|
||||
this._timeouts.set(aBrowser, timeout);
|
||||
},
|
||||
|
@ -106,10 +106,10 @@ var gUndoDialog = {
|
||||
* Undo all blocked sites.
|
||||
*/
|
||||
_undoAll: function UndoDialog_undoAll() {
|
||||
NewTabUtils.undoAll(function() {
|
||||
NewTabUtils.undoAll(() => {
|
||||
gUpdater.updateGrid();
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -247,7 +247,7 @@ var RemoteTabViewer = {
|
||||
},
|
||||
|
||||
_generateCloudSyncTabList() {
|
||||
let updateTabList = function(remoteTabs) {
|
||||
let updateTabList = remoteTabs => {
|
||||
let list = this._tabsList;
|
||||
|
||||
for (let client of remoteTabs) {
|
||||
@ -270,7 +270,7 @@ var RemoteTabViewer = {
|
||||
list.appendChild(tabEnt);
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
return CloudSync().tabs.getRemoteTabs()
|
||||
.then(updateTabList, Promise.reject.bind(Promise));
|
||||
|
@ -327,10 +327,10 @@ WindowListener.prototype = {
|
||||
|
||||
// wait for trasition to fullscreen on OSX Lion later
|
||||
if (isOSX) {
|
||||
setTimeout(function() {
|
||||
setTimeout(() => {
|
||||
domwindow.close();
|
||||
executeSoon(this.callBack_onFinalize);
|
||||
}.bind(this), 3000);
|
||||
}, 3000);
|
||||
} else {
|
||||
domwindow.close();
|
||||
executeSoon(this.callBack_onFinalize);
|
||||
|
@ -4386,7 +4386,7 @@ OverflowableToolbar.prototype = {
|
||||
|
||||
_hideTimeoutId: null,
|
||||
_showWithTimeout() {
|
||||
this.show().then(function() {
|
||||
this.show().then(() => {
|
||||
let window = this._toolbar.ownerGlobal;
|
||||
if (this._hideTimeoutId) {
|
||||
window.clearTimeout(this._hideTimeoutId);
|
||||
@ -4396,7 +4396,7 @@ OverflowableToolbar.prototype = {
|
||||
this._panel.hidePopup();
|
||||
}
|
||||
}, OVERFLOW_PANEL_HIDE_DELAY_MS);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -699,53 +699,53 @@ const CustomizableWidgets = [
|
||||
updateCombinedWidgetStyle(node, this.currentArea, true);
|
||||
|
||||
let listener = {
|
||||
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
|
||||
onWidgetAdded: (aWidgetId, aArea, aPosition) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
|
||||
updateCombinedWidgetStyle(node, aArea, true);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetRemoved: function(aWidgetId, aPrevArea) {
|
||||
onWidgetRemoved: (aWidgetId, aPrevArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
|
||||
// When a widget is demoted to the palette ('removed'), it's visual
|
||||
// style should change.
|
||||
updateCombinedWidgetStyle(node, null, true);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetReset: function(aWidgetNode) {
|
||||
onWidgetReset: aWidgetNode => {
|
||||
if (aWidgetNode != node)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, this.currentArea, true);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetUndoMove: function(aWidgetNode) {
|
||||
onWidgetUndoMove: aWidgetNode => {
|
||||
if (aWidgetNode != node)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, this.currentArea, true);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetMoved: function(aWidgetId, aArea) {
|
||||
onWidgetMoved: (aWidgetId, aArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, aArea, true);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetInstanceRemoved: function(aWidgetId, aDoc) {
|
||||
onWidgetInstanceRemoved: (aWidgetId, aDoc) => {
|
||||
if (aWidgetId != this.id || aDoc != aDocument)
|
||||
return;
|
||||
|
||||
CustomizableUI.removeListener(listener);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetDrag: function(aWidgetId, aArea) {
|
||||
onWidgetDrag: (aWidgetId, aArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
aArea = aArea || this.currentArea;
|
||||
updateCombinedWidgetStyle(node, aArea, true);
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
CustomizableUI.addListener(listener);
|
||||
|
||||
@ -798,50 +798,50 @@ const CustomizableWidgets = [
|
||||
updateCombinedWidgetStyle(node, this.currentArea);
|
||||
|
||||
let listener = {
|
||||
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
|
||||
onWidgetAdded: (aWidgetId, aArea, aPosition) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, aArea);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetRemoved: function(aWidgetId, aPrevArea) {
|
||||
onWidgetRemoved: (aWidgetId, aPrevArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
// When a widget is demoted to the palette ('removed'), it's visual
|
||||
// style should change.
|
||||
updateCombinedWidgetStyle(node);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetReset: function(aWidgetNode) {
|
||||
onWidgetReset: aWidgetNode => {
|
||||
if (aWidgetNode != node)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, this.currentArea);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetUndoMove: function(aWidgetNode) {
|
||||
onWidgetUndoMove: aWidgetNode => {
|
||||
if (aWidgetNode != node)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, this.currentArea);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetMoved: function(aWidgetId, aArea) {
|
||||
onWidgetMoved: (aWidgetId, aArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
updateCombinedWidgetStyle(node, aArea);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetInstanceRemoved: function(aWidgetId, aDoc) {
|
||||
onWidgetInstanceRemoved: (aWidgetId, aDoc) => {
|
||||
if (aWidgetId != this.id || aDoc != aDocument)
|
||||
return;
|
||||
CustomizableUI.removeListener(listener);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onWidgetDrag: function(aWidgetId, aArea) {
|
||||
onWidgetDrag: (aWidgetId, aArea) => {
|
||||
if (aWidgetId != this.id)
|
||||
return;
|
||||
aArea = aArea || this.currentArea;
|
||||
updateCombinedWidgetStyle(node, aArea);
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
CustomizableUI.addListener(listener);
|
||||
|
||||
|
@ -385,14 +385,14 @@ CustomizeMode.prototype = {
|
||||
if (!this._wantToBeInCustomizeMode) {
|
||||
this.exit();
|
||||
}
|
||||
}.bind(this)).then(null, function(e) {
|
||||
}.bind(this)).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();
|
||||
this._handler.isEnteringCustomizeMode = false;
|
||||
// Exit customize mode to ensure proper clean-up when entering failed.
|
||||
this.exit();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
exit() {
|
||||
@ -542,12 +542,12 @@ CustomizeMode.prototype = {
|
||||
if (this._wantToBeInCustomizeMode) {
|
||||
this.enter();
|
||||
}
|
||||
}.bind(this)).then(null, function(e) {
|
||||
}.bind(this)).then(null, e => {
|
||||
log.error("Error exiting customize mode", e);
|
||||
// We should ensure this has been called, and calling it again doesn't hurt:
|
||||
window.PanelUI.endBatchUpdate();
|
||||
this._handler.isExitingCustomizeMode = false;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1320,7 +1320,7 @@ CustomizeMode.prototype = {
|
||||
panel.hidePopup();
|
||||
};
|
||||
|
||||
AddonManager.getAddonByID(DEFAULT_THEME_ID, function(aDefaultTheme) {
|
||||
AddonManager.getAddonByID(DEFAULT_THEME_ID, aDefaultTheme => {
|
||||
let doc = this.window.document;
|
||||
|
||||
function buildToolbarButton(aTheme) {
|
||||
@ -1403,7 +1403,7 @@ CustomizeMode.prototype = {
|
||||
}
|
||||
let hideRecommendedLabel = (footer.previousSibling == recommendedLabel);
|
||||
recommendedLabel.hidden = hideRecommendedLabel;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
_clearLWThemesMenu(panel) {
|
||||
@ -1563,7 +1563,7 @@ CustomizeMode.prototype = {
|
||||
|
||||
// Hack needed so that the dragimage will still show the
|
||||
// item as it appeared before it was hidden.
|
||||
this._initializeDragAfterMove = function() {
|
||||
this._initializeDragAfterMove = () => {
|
||||
// For automated tests, we sometimes start exiting customization mode
|
||||
// before this fires, which leaves us with placeholders inserted after
|
||||
// we've exited. So we need to check that we are indeed customizing.
|
||||
@ -1581,7 +1581,7 @@ CustomizeMode.prototype = {
|
||||
}
|
||||
this._initializeDragAfterMove = null;
|
||||
this.window.clearTimeout(this._dragInitializeTimeout);
|
||||
}.bind(this);
|
||||
};
|
||||
this._dragInitializeTimeout = this.window.setTimeout(this._initializeDragAfterMove, 0);
|
||||
},
|
||||
|
||||
|
@ -965,13 +965,13 @@ FeedWriter.prototype = {
|
||||
// Show the file picker before subscribing if the
|
||||
// choose application menuitem was chosen using the keyboard
|
||||
if (selectedItem.id == "chooseApplicationMenuItem") {
|
||||
this._chooseClientApp(function(aResult) {
|
||||
this._chooseClientApp(aResult => {
|
||||
if (aResult) {
|
||||
selectedItem =
|
||||
this._handlersList.selectedOptions[0];
|
||||
subscribeCallback();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
} else {
|
||||
subscribeCallback();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ FirefoxProfileMigrator.prototype.getLastUsedDate = function() {
|
||||
};
|
||||
|
||||
FirefoxProfileMigrator.prototype._getResourcesInternal = function(sourceProfileDir, currentProfileDir) {
|
||||
let getFileResource = function(aMigrationType, aFileNames) {
|
||||
let getFileResource = (aMigrationType, aFileNames) => {
|
||||
let files = [];
|
||||
for (let fileName of aFileNames) {
|
||||
let file = this._getFileObject(sourceProfileDir, fileName);
|
||||
@ -124,7 +124,7 @@ FirefoxProfileMigrator.prototype._getResourcesInternal = function(sourceProfileD
|
||||
aCallback(true);
|
||||
}
|
||||
};
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
let types = MigrationUtils.resourceTypes;
|
||||
let places = getFileResource(types.HISTORY, ["places.sqlite"]);
|
||||
|
@ -204,7 +204,7 @@ History.prototype = {
|
||||
},
|
||||
|
||||
migrate: function H_migrate(aCallback) {
|
||||
PropertyListUtils.read(this._file, function migrateHistory(aDict) {
|
||||
PropertyListUtils.read(this._file, aDict => {
|
||||
try {
|
||||
if (!aDict)
|
||||
throw new Error("Could not read history property list");
|
||||
@ -247,7 +247,7 @@ History.prototype = {
|
||||
Cu.reportError(ex);
|
||||
aCallback(false);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -276,7 +276,7 @@ MainPreferencesPropertyList.prototype = {
|
||||
let alreadyReading = this._callbacks.length > 0;
|
||||
this._callbacks.push(aCallback);
|
||||
if (!alreadyReading) {
|
||||
PropertyListUtils.read(this._file, function readPrefs(aDict) {
|
||||
PropertyListUtils.read(this._file, aDict => {
|
||||
this._dict = aDict;
|
||||
for (let callback of this._callbacks) {
|
||||
try {
|
||||
@ -286,7 +286,7 @@ MainPreferencesPropertyList.prototype = {
|
||||
}
|
||||
}
|
||||
this._callbacks.splice(0);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -482,11 +482,11 @@ var PlacesOrganizer = {
|
||||
getService(Ci.nsIProperties);
|
||||
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
let fpCallback = aResult => {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
this.restoreBookmarksFromFile(fp.file.path);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
fp.init(window, PlacesUIUtils.getString("bookmarksRestoreTitle"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
|
@ -34,10 +34,10 @@ var gAdvancedPane = {
|
||||
advancedPrefs.selectedIndex = preference.value;
|
||||
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
let onUnload = function() {
|
||||
let onUnload = () => {
|
||||
window.removeEventListener("unload", onUnload);
|
||||
Services.prefs.removeObserver("app.update.", this);
|
||||
}.bind(this);
|
||||
};
|
||||
window.addEventListener("unload", onUnload);
|
||||
Services.prefs.addObserver("app.update.", this);
|
||||
this.updateReadPrefs();
|
||||
|
@ -1693,7 +1693,7 @@ var gApplicationsPane = {
|
||||
aEvent.stopPropagation();
|
||||
|
||||
var handlerApp;
|
||||
let chooseAppCallback = function(aHandlerApp) {
|
||||
let chooseAppCallback = aHandlerApp => {
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
@ -1714,7 +1714,7 @@ var gApplicationsPane = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (AppConstants.platform == "win") {
|
||||
var params = {};
|
||||
@ -1749,7 +1749,7 @@ var gApplicationsPane = {
|
||||
} else {
|
||||
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
let fpCallback = aResult => {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
this._isValidHandlerExecutable(fp.file)) {
|
||||
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
@ -1763,7 +1763,7 @@ var gApplicationsPane = {
|
||||
|
||||
chooseAppCallback(handlerApp);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
|
@ -61,11 +61,11 @@ var gSyncPane = {
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
let onReady = function() {
|
||||
let onReady = () => {
|
||||
Services.obs.removeObserver(onReady, "weave:service:ready");
|
||||
window.removeEventListener("unload", onUnload);
|
||||
this._init();
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
Services.obs.addObserver(onReady, "weave:service:ready");
|
||||
window.addEventListener("unload", onUnload);
|
||||
|
@ -21,10 +21,10 @@ var gAdvancedPane = {
|
||||
this._inited = true;
|
||||
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
let onUnload = function() {
|
||||
let onUnload = () => {
|
||||
window.removeEventListener("unload", onUnload);
|
||||
Services.prefs.removeObserver("app.update.", this);
|
||||
}.bind(this);
|
||||
};
|
||||
window.addEventListener("unload", onUnload);
|
||||
Services.prefs.addObserver("app.update.", this);
|
||||
this.updateReadPrefs();
|
||||
|
@ -1697,7 +1697,7 @@ var gApplicationsPane = {
|
||||
aEvent.stopPropagation();
|
||||
|
||||
var handlerApp;
|
||||
let chooseAppCallback = function(aHandlerApp) {
|
||||
let chooseAppCallback = aHandlerApp => {
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
@ -1718,7 +1718,7 @@ var gApplicationsPane = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (AppConstants.platform == "win") {
|
||||
var params = {};
|
||||
@ -1753,7 +1753,7 @@ var gApplicationsPane = {
|
||||
} else {
|
||||
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
let fpCallback = aResult => {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
this._isValidHandlerExecutable(fp.file)) {
|
||||
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
@ -1767,7 +1767,7 @@ var gApplicationsPane = {
|
||||
|
||||
chooseAppCallback(handlerApp);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
|
@ -61,11 +61,11 @@ var gSyncPane = {
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
let onReady = function() {
|
||||
let onReady = () => {
|
||||
Services.obs.removeObserver(onReady, "weave:service:ready");
|
||||
window.removeEventListener("unload", onUnload);
|
||||
this._init();
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
Services.obs.addObserver(onReady, "weave:service:ready");
|
||||
window.addEventListener("unload", onUnload);
|
||||
|
@ -77,7 +77,7 @@
|
||||
|
||||
this._initialized = true;
|
||||
|
||||
Services.search.init((function search_init_cb(aStatus) {
|
||||
Services.search.init(aStatus => {
|
||||
// Bail out if the binding's been destroyed
|
||||
if (!this._initialized)
|
||||
return;
|
||||
@ -89,7 +89,7 @@
|
||||
} else {
|
||||
Components.utils.reportError("Cannot initialize search service, bailing out: " + aStatus);
|
||||
}
|
||||
}).bind(this));
|
||||
});
|
||||
|
||||
// Some accessibility tests create their own <searchbar> that doesn't
|
||||
// use the popup binding below, so null-check oneOffButtons.
|
||||
|
@ -321,9 +321,9 @@ BingRequest.prototype = {
|
||||
// Set up request options.
|
||||
let deferred = Promise.defer();
|
||||
let options = {
|
||||
onLoad: (function(responseText, xhr) {
|
||||
onLoad: (responseText, xhr) => {
|
||||
deferred.resolve(this);
|
||||
}).bind(this),
|
||||
},
|
||||
onError(e, responseText, xhr) {
|
||||
deferred.reject(xhr);
|
||||
},
|
||||
|
@ -314,9 +314,9 @@ YandexRequest.prototype = {
|
||||
// Set up request options.
|
||||
let deferred = Promise.defer();
|
||||
let options = {
|
||||
onLoad: (function(responseText, xhr) {
|
||||
onLoad: (responseText, xhr) => {
|
||||
deferred.resolve(this);
|
||||
}).bind(this),
|
||||
},
|
||||
onError(e, responseText, xhr) {
|
||||
deferred.reject(xhr);
|
||||
},
|
||||
|
@ -31,9 +31,9 @@ this.Store = class Store {
|
||||
// Bind each redux method so we can call it directly from the Store. E.g.,
|
||||
// store.dispatch() will call store._store.dispatch();
|
||||
["dispatch", "getState", "subscribe"].forEach(method => {
|
||||
this[method] = function(...args) {
|
||||
this[method] = (...args) => {
|
||||
return this._store[method](...args);
|
||||
}.bind(this);
|
||||
};
|
||||
});
|
||||
this.feeds = new Map();
|
||||
this._feedFactories = null;
|
||||
|
@ -794,10 +794,10 @@ class FindEventManager {
|
||||
}
|
||||
|
||||
bind() {
|
||||
var unload = function(e) {
|
||||
var unload = e => {
|
||||
this.unbind();
|
||||
this.contentWindow.removeEventListener(e.type, unload);
|
||||
}.bind(this);
|
||||
};
|
||||
this.contentWindow.addEventListener("unload", unload);
|
||||
|
||||
// We cannot directly attach listeners to for the find events
|
||||
|
@ -992,7 +992,7 @@ function MessageHandler(sourceName, targetName, comObj) {
|
||||
this.postMessageTransfers = true;
|
||||
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
||||
var ah = this.actionHandler = Object.create(null);
|
||||
this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
|
||||
this._onComObjOnMessage = event => {
|
||||
var data = event.data;
|
||||
if (data.targetName !== this.sourceName) {
|
||||
return;
|
||||
@ -1043,7 +1043,7 @@ function MessageHandler(sourceName, targetName, comObj) {
|
||||
} else {
|
||||
error('Unknown action from worker: ' + data.action);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
comObj.addEventListener('message', this._onComObjOnMessage);
|
||||
}
|
||||
MessageHandler.prototype = {
|
||||
@ -1225,14 +1225,14 @@ var DOMCMapReaderFactory = function DOMCMapReaderFactoryClosure() {
|
||||
if (!name) {
|
||||
return Promise.reject(new Error('CMap name must be specified.'));
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', url, true);
|
||||
if (this.isCompressed) {
|
||||
request.responseType = 'arraybuffer';
|
||||
}
|
||||
request.onreadystatechange = function () {
|
||||
request.onreadystatechange = () => {
|
||||
if (request.readyState !== XMLHttpRequest.DONE) {
|
||||
return;
|
||||
}
|
||||
@ -1252,9 +1252,9 @@ var DOMCMapReaderFactory = function DOMCMapReaderFactoryClosure() {
|
||||
}
|
||||
}
|
||||
reject(new Error('Unable to load ' + (this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url));
|
||||
}.bind(this);
|
||||
};
|
||||
request.send(null);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
return DOMCMapReaderFactory;
|
||||
@ -2239,13 +2239,13 @@ var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() {
|
||||
destroy: function () {
|
||||
this.destroyed = true;
|
||||
var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy();
|
||||
return transportDestroyed.then(function () {
|
||||
return transportDestroyed.then(() => {
|
||||
this._transport = null;
|
||||
if (this._worker) {
|
||||
this._worker.destroy();
|
||||
this._worker = null;
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {
|
||||
return this.promise.then.apply(this.promise, arguments);
|
||||
@ -2279,20 +2279,20 @@ var PDFDataRangeTransport = function pdfDataRangeTransportClosure() {
|
||||
}
|
||||
},
|
||||
onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) {
|
||||
this._readyCapability.promise.then(function () {
|
||||
this._readyCapability.promise.then(() => {
|
||||
var listeners = this._progressListeners;
|
||||
for (var i = 0, n = listeners.length; i < n; ++i) {
|
||||
listeners[i](loaded);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
onDataProgressiveRead: function PDFDataRangeTransport_onDataProgress(chunk) {
|
||||
this._readyCapability.promise.then(function () {
|
||||
this._readyCapability.promise.then(() => {
|
||||
var listeners = this._progressiveReadListeners;
|
||||
for (var i = 0, n = listeners.length; i < n; ++i) {
|
||||
listeners[i](chunk);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
transportReady: function PDFDataRangeTransport_transportReady() {
|
||||
this._readyCapability.resolve();
|
||||
@ -2660,11 +2660,11 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
}
|
||||
var cloned = new WeakMap();
|
||||
var e = { data: cloneValue(obj) };
|
||||
this._deferred.then(function () {
|
||||
this._deferred.then(() => {
|
||||
this._listeners.forEach(function (listener) {
|
||||
listener.call(this, e);
|
||||
}, this);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
addEventListener: function (name, listener) {
|
||||
this._listeners.push(listener);
|
||||
@ -2716,7 +2716,7 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
try {
|
||||
var worker = new Worker(workerSrc);
|
||||
var messageHandler = new _util.MessageHandler('main', 'worker', worker);
|
||||
var terminateEarly = function () {
|
||||
var terminateEarly = () => {
|
||||
worker.removeEventListener('error', onWorkerError);
|
||||
messageHandler.destroy();
|
||||
worker.terminate();
|
||||
@ -2725,14 +2725,14 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
} else {
|
||||
this._setupFakeWorker();
|
||||
}
|
||||
}.bind(this);
|
||||
var onWorkerError = function (event) {
|
||||
};
|
||||
var onWorkerError = event => {
|
||||
if (!this._webWorker) {
|
||||
terminateEarly();
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
worker.addEventListener('error', onWorkerError);
|
||||
messageHandler.on('test', function PDFWorker_test(data) {
|
||||
messageHandler.on('test', data => {
|
||||
worker.removeEventListener('error', onWorkerError);
|
||||
if (this.destroyed) {
|
||||
terminateEarly();
|
||||
@ -2753,14 +2753,14 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
messageHandler.destroy();
|
||||
worker.terminate();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
messageHandler.on('console_log', function (data) {
|
||||
console.log.apply(console, data);
|
||||
});
|
||||
messageHandler.on('console_error', function (data) {
|
||||
console.error.apply(console, data);
|
||||
});
|
||||
messageHandler.on('ready', function (data) {
|
||||
messageHandler.on('ready', data => {
|
||||
worker.removeEventListener('error', onWorkerError);
|
||||
if (this.destroyed) {
|
||||
terminateEarly();
|
||||
@ -2771,7 +2771,7 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
} catch (e) {
|
||||
this._setupFakeWorker();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
var sendTest = function () {
|
||||
var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled;
|
||||
var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]);
|
||||
@ -2796,7 +2796,7 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
(0, _util.warn)('Setting up fake worker.');
|
||||
isWorkerDisabled = true;
|
||||
}
|
||||
setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
|
||||
setupFakeWorkerGlobal().then(WorkerMessageHandler => {
|
||||
if (this.destroyed) {
|
||||
this._readyCapability.reject(new Error('Worker was destroyed'));
|
||||
return;
|
||||
@ -2810,7 +2810,7 @@ var PDFWorker = function PDFWorkerClosure() {
|
||||
var messageHandler = new _util.MessageHandler(id, id + '_worker', port);
|
||||
this._messageHandler = messageHandler;
|
||||
this._readyCapability.resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
destroy: function PDFWorker_destroy() {
|
||||
this.destroyed = true;
|
||||
@ -2913,9 +2913,9 @@ var WorkerTransport = function WorkerTransportClosure() {
|
||||
messageHandler.on('PasswordRequest', function transportPasswordRequest(exception) {
|
||||
this._passwordCapability = (0, _util.createPromiseCapability)();
|
||||
if (loadingTask.onPassword) {
|
||||
var updatePassword = function (password) {
|
||||
var updatePassword = password => {
|
||||
this._passwordCapability.resolve({ password: password });
|
||||
}.bind(this);
|
||||
};
|
||||
loadingTask.onPassword(updatePassword, exception.code);
|
||||
} else {
|
||||
this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
|
||||
@ -2991,9 +2991,9 @@ var WorkerTransport = function WorkerTransportClosure() {
|
||||
disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'),
|
||||
fontRegistry: fontRegistry
|
||||
});
|
||||
this.fontLoader.bind([font], function fontReady(fontObjs) {
|
||||
this.fontLoader.bind([font], fontObjs => {
|
||||
this.commonObjs.resolve(id, font);
|
||||
}.bind(this));
|
||||
});
|
||||
break;
|
||||
case 'FontPath':
|
||||
this.commonObjs.resolve(id, data[2]);
|
||||
@ -3140,14 +3140,14 @@ var WorkerTransport = function WorkerTransportClosure() {
|
||||
if (pageIndex in this.pagePromises) {
|
||||
return this.pagePromises[pageIndex];
|
||||
}
|
||||
var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(function (pageInfo) {
|
||||
var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(pageInfo => {
|
||||
if (this.destroyed) {
|
||||
throw new Error('Transport destroyed');
|
||||
}
|
||||
var page = new PDFPageProxy(pageIndex, pageInfo, this);
|
||||
this.pageCache[pageIndex] = page;
|
||||
return page;
|
||||
}.bind(this));
|
||||
});
|
||||
this.pagePromises[pageIndex] = promise;
|
||||
return promise;
|
||||
},
|
||||
@ -3192,7 +3192,7 @@ var WorkerTransport = function WorkerTransportClosure() {
|
||||
return this.messageHandler.sendWithPromise('GetStats', null);
|
||||
},
|
||||
startCleanup: function WorkerTransport_startCleanup() {
|
||||
this.messageHandler.sendWithPromise('Cleanup', null).then(function endCleanup() {
|
||||
this.messageHandler.sendWithPromise('Cleanup', null).then(() => {
|
||||
for (var i = 0, ii = this.pageCache.length; i < ii; i++) {
|
||||
var page = this.pageCache[i];
|
||||
if (page) {
|
||||
@ -3201,7 +3201,7 @@ var WorkerTransport = function WorkerTransportClosure() {
|
||||
}
|
||||
this.commonObjs.clear();
|
||||
this.fontLoader.clear();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
return WorkerTransport;
|
||||
|
@ -992,7 +992,7 @@ function MessageHandler(sourceName, targetName, comObj) {
|
||||
this.postMessageTransfers = true;
|
||||
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
||||
var ah = this.actionHandler = Object.create(null);
|
||||
this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
|
||||
this._onComObjOnMessage = event => {
|
||||
var data = event.data;
|
||||
if (data.targetName !== this.sourceName) {
|
||||
return;
|
||||
@ -1043,7 +1043,7 @@ function MessageHandler(sourceName, targetName, comObj) {
|
||||
} else {
|
||||
error('Unknown action from worker: ' + data.action);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
comObj.addEventListener('message', this._onComObjOnMessage);
|
||||
}
|
||||
MessageHandler.prototype = {
|
||||
@ -14556,7 +14556,7 @@ var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
|
||||
};
|
||||
rangeReader.read().then(readChunk, reject);
|
||||
});
|
||||
promise.then(function (data) {
|
||||
promise.then(data => {
|
||||
if (this.aborted) {
|
||||
return;
|
||||
}
|
||||
@ -14564,7 +14564,7 @@ var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
|
||||
chunk: data,
|
||||
begin: begin
|
||||
});
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
|
||||
var missingChunks = this.stream.getMissingChunks();
|
||||
@ -16798,12 +16798,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
var glyphs = font.charsToGlyphs(chars);
|
||||
var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
||||
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
|
||||
var buildPath = function (fontChar) {
|
||||
var buildPath = fontChar => {
|
||||
if (!font.renderer.hasBuiltPath(fontChar)) {
|
||||
var path = font.renderer.getPathJs(fontChar);
|
||||
this.handler.send('commonobj', [font.loadedName + '_path_' + fontChar, 'FontPath', path]);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
||||
var glyph = glyphs[i];
|
||||
buildPath(glyph.fontChar);
|
||||
@ -17274,7 +17274,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
}
|
||||
closePendingRestoreOPS();
|
||||
resolve();
|
||||
}).catch(function (reason) {
|
||||
}).catch(reason => {
|
||||
if (this.options.ignoreErrors) {
|
||||
this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
|
||||
warn('getOperatorList - ignoring errors during task: ' + task.name);
|
||||
@ -17282,7 +17282,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
return;
|
||||
}
|
||||
throw reason;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
|
||||
stateManager = stateManager || new StateManager(new TextState());
|
||||
@ -17695,14 +17695,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
}
|
||||
flushTextContentItem();
|
||||
resolve(textContent);
|
||||
}).catch(function (reason) {
|
||||
}).catch(reason => {
|
||||
if (this.options.ignoreErrors) {
|
||||
warn('getTextContent - ignoring errors during task: ' + task.name);
|
||||
flushTextContentItem();
|
||||
return textContent;
|
||||
}
|
||||
throw reason;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
|
||||
var xref = this.xref;
|
||||
@ -17778,10 +17778,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
properties.baseEncodingName = baseEncodingName;
|
||||
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
|
||||
properties.dict = dict;
|
||||
return toUnicodePromise.then(function (toUnicode) {
|
||||
return toUnicodePromise.then(toUnicode => {
|
||||
properties.toUnicode = toUnicode;
|
||||
return this.buildToUnicode(properties);
|
||||
}.bind(this)).then(function (toUnicode) {
|
||||
}).then(function (toUnicode) {
|
||||
properties.toUnicode = toUnicode;
|
||||
return properties;
|
||||
});
|
||||
@ -18161,10 +18161,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
firstChar: 0,
|
||||
lastChar: maxCharIndex
|
||||
};
|
||||
return this.extractDataStructures(dict, dict, properties).then(function (properties) {
|
||||
return this.extractDataStructures(dict, dict, properties).then(properties => {
|
||||
properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
|
||||
return new Font(baseFontName, null, properties);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
var firstChar = dict.get('FirstChar') || 0;
|
||||
@ -18242,15 +18242,15 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
||||
} else {
|
||||
cMapPromise = Promise.resolve(undefined);
|
||||
}
|
||||
return cMapPromise.then(function () {
|
||||
return cMapPromise.then(() => {
|
||||
return this.extractDataStructures(dict, baseDict, properties);
|
||||
}.bind(this)).then(function (properties) {
|
||||
}).then(properties => {
|
||||
this.extractWidths(dict, descriptor, properties);
|
||||
if (type === 'Type3') {
|
||||
properties.isType3Font = true;
|
||||
}
|
||||
return new Font(fontName.name, fontFile, properties);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
return PartialEvaluator;
|
||||
@ -21605,22 +21605,22 @@ var Catalog = function CatalogClosure() {
|
||||
this.fontCache.forEach(function (promise) {
|
||||
promises.push(promise);
|
||||
});
|
||||
return Promise.all(promises).then(function (translatedFonts) {
|
||||
return Promise.all(promises).then(translatedFonts => {
|
||||
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
|
||||
var font = translatedFonts[i].dict;
|
||||
delete font.translated;
|
||||
}
|
||||
this.fontCache.clear();
|
||||
this.builtInCMapCache = Object.create(null);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
getPage: function Catalog_getPage(pageIndex) {
|
||||
if (!(pageIndex in this.pagePromises)) {
|
||||
this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
|
||||
this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(a => {
|
||||
var dict = a[0];
|
||||
var ref = a[1];
|
||||
return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
return this.pagePromises[pageIndex];
|
||||
},
|
||||
@ -22665,7 +22665,7 @@ var ObjectLoader = function () {
|
||||
addChildren(currentNode, nodesToVisit);
|
||||
}
|
||||
if (pendingRequests.length) {
|
||||
this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
|
||||
this.xref.stream.manager.requestRanges(pendingRequests).then(() => {
|
||||
nodesToVisit = nodesToRevisit;
|
||||
for (var i = 0; i < nodesToRevisit.length; i++) {
|
||||
var node = nodesToRevisit[i];
|
||||
@ -22674,7 +22674,7 @@ var ObjectLoader = function () {
|
||||
}
|
||||
}
|
||||
this._walk(nodesToVisit);
|
||||
}.bind(this), this.capability.reject);
|
||||
}, this.capability.reject);
|
||||
return;
|
||||
}
|
||||
this.refSet = null;
|
||||
@ -24271,7 +24271,7 @@ var Annotation = function AnnotationClosure() {
|
||||
this.data.contents = stringToPDFString(dict.get('Contents') || '');
|
||||
},
|
||||
loadResources: function Annotation_loadResources(keys) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.appearance.dict.getAsync('Resources').then(function (resources) {
|
||||
if (!resources) {
|
||||
resolve();
|
||||
@ -24282,7 +24282,7 @@ var Annotation = function AnnotationClosure() {
|
||||
resolve(resources);
|
||||
}, reject);
|
||||
}, reject);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
|
||||
if (!this.appearance) {
|
||||
@ -25811,10 +25811,10 @@ var Page = function PageClosure() {
|
||||
if (!this.resourcesPromise) {
|
||||
this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
|
||||
}
|
||||
return this.resourcesPromise.then(function resourceSuccess() {
|
||||
return this.resourcesPromise.then(() => {
|
||||
var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
|
||||
return objectLoader.load();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
|
||||
var self = this;
|
||||
@ -27295,7 +27295,7 @@ var Font = function FontClosure() {
|
||||
this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
|
||||
} else {
|
||||
glyphsUnicodeMap = getGlyphsUnicode();
|
||||
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
|
||||
this.toUnicode.forEach((charCode, unicodeCharCode) => {
|
||||
if (!this.composite) {
|
||||
glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
|
||||
unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
|
||||
@ -27304,7 +27304,7 @@ var Font = function FontClosure() {
|
||||
}
|
||||
}
|
||||
this.toFontChar[charCode] = unicodeCharCode;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
this.loadedName = fontName.split('-')[0];
|
||||
this.loading = false;
|
||||
|
@ -149,11 +149,11 @@ var FontInspector = (function FontInspectorClosure() {
|
||||
fonts.appendChild(font);
|
||||
// Somewhat of a hack, should probably add a hook for when the text layer
|
||||
// is done rendering.
|
||||
setTimeout(function() {
|
||||
setTimeout(() => {
|
||||
if (this.active) {
|
||||
resetSelection();
|
||||
}
|
||||
}.bind(this), 2000);
|
||||
}, 2000);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
@ -739,9 +739,9 @@ var PDFRenderingQueue = function PDFRenderingQueueClosure() {
|
||||
break;
|
||||
case RenderingStates.INITIAL:
|
||||
this.highestPriorityPage = view.renderingId;
|
||||
var continueRendering = function () {
|
||||
var continueRendering = () => {
|
||||
this.renderHighestPriority();
|
||||
}.bind(this);
|
||||
};
|
||||
view.draw().then(continueRendering, continueRendering);
|
||||
break;
|
||||
}
|
||||
@ -1187,10 +1187,10 @@ var PDFViewerApplication = {
|
||||
},
|
||||
open: function pdfViewOpen(file, args) {
|
||||
if (this.pdfLoadingTask) {
|
||||
return this.close().then(function () {
|
||||
return this.close().then(() => {
|
||||
_preferences.Preferences.reload();
|
||||
return this.open(file, args);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
var parameters = Object.create(null),
|
||||
scale;
|
||||
@ -1313,10 +1313,10 @@ var PDFViewerApplication = {
|
||||
this.disableAutoFetchLoadingBarTimeout = null;
|
||||
}
|
||||
this.loadingBar.show();
|
||||
this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {
|
||||
this.disableAutoFetchLoadingBarTimeout = setTimeout(() => {
|
||||
this.loadingBar.hide();
|
||||
this.disableAutoFetchLoadingBarTimeout = null;
|
||||
}.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
|
||||
}, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2273,7 +2273,7 @@ var OverlayManager = {
|
||||
overlays: {},
|
||||
active: null,
|
||||
register: function overlayManagerRegister(name, element, callerCloseMethod, canForceClose) {
|
||||
return new Promise(function (resolve) {
|
||||
return new Promise(resolve => {
|
||||
var container;
|
||||
if (!name || !element || !(container = element.parentNode)) {
|
||||
throw new Error('Not enough parameters.');
|
||||
@ -2287,10 +2287,10 @@ var OverlayManager = {
|
||||
canForceClose: canForceClose || false
|
||||
};
|
||||
resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
unregister: function overlayManagerUnregister(name) {
|
||||
return new Promise(function (resolve) {
|
||||
return new Promise(resolve => {
|
||||
if (!this.overlays[name]) {
|
||||
throw new Error('The overlay does not exist.');
|
||||
} else if (this.active === name) {
|
||||
@ -2298,10 +2298,10 @@ var OverlayManager = {
|
||||
}
|
||||
delete this.overlays[name];
|
||||
resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
open: function overlayManagerOpen(name) {
|
||||
return new Promise(function (resolve) {
|
||||
return new Promise(resolve => {
|
||||
if (!this.overlays[name]) {
|
||||
throw new Error('The overlay does not exist.');
|
||||
} else if (this.active) {
|
||||
@ -2318,10 +2318,10 @@ var OverlayManager = {
|
||||
this.overlays[this.active].container.classList.remove('hidden');
|
||||
window.addEventListener('keydown', this._keyDown);
|
||||
resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
close: function overlayManagerClose(name) {
|
||||
return new Promise(function (resolve) {
|
||||
return new Promise(resolve => {
|
||||
if (!this.overlays[name]) {
|
||||
throw new Error('The overlay does not exist.');
|
||||
} else if (!this.active) {
|
||||
@ -2334,7 +2334,7 @@ var OverlayManager = {
|
||||
this.active = null;
|
||||
window.removeEventListener('keydown', this._keyDown);
|
||||
resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
_keyDown: function overlayManager_keyDown(evt) {
|
||||
var self = OverlayManager;
|
||||
@ -2728,7 +2728,7 @@ var Preferences = {
|
||||
isInitializedPromiseResolved: false,
|
||||
initializedPromise: null,
|
||||
initialize: function preferencesInitialize() {
|
||||
return this.initializedPromise = getDefaultPreferences().then(function (defaults) {
|
||||
return this.initializedPromise = getDefaultPreferences().then(defaults => {
|
||||
Object.defineProperty(this, 'defaults', {
|
||||
value: Object.freeze(defaults),
|
||||
writable: false,
|
||||
@ -2737,12 +2737,12 @@ var Preferences = {
|
||||
});
|
||||
this.prefs = cloneObj(defaults);
|
||||
return this._readFromStorage(defaults);
|
||||
}.bind(this)).then(function (prefObj) {
|
||||
}).then(prefObj => {
|
||||
this.isInitializedPromiseResolved = true;
|
||||
if (prefObj) {
|
||||
this.prefs = prefObj;
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
_writeToStorage: function preferences_writeToStorage(prefObj) {
|
||||
return Promise.resolve();
|
||||
@ -2751,22 +2751,22 @@ var Preferences = {
|
||||
return Promise.resolve();
|
||||
},
|
||||
reset: function preferencesReset() {
|
||||
return this.initializedPromise.then(function () {
|
||||
return this.initializedPromise.then(() => {
|
||||
this.prefs = cloneObj(this.defaults);
|
||||
return this._writeToStorage(this.defaults);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
reload: function preferencesReload() {
|
||||
return this.initializedPromise.then(function () {
|
||||
this._readFromStorage(this.defaults).then(function (prefObj) {
|
||||
return this.initializedPromise.then(() => {
|
||||
this._readFromStorage(this.defaults).then(prefObj => {
|
||||
if (prefObj) {
|
||||
this.prefs = prefObj;
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
},
|
||||
set: function preferencesSet(name, value) {
|
||||
return this.initializedPromise.then(function () {
|
||||
return this.initializedPromise.then(() => {
|
||||
if (this.defaults[name] === undefined) {
|
||||
throw new Error('preferencesSet: \'' + name + '\' is undefined.');
|
||||
} else if (value === undefined) {
|
||||
@ -2787,10 +2787,10 @@ var Preferences = {
|
||||
}
|
||||
this.prefs[name] = value;
|
||||
return this._writeToStorage(this.prefs);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
get: function preferencesGet(name) {
|
||||
return this.initializedPromise.then(function () {
|
||||
return this.initializedPromise.then(() => {
|
||||
var defaultValue = this.defaults[name];
|
||||
if (defaultValue === undefined) {
|
||||
throw new Error('preferencesGet: \'' + name + '\' is undefined.');
|
||||
@ -2801,7 +2801,7 @@ var Preferences = {
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
;
|
||||
@ -3023,7 +3023,7 @@ var PDFFindController = function PDFFindControllerClosure() {
|
||||
}
|
||||
this.state = state;
|
||||
this.updateUIState(FindStates.FIND_PENDING);
|
||||
this._firstPagePromise.then(function () {
|
||||
this._firstPagePromise.then(() => {
|
||||
this.extractText();
|
||||
clearTimeout(this.findTimeout);
|
||||
if (cmd === 'find') {
|
||||
@ -3031,7 +3031,7 @@ var PDFFindController = function PDFFindControllerClosure() {
|
||||
} else {
|
||||
this.nextMatch();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
updatePage: function PDFFindController_updatePage(index) {
|
||||
if (this.selected.pageIdx === index) {
|
||||
@ -3345,12 +3345,12 @@ var DownloadManager = function DownloadManagerClosure() {
|
||||
blobUrl: blobUrl,
|
||||
originalUrl: url,
|
||||
filename: filename
|
||||
}, function response(err) {
|
||||
}, err => {
|
||||
if (err && this.onerror) {
|
||||
this.onerror(err);
|
||||
}
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
return DownloadManager;
|
||||
@ -3729,17 +3729,17 @@ var HandTool = function HandToolClosure() {
|
||||
this.wasActive = false;
|
||||
this.handTool = new _grab_to_pan.GrabToPan({
|
||||
element: this.container,
|
||||
onActiveChanged: function (isActive) {
|
||||
onActiveChanged: isActive => {
|
||||
this.eventBus.dispatch('handtoolchanged', { isActive: isActive });
|
||||
}.bind(this)
|
||||
}
|
||||
});
|
||||
this.eventBus.on('togglehandtool', this.toggle.bind(this));
|
||||
Promise.all([_ui_utils.localized, _preferences.Preferences.get('enableHandToolOnLoad')]).then(function resolved(values) {
|
||||
Promise.all([_ui_utils.localized, _preferences.Preferences.get('enableHandToolOnLoad')]).then(values => {
|
||||
if (values[1] === true) {
|
||||
this.handTool.activate();
|
||||
}
|
||||
}.bind(this)).catch(function rejected(reason) {});
|
||||
this.eventBus.on('presentationmodechanged', function (e) {
|
||||
}).catch(function rejected(reason) {});
|
||||
this.eventBus.on('presentationmodechanged', e => {
|
||||
if (e.switchInProgress) {
|
||||
return;
|
||||
}
|
||||
@ -3748,7 +3748,7 @@ var HandTool = function HandToolClosure() {
|
||||
} else {
|
||||
this.exitPresentationMode();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
HandTool.prototype = {
|
||||
get isActive() {
|
||||
@ -3894,10 +3894,10 @@ var PDFAttachmentViewer = function PDFAttachmentViewerClosure() {
|
||||
};
|
||||
},
|
||||
_bindLink: function PDFAttachmentViewer_bindLink(button, content, filename) {
|
||||
button.onclick = function downloadFile(e) {
|
||||
button.onclick = e => {
|
||||
this.downloadManager.downloadData(content, filename, '');
|
||||
return false;
|
||||
}.bind(this);
|
||||
};
|
||||
},
|
||||
render: function PDFAttachmentViewer_render(params) {
|
||||
params = params || {};
|
||||
@ -4636,14 +4636,14 @@ var PDFOutlineViewer = function PDFOutlineViewerClosure() {
|
||||
_addToggleButton: function PDFOutlineViewer_addToggleButton(div) {
|
||||
var toggler = document.createElement('div');
|
||||
toggler.className = 'outlineItemToggler';
|
||||
toggler.onclick = function (event) {
|
||||
toggler.onclick = event => {
|
||||
event.stopPropagation();
|
||||
toggler.classList.toggle('outlineItemsHidden');
|
||||
if (event.shiftKey) {
|
||||
var shouldShowAll = !toggler.classList.contains('outlineItemsHidden');
|
||||
this._toggleOutlineItem(div, shouldShowAll);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
div.insertBefore(toggler, div.firstChild);
|
||||
},
|
||||
_toggleOutlineItem: function PDFOutlineViewer_toggleOutlineItem(root, show) {
|
||||
@ -5202,22 +5202,22 @@ var PDFPresentationMode = function PDFPresentationModeClosure() {
|
||||
this.mouseScrollDelta = 0;
|
||||
this.touchSwipeState = null;
|
||||
if (contextMenuItems) {
|
||||
contextMenuItems.contextFirstPage.addEventListener('click', function PDFPresentationMode_contextFirstPageClick(e) {
|
||||
contextMenuItems.contextFirstPage.addEventListener('click', e => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('firstpage');
|
||||
}.bind(this));
|
||||
contextMenuItems.contextLastPage.addEventListener('click', function PDFPresentationMode_contextLastPageClick(e) {
|
||||
});
|
||||
contextMenuItems.contextLastPage.addEventListener('click', e => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('lastpage');
|
||||
}.bind(this));
|
||||
contextMenuItems.contextPageRotateCw.addEventListener('click', function PDFPresentationMode_contextPageRotateCwClick(e) {
|
||||
});
|
||||
contextMenuItems.contextPageRotateCw.addEventListener('click', e => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('rotatecw');
|
||||
}.bind(this));
|
||||
contextMenuItems.contextPageRotateCcw.addEventListener('click', function PDFPresentationMode_contextPageRotateCcwClick(e) {
|
||||
});
|
||||
contextMenuItems.contextPageRotateCcw.addEventListener('click', e => {
|
||||
this.contextMenuOpen = false;
|
||||
this.eventBus.dispatch('rotateccw');
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
PDFPresentationMode.prototype = {
|
||||
@ -5301,11 +5301,11 @@ var PDFPresentationMode = function PDFPresentationModeClosure() {
|
||||
if (this.switchInProgress) {
|
||||
clearTimeout(this.switchInProgress);
|
||||
}
|
||||
this.switchInProgress = setTimeout(function switchInProgressTimeout() {
|
||||
this.switchInProgress = setTimeout(() => {
|
||||
this._removeFullscreenChangeListeners();
|
||||
delete this.switchInProgress;
|
||||
this._notifyStateChange();
|
||||
}.bind(this), DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);
|
||||
}, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);
|
||||
},
|
||||
_resetSwitchInProgress: function PDFPresentationMode_resetSwitchInProgress() {
|
||||
if (this.switchInProgress) {
|
||||
@ -5318,10 +5318,10 @@ var PDFPresentationMode = function PDFPresentationModeClosure() {
|
||||
this._resetSwitchInProgress();
|
||||
this._notifyStateChange();
|
||||
this.container.classList.add(ACTIVE_SELECTOR);
|
||||
setTimeout(function enterPresentationModeTimeout() {
|
||||
setTimeout(() => {
|
||||
this.pdfViewer.currentPageNumber = this.args.page;
|
||||
this.pdfViewer.currentScaleValue = 'page-fit';
|
||||
}.bind(this), 0);
|
||||
}, 0);
|
||||
this._addWindowListeners();
|
||||
this._showControls();
|
||||
this.contextMenuOpen = false;
|
||||
@ -5331,14 +5331,14 @@ var PDFPresentationMode = function PDFPresentationModeClosure() {
|
||||
_exit: function PDFPresentationMode_exit() {
|
||||
var page = this.pdfViewer.currentPageNumber;
|
||||
this.container.classList.remove(ACTIVE_SELECTOR);
|
||||
setTimeout(function exitPresentationModeTimeout() {
|
||||
setTimeout(() => {
|
||||
this.active = false;
|
||||
this._removeFullscreenChangeListeners();
|
||||
this._notifyStateChange();
|
||||
this.pdfViewer.currentScaleValue = this.args.previousScale;
|
||||
this.pdfViewer.currentPageNumber = page;
|
||||
this.args = null;
|
||||
}.bind(this), 0);
|
||||
}, 0);
|
||||
this._removeWindowListeners();
|
||||
this._hideControls();
|
||||
this._resetMouseScrollState();
|
||||
@ -5368,10 +5368,10 @@ var PDFPresentationMode = function PDFPresentationModeClosure() {
|
||||
} else {
|
||||
this.container.classList.add(CONTROLS_SELECTOR);
|
||||
}
|
||||
this.controlsTimeout = setTimeout(function showControlsTimeout() {
|
||||
this.controlsTimeout = setTimeout(() => {
|
||||
this.container.classList.remove(CONTROLS_SELECTOR);
|
||||
delete this.controlsTimeout;
|
||||
}.bind(this), DELAY_BEFORE_HIDING_CONTROLS);
|
||||
}, DELAY_BEFORE_HIDING_CONTROLS);
|
||||
},
|
||||
_hideControls: function PDFPresentationMode_hideControls() {
|
||||
if (!this.controlsTimeout) {
|
||||
@ -5709,7 +5709,7 @@ var PDFSidebar = function PDFSidebarClosure() {
|
||||
if (this.disableNotification) {
|
||||
return;
|
||||
}
|
||||
var removeNotification = function (view) {
|
||||
var removeNotification = view => {
|
||||
switch (view) {
|
||||
case SidebarView.OUTLINE:
|
||||
this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS);
|
||||
@ -5718,7 +5718,7 @@ var PDFSidebar = function PDFSidebarClosure() {
|
||||
this.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS);
|
||||
break;
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
if (!this.isOpen && view !== null) {
|
||||
return;
|
||||
}
|
||||
@ -6166,7 +6166,7 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
|
||||
if (!pdfDocument) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return pdfDocument.getPage(1).then(function (firstPage) {
|
||||
return pdfDocument.getPage(1).then(firstPage => {
|
||||
var pagesCount = pdfDocument.numPages;
|
||||
var viewport = firstPage.getViewport(1.0);
|
||||
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
||||
@ -6180,7 +6180,7 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
|
||||
});
|
||||
this.thumbnails.push(thumbnail);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
_cancelRendering: function PDFThumbnailViewer_cancelRendering() {
|
||||
for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
|
||||
@ -6215,11 +6215,11 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
|
||||
if (this._pagesRequests[pageNumber]) {
|
||||
return this._pagesRequests[pageNumber];
|
||||
}
|
||||
var promise = this.pdfDocument.getPage(pageNumber).then(function (pdfPage) {
|
||||
var promise = this.pdfDocument.getPage(pageNumber).then(pdfPage => {
|
||||
thumbView.setPdfPage(pdfPage);
|
||||
this._pagesRequests[pageNumber] = null;
|
||||
return pdfPage;
|
||||
}.bind(this));
|
||||
});
|
||||
this._pagesRequests[pageNumber] = promise;
|
||||
return promise;
|
||||
},
|
||||
@ -6227,9 +6227,9 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
|
||||
var visibleThumbs = this._getVisibleThumbs();
|
||||
var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this.thumbnails, this.scroll.down);
|
||||
if (thumbView) {
|
||||
this._ensurePdfPageLoaded(thumbView).then(function () {
|
||||
this._ensurePdfPageLoaded(thumbView).then(() => {
|
||||
this.renderingQueue.renderView(thumbView);
|
||||
}.bind(this));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -7159,11 +7159,11 @@ var TextLayerBuilder = function TextLayerBuilderClosure() {
|
||||
timeout: timeout,
|
||||
enhanceTextSelection: this.enhanceTextSelection
|
||||
});
|
||||
this.textLayerRenderTask.promise.then(function () {
|
||||
this.textLayerRenderTask.promise.then(() => {
|
||||
this.textLayerDiv.appendChild(textLayerFrag);
|
||||
this._finishRendering();
|
||||
this.updateMatches();
|
||||
}.bind(this), function (reason) {});
|
||||
}, function (reason) {});
|
||||
},
|
||||
cancel: function TextLayerBuilder_cancel() {
|
||||
if (this.textLayerRenderTask) {
|
||||
@ -7564,7 +7564,7 @@ var ViewHistory = function ViewHistoryClosure() {
|
||||
this.fingerprint = fingerprint;
|
||||
this.cacheSize = cacheSize || DEFAULT_VIEW_HISTORY_CACHE_SIZE;
|
||||
this.isInitializedPromiseResolved = false;
|
||||
this.initializedPromise = this._readFromStorage().then(function (databaseStr) {
|
||||
this.initializedPromise = this._readFromStorage().then(databaseStr => {
|
||||
this.isInitializedPromiseResolved = true;
|
||||
var database = JSON.parse(databaseStr || '{}');
|
||||
if (!('files' in database)) {
|
||||
@ -7586,15 +7586,15 @@ var ViewHistory = function ViewHistoryClosure() {
|
||||
}
|
||||
this.file = database.files[index];
|
||||
this.database = database;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
ViewHistory.prototype = {
|
||||
_writeToStorage: function ViewHistory_writeToStorage() {
|
||||
return new Promise(function (resolve) {
|
||||
return new Promise(resolve => {
|
||||
var databaseStr = JSON.stringify(this.database);
|
||||
sessionStorage.setItem('pdfjs.history', databaseStr);
|
||||
resolve();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
_readFromStorage: function ViewHistory_readFromStorage() {
|
||||
return new Promise(function (resolve) {
|
||||
|
@ -591,14 +591,14 @@ var DirectoryLinksProvider = {
|
||||
|
||||
// Only check base domain for images when using the default pref
|
||||
let checkBase = !this.__linksURLModified;
|
||||
let validityFilter = function(link) {
|
||||
let validityFilter = link => {
|
||||
// Make sure the link url is allowed and images too if they exist
|
||||
return this.isURLAllowed(link.url, ALLOWED_LINK_SCHEMES, false) &&
|
||||
(!link.imageURI ||
|
||||
this.isURLAllowed(link.imageURI, ALLOWED_IMAGE_SCHEMES, checkBase)) &&
|
||||
(!link.enhancedImageURI ||
|
||||
this.isURLAllowed(link.enhancedImageURI, ALLOWED_IMAGE_SCHEMES, checkBase));
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
rawLinks.suggested.filter(validityFilter).forEach((link, position) => {
|
||||
// Suggested sites must have an adgroup name.
|
||||
|
@ -388,11 +388,11 @@ this.SocialService = {
|
||||
SocialServiceInternal.providers[provider.origin] = provider;
|
||||
ActiveProviders.add(provider.origin);
|
||||
|
||||
this.getOrderedProviderList(function(providers) {
|
||||
this.getOrderedProviderList(providers => {
|
||||
this._notifyProviderListeners("provider-enabled", provider.origin, providers);
|
||||
if (onDone)
|
||||
onDone(provider);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
// Removes a provider with the given origin, and notifies when the removal is
|
||||
@ -421,11 +421,11 @@ this.SocialService = {
|
||||
AddonManagerPrivate.callAddonListeners("onDisabled", addon);
|
||||
}
|
||||
|
||||
this.getOrderedProviderList(function(providers) {
|
||||
this.getOrderedProviderList(providers => {
|
||||
this._notifyProviderListeners("provider-disabled", origin, providers);
|
||||
if (onDone)
|
||||
onDone();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
// Returns a single provider object with the specified origin. The provider
|
||||
@ -575,12 +575,12 @@ this.SocialService = {
|
||||
// origin on the manifest.
|
||||
data.manifest = manifest;
|
||||
let id = getAddonIDFromOrigin(manifest.origin);
|
||||
AddonManager.getAddonByID(id, function(aAddon) {
|
||||
AddonManager.getAddonByID(id, aAddon => {
|
||||
if (aAddon && aAddon.userDisabled) {
|
||||
aAddon.cancelUninstall();
|
||||
aAddon.userDisabled = false;
|
||||
}
|
||||
schedule(function() {
|
||||
schedule(() => {
|
||||
try {
|
||||
this._installProvider(data, options, aManifest => {
|
||||
this._notifyProviderListeners("provider-installed", aManifest.origin);
|
||||
@ -590,8 +590,8 @@ this.SocialService = {
|
||||
Cu.reportError("Activation failed: " + e);
|
||||
installCallback(null);
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_installProvider(data, options, installCallback) {
|
||||
@ -1052,9 +1052,9 @@ AddonWrapper.prototype = {
|
||||
let prefName = getPrefnameFromOrigin(this.manifest.origin);
|
||||
if (Services.prefs.prefHasUserValue(prefName)) {
|
||||
if (ActiveProviders.has(this.manifest.origin)) {
|
||||
SocialService.disableProvider(this.manifest.origin, function() {
|
||||
SocialService.disableProvider(this.manifest.origin, () => {
|
||||
SocialAddonProvider.removeAddon(this, aCallback);
|
||||
}.bind(this));
|
||||
});
|
||||
} else {
|
||||
SocialAddonProvider.removeAddon(this, aCallback);
|
||||
}
|
||||
|
@ -268,13 +268,13 @@ var { helpers, assert } = (function () {
|
||||
* @return A promise resolved with the event object when the event first happens
|
||||
*/
|
||||
helpers.listenOnce = function (element, event, useCapture) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var onEvent = function (ev) {
|
||||
element.removeEventListener(event, onEvent, useCapture);
|
||||
resolve(ev);
|
||||
};
|
||||
element.addEventListener(event, onEvent, useCapture);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -287,13 +287,13 @@ var { helpers, assert } = (function () {
|
||||
* function other parameters are dropped.
|
||||
*/
|
||||
helpers.observeOnce = function (topic, ownsWeak = false) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let resolver = function (subject) {
|
||||
Services.obs.removeObserver(resolver, topic);
|
||||
resolve(subject);
|
||||
};
|
||||
Services.obs.addObserver(resolver, topic, ownsWeak);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -553,9 +553,9 @@ var { helpers, assert } = (function () {
|
||||
},
|
||||
|
||||
unassigned: function (options) {
|
||||
return options.requisition._unassigned.map(function (assignment) {
|
||||
return options.requisition._unassigned.map(assignment => {
|
||||
return assignment.arg.toString();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
outputState: function (options) {
|
||||
@ -604,7 +604,7 @@ var { helpers, assert } = (function () {
|
||||
var hintsPromise = helpers._actual.hints(options);
|
||||
var predictionsPromise = helpers._actual.predictions(options);
|
||||
|
||||
return Promise.all([ hintsPromise, predictionsPromise ]).then(function (values) {
|
||||
return Promise.all([ hintsPromise, predictionsPromise ]).then(values => {
|
||||
var hints = values[0];
|
||||
var predictions = values[1];
|
||||
var output = "";
|
||||
@ -674,7 +674,7 @@ var { helpers, assert } = (function () {
|
||||
output += "]);";
|
||||
|
||||
return output;
|
||||
}.bind(this), util.errorHandler);
|
||||
}, util.errorHandler);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1001,7 +1001,7 @@ var { helpers, assert } = (function () {
|
||||
}
|
||||
|
||||
try {
|
||||
return requisition.exec({ hidden: true }).then(function (output) {
|
||||
return requisition.exec({ hidden: true }).then(output => {
|
||||
if ("type" in expected) {
|
||||
assert.is(output.type,
|
||||
expected.type,
|
||||
@ -1084,7 +1084,7 @@ var { helpers, assert } = (function () {
|
||||
}
|
||||
return { output: output, text: textOutput };
|
||||
});
|
||||
}.bind(this)).then(function (data) {
|
||||
}).then(function (data) {
|
||||
if (expected.error) {
|
||||
cli.logErrors = origLogErrors;
|
||||
}
|
||||
|
@ -47,16 +47,16 @@ function createExec(name) {
|
||||
return function (args, context) {
|
||||
var promises = [];
|
||||
|
||||
Object.keys(args).map(function (argName) {
|
||||
Object.keys(args).map(argName => {
|
||||
var value = args[argName];
|
||||
var type = this.getParameterByName(argName).type;
|
||||
var promise = Promise.resolve(type.stringify(value, context));
|
||||
promises.push(promise.then(function (str) {
|
||||
promises.push(promise.then(str => {
|
||||
return { name: argName, value: str };
|
||||
}.bind(this)));
|
||||
}.bind(this));
|
||||
}));
|
||||
});
|
||||
|
||||
return Promise.all(promises).then(function (data) {
|
||||
return Promise.all(promises).then(data => {
|
||||
var argValues = {};
|
||||
data.forEach(function (entry) { argValues[entry.name] = entry.value; });
|
||||
|
||||
@ -64,7 +64,7 @@ function createExec(name) {
|
||||
name: name,
|
||||
args: argValues
|
||||
});
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
} else {
|
||||
root.prettyFast = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
}(this, () => {
|
||||
"use strict";
|
||||
|
||||
var acorn = this.acorn || __webpack_require__(803);
|
||||
@ -952,7 +952,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
return result.toStringWithSourceMap({ file: options.url });
|
||||
};
|
||||
|
||||
}.bind(this)));
|
||||
}));
|
||||
|
||||
|
||||
/***/ },
|
||||
|
@ -48,7 +48,7 @@ DevToolsStartup.prototype = {
|
||||
this.handleDebuggerServerFlag(cmdLine, debuggerServerFlag);
|
||||
}
|
||||
|
||||
let onStartup = function (window) {
|
||||
let onStartup = window => {
|
||||
Services.obs.removeObserver(onStartup,
|
||||
"browser-delayed-startup-finished");
|
||||
// Ensure loading core module once firefox is ready
|
||||
@ -57,7 +57,7 @@ DevToolsStartup.prototype = {
|
||||
if (devtoolsFlag) {
|
||||
this.handleDevToolsFlag(window);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
Services.obs.addObserver(onStartup, "browser-delayed-startup-finished");
|
||||
},
|
||||
|
||||
|
@ -110,13 +110,13 @@ RuleEditor.prototype = {
|
||||
this.source = createChild(this.element, "div", {
|
||||
class: "ruleview-rule-source theme-link"
|
||||
});
|
||||
this.source.addEventListener("click", function () {
|
||||
this.source.addEventListener("click", () => {
|
||||
if (this.source.hasAttribute("unselectable")) {
|
||||
return;
|
||||
}
|
||||
let rule = this.rule.domRule;
|
||||
this.ruleView.emit("ruleview-linked-clicked", rule);
|
||||
}.bind(this));
|
||||
});
|
||||
let sourceLabel = this.doc.createElement("span");
|
||||
sourceLabel.classList.add("ruleview-rule-source-label");
|
||||
this.source.appendChild(sourceLabel);
|
||||
|
@ -98,17 +98,17 @@ PerformanceTelemetry.prototype.recordLogs = function () {
|
||||
let originalLogKeyed = this._telemetry.logKeyed;
|
||||
this._log = {};
|
||||
|
||||
this._telemetry.log = (function (histo, data) {
|
||||
this._telemetry.log = (histo, data) => {
|
||||
let results = this._log[histo] = this._log[histo] || [];
|
||||
results.push(data);
|
||||
originalLog(histo, data);
|
||||
}).bind(this);
|
||||
};
|
||||
|
||||
this._telemetry.logKeyed = (function (histo, key, data) {
|
||||
this._telemetry.logKeyed = (histo, key, data) => {
|
||||
let results = this._log[histo] = this._log[histo] || [];
|
||||
results.push([key, data]);
|
||||
originalLogKeyed(histo, key, data);
|
||||
}).bind(this);
|
||||
};
|
||||
};
|
||||
|
||||
PerformanceTelemetry.prototype.getLogs = function () {
|
||||
|
@ -520,7 +520,7 @@ StyleEditorUI.prototype = {
|
||||
},
|
||||
disableAnimations: this._alwaysDisableAnimations,
|
||||
ordinal: ordinal,
|
||||
onCreate: function (summary, details, data) {
|
||||
onCreate: (summary, details, data) => {
|
||||
let createdEditor = data.editor;
|
||||
createdEditor.summary = summary;
|
||||
createdEditor.details = details;
|
||||
@ -595,9 +595,9 @@ StyleEditorUI.prototype = {
|
||||
this._selectEditor(createdEditor);
|
||||
}
|
||||
this.emit("editor-added", createdEditor);
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
onShow: function (summary, details, data) {
|
||||
onShow: (summary, details, data) => {
|
||||
let showEditor = data.editor;
|
||||
this.selectedEditor = showEditor;
|
||||
|
||||
@ -637,7 +637,7 @@ StyleEditorUI.prototype = {
|
||||
}
|
||||
}
|
||||
}.bind(this)).then(null, e => console.error(e));
|
||||
}.bind(this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -31,10 +31,10 @@ exports.items = [
|
||||
let contentWindow = context.environment.window;
|
||||
|
||||
let dbg = new Debugger(contentWindow);
|
||||
dbg.onEnterFrame = function (frame) {
|
||||
dbg.onEnterFrame = frame => {
|
||||
// BUG 773652 - Make the output from the GCLI calllog command nicer
|
||||
contentWindow.console.log("Method call: " + this.callDescription(frame));
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
debuggers.push(dbg);
|
||||
|
||||
@ -162,11 +162,11 @@ exports.items = [
|
||||
let dbg = new Debugger(globalObj);
|
||||
chromeDebuggers.push(dbg);
|
||||
|
||||
dbg.onEnterFrame = function (frame) {
|
||||
dbg.onEnterFrame = frame => {
|
||||
// BUG 773652 - Make the output from the GCLI calllog command nicer
|
||||
contentWindow.console.log(l10n.lookup("callLogChromeMethodCall") +
|
||||
": " + this.callDescription(frame));
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
let gBrowser = context.environment.chromeDocument.defaultView.gBrowser;
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
@ -200,7 +200,7 @@ Assignment.prototype.getPredictionRanked = function(context, rank) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return this.getPredictions(context).then(function(predictions) {
|
||||
return this.getPredictions(context).then(predictions => {
|
||||
if (predictions.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
@ -210,7 +210,7 @@ Assignment.prototype.getPredictionRanked = function(context, rank) {
|
||||
rank = predictions.length + rank;
|
||||
}
|
||||
return predictions[rank];
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -874,7 +874,7 @@ Requisition.prototype.toCanonicalString = function() {
|
||||
var ctx = this.executionContext;
|
||||
|
||||
// First stringify all the arguments
|
||||
var argPromise = util.promiseEach(this.getAssignments(), function(assignment) {
|
||||
var argPromise = util.promiseEach(this.getAssignments(), assignment => {
|
||||
// Bug 664377: This will cause problems if there is a non-default value
|
||||
// after a default value. Also we need to decide when to use
|
||||
// named parameters in place of positional params. Both can wait.
|
||||
@ -883,14 +883,14 @@ Requisition.prototype.toCanonicalString = function() {
|
||||
}
|
||||
|
||||
var val = assignment.param.type.stringify(assignment.value, ctx);
|
||||
return Promise.resolve(val).then(function(str) {
|
||||
return Promise.resolve(val).then(str => {
|
||||
return ' ' + str;
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
|
||||
return argPromise.then(function(strings) {
|
||||
return argPromise.then(strings => {
|
||||
return cmd + strings.join('') + lineSuffix;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -923,9 +923,9 @@ Object.defineProperty(Requisition.prototype, '_summaryJson', {
|
||||
})
|
||||
};
|
||||
|
||||
Object.keys(this._assignments).forEach(function(name) {
|
||||
Object.keys(this._assignments).forEach(name => {
|
||||
summary[name] = this.getAssignment(name)._summaryJson;
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return summary;
|
||||
},
|
||||
@ -1030,7 +1030,7 @@ Requisition.prototype.setAssignment = function(assignment, arg, options) {
|
||||
|
||||
var updateId = options.internal ? null : this._beginChange();
|
||||
|
||||
var setAssignmentInternal = function(conversion) {
|
||||
var setAssignmentInternal = conversion => {
|
||||
if (options.internal || this._isChangeCurrent(updateId)) {
|
||||
this._setAssignmentInternal(assignment, conversion);
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ Requisition.prototype.setAssignment = function(assignment, arg, options) {
|
||||
}
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (arg == null) {
|
||||
var blank = assignment.param.type.getBlank(this.executionContext);
|
||||
@ -1236,7 +1236,7 @@ Requisition.prototype.getStateData = function(start, rank) {
|
||||
current.getPredictionRanked(context, rank) :
|
||||
Promise.resolve(null);
|
||||
|
||||
return predictionPromise.then(function(prediction) {
|
||||
return predictionPromise.then(prediction => {
|
||||
// directTabText is for when the current input is a prefix of the completion
|
||||
// arrowTabText is for when we need to use an -> to show what will be used
|
||||
var directTabText = '';
|
||||
@ -1304,7 +1304,7 @@ Requisition.prototype.getStateData = function(start, rank) {
|
||||
// Generally each emptyParameter marker begins with a space to separate it
|
||||
// from whatever came before, unless what comes before ends in a space.
|
||||
|
||||
this.getAssignments().forEach(function(assignment) {
|
||||
this.getAssignments().forEach(assignment => {
|
||||
// Named arguments are handled with a group [options] marker
|
||||
if (!assignment.param.isPositionalAllowed) {
|
||||
return;
|
||||
@ -1325,7 +1325,7 @@ Requisition.prototype.getStateData = function(start, rank) {
|
||||
'[' + assignment.param.name + ']\u00a0';
|
||||
|
||||
emptyParameters.push(text);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
var command = this.commandAssignment.value;
|
||||
var addOptionsMarker = false;
|
||||
@ -1359,7 +1359,7 @@ Requisition.prototype.getStateData = function(start, rank) {
|
||||
arrowTabText: arrowTabText,
|
||||
emptyParameters: emptyParameters
|
||||
};
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1400,7 +1400,7 @@ Requisition.prototype.complete = function(cursor, rank) {
|
||||
|
||||
var context = this.executionContext;
|
||||
var predictionPromise = assignment.getPredictionRanked(context, rank);
|
||||
return predictionPromise.then(function(prediction) {
|
||||
return predictionPromise.then(prediction => {
|
||||
var outstanding = [];
|
||||
|
||||
// Note: Since complete is asynchronous we should perhaps have a system to
|
||||
@ -1436,24 +1436,24 @@ Requisition.prototype.complete = function(cursor, rank) {
|
||||
var assignPromise = this.setAssignment(assignment, arg);
|
||||
|
||||
if (!prediction.incomplete) {
|
||||
assignPromise = assignPromise.then(function() {
|
||||
assignPromise = assignPromise.then(() => {
|
||||
// The prediction is complete, add a space to let the user move-on
|
||||
return this._addSpace(assignment).then(function() {
|
||||
return this._addSpace(assignment).then(() => {
|
||||
// Bug 779443 - Remove or explain the re-parse
|
||||
if (assignment instanceof UnassignedAssignment) {
|
||||
return this.update(this.toString());
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
outstanding.push(assignPromise);
|
||||
}
|
||||
|
||||
return Promise.all(outstanding).then(function() {
|
||||
return Promise.all(outstanding).then(() => {
|
||||
return true;
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1462,15 +1462,15 @@ Requisition.prototype.complete = function(cursor, rank) {
|
||||
Requisition.prototype.nudge = function(assignment, by) {
|
||||
var ctx = this.executionContext;
|
||||
var val = assignment.param.type.nudge(assignment.value, by, ctx);
|
||||
return Promise.resolve(val).then(function(replacement) {
|
||||
return Promise.resolve(val).then(replacement => {
|
||||
if (replacement != null) {
|
||||
var val = assignment.param.type.stringify(replacement, ctx);
|
||||
return Promise.resolve(val).then(function(str) {
|
||||
return Promise.resolve(val).then(str => {
|
||||
var arg = assignment.arg.beget({ text: str });
|
||||
return this.setAssignment(assignment, arg);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1491,10 +1491,10 @@ function getDataCommandAttribute(element) {
|
||||
* change to the current command.
|
||||
*/
|
||||
Requisition.prototype._contextUpdate = function(typed) {
|
||||
return this.update(typed).then(function(reply) {
|
||||
return this.update(typed).then(reply => {
|
||||
this.onExternalUpdate({ typed: typed });
|
||||
return reply;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1520,9 +1520,9 @@ Requisition.prototype.update = function(typed) {
|
||||
|
||||
this._split(args);
|
||||
|
||||
return this._assign(args).then(function() {
|
||||
return this._assign(args).then(() => {
|
||||
return this._endChangeCheckOrder(updateId);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1826,9 +1826,9 @@ Requisition.prototype._split = function(args) {
|
||||
* Add all the passed args to the list of unassigned assignments.
|
||||
*/
|
||||
Requisition.prototype._addUnassignedArgs = function(args) {
|
||||
args.forEach(function(arg) {
|
||||
args.forEach(arg => {
|
||||
this._unassigned.push(new UnassignedAssignment(this, arg));
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return RESOLVED;
|
||||
};
|
||||
@ -1926,7 +1926,7 @@ Requisition.prototype._assign = function(args) {
|
||||
}, this);
|
||||
|
||||
// What's left are positional parameters: assign in order
|
||||
var positionalDone = namedDone.then(function() {
|
||||
var positionalDone = namedDone.then(() => {
|
||||
return util.promiseEach(unassignedParams, function(name) {
|
||||
var assignment = this.getAssignment(name);
|
||||
|
||||
@ -1972,20 +1972,20 @@ Requisition.prototype._assign = function(args) {
|
||||
return this.setAssignment(assignment, arg, noArgUp);
|
||||
}
|
||||
}, this);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Now we need to assign the array argument (if any)
|
||||
var arrayDone = positionalDone.then(function() {
|
||||
var arrayDone = positionalDone.then(() => {
|
||||
return util.promiseEach(Object.keys(arrayArgs), function(name) {
|
||||
var assignment = this.getAssignment(name);
|
||||
return this.setAssignment(assignment, arrayArgs[name], noArgUp);
|
||||
}, this);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// What's left is can't be assigned, but we need to officially unassign them
|
||||
return arrayDone.then(function() {
|
||||
return arrayDone.then(() => {
|
||||
return this._addUnassignedArgs(args);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2074,16 +2074,16 @@ Requisition.prototype.exec = function(options) {
|
||||
var ex = new Error(this.getStatusMessage());
|
||||
// We only reject a call to exec if GCLI breaks. Errors with commands are
|
||||
// exposed in the 'error' status of the Output object
|
||||
return Promise.resolve(onError(ex)).then(function(output) {
|
||||
return Promise.resolve(onError(ex)).then(output => {
|
||||
this.clear();
|
||||
return output;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
else {
|
||||
try {
|
||||
return host.exec(function() {
|
||||
return host.exec(() => {
|
||||
return command.exec(args, this.executionContext);
|
||||
}.bind(this)).then(onDone, onError);
|
||||
}).then(onDone, onError);
|
||||
}
|
||||
catch (ex) {
|
||||
var data = (typeof ex.message === 'string' && ex.stack != null) ?
|
||||
@ -2120,9 +2120,9 @@ Requisition.prototype._contextUpdateExec = function(typed, options) {
|
||||
* @return A promise of an output object
|
||||
*/
|
||||
Requisition.prototype.updateExec = function(input, options) {
|
||||
return this.update(input).then(function() {
|
||||
return this.update(input).then(() => {
|
||||
return this.exec(options);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
exports.Requisition = Requisition;
|
||||
@ -2144,9 +2144,9 @@ function Output(options) {
|
||||
this.error = false;
|
||||
this.start = new Date();
|
||||
|
||||
this.promise = new Promise(function(resolve, reject) {
|
||||
this.promise = new Promise((resolve, reject) => {
|
||||
this._resolve = resolve;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,14 +97,14 @@ function Command(types, commandSpec) {
|
||||
this.paramGroups = {};
|
||||
this._shortParams = {};
|
||||
|
||||
var addParam = function(param) {
|
||||
var addParam = param => {
|
||||
var groupName = param.groupName || l10n.lookup('canonDefaultGroupName');
|
||||
this.params.push(param);
|
||||
if (!this.paramGroups.hasOwnProperty(groupName)) {
|
||||
this.paramGroups[groupName] = [];
|
||||
}
|
||||
this.paramGroups[groupName].push(param);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
// Track if the user is trying to mix default params and param groups.
|
||||
// All the non-grouped parameters must come before all the param groups
|
||||
@ -185,11 +185,11 @@ Command.prototype.toJson = function(customProps) {
|
||||
}
|
||||
|
||||
if (Array.isArray(customProps)) {
|
||||
customProps.forEach(function(prop) {
|
||||
customProps.forEach(prop => {
|
||||
if (this[prop] != null) {
|
||||
json[prop] = this[prop];
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
return json;
|
||||
@ -469,12 +469,12 @@ Commands.prototype.getAll = function() {
|
||||
Commands.prototype.getCommandSpecs = function(customProps) {
|
||||
var commandSpecs = [];
|
||||
|
||||
Object.keys(this._commands).forEach(function(name) {
|
||||
Object.keys(this._commands).forEach(name => {
|
||||
var command = this._commands[name];
|
||||
if (!command.noRemote) {
|
||||
commandSpecs.push(command.toJson(customProps));
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return commandSpecs;
|
||||
};
|
||||
@ -507,13 +507,13 @@ Commands.prototype.addProxyCommands = function(commandSpecs, remoter, prefix, to
|
||||
});
|
||||
}
|
||||
|
||||
commandSpecs.forEach(function(commandSpec) {
|
||||
commandSpecs.forEach(commandSpec => {
|
||||
var originalName = commandSpec.name;
|
||||
if (!commandSpec.isParent) {
|
||||
commandSpec.exec = function(args, context) {
|
||||
commandSpec.exec = (args, context) => {
|
||||
context.commandName = originalName;
|
||||
return remoter(args, context);
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
|
||||
if (prefix != null) {
|
||||
@ -521,7 +521,7 @@ Commands.prototype.addProxyCommands = function(commandSpecs, remoter, prefix, to
|
||||
}
|
||||
commandSpec.isProxy = true;
|
||||
this.add(commandSpec);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -530,14 +530,14 @@ Commands.prototype.addProxyCommands = function(commandSpecs, remoter, prefix, to
|
||||
*/
|
||||
Commands.prototype.removeProxyCommands = function(prefix) {
|
||||
var toRemove = [];
|
||||
Object.keys(this._commandSpecs).forEach(function(name) {
|
||||
Object.keys(this._commandSpecs).forEach(name => {
|
||||
if (name.indexOf(prefix) === 0) {
|
||||
toRemove.push(name);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
var removed = [];
|
||||
toRemove.forEach(function(name) {
|
||||
toRemove.forEach(name => {
|
||||
var command = this.get(name);
|
||||
if (command.isProxy) {
|
||||
this.remove(name);
|
||||
@ -547,7 +547,7 @@ Commands.prototype.removeProxyCommands = function(prefix) {
|
||||
console.error('Skipping removal of \'' + name +
|
||||
'\' because it is not a proxy command.');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return removed;
|
||||
};
|
||||
|
@ -78,9 +78,9 @@ function getHelpManData(commandData, context) {
|
||||
*/
|
||||
}
|
||||
|
||||
return Promise.resolve(input).then(function(defaultDescr) {
|
||||
return Promise.resolve(input).then(defaultDescr => {
|
||||
return '(' + (param.type.name || param.type) + ', ' + defaultDescr + ')';
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
getSynopsis: function(param) {
|
||||
var name = param.name + (param.short ? '|-' + param.short : '');
|
||||
|
@ -133,13 +133,13 @@ var prefList = {
|
||||
exec: function(args, context) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// This can be slow, get out of the way of the main thread
|
||||
setTimeout(function() {
|
||||
setTimeout(() => {
|
||||
var prefsData = {
|
||||
settings: context.system.settings.getAll(args.search),
|
||||
search: args.search
|
||||
};
|
||||
resolve(prefsData);
|
||||
}.bind(this), 10);
|
||||
}, 10);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -56,9 +56,9 @@ Connection.prototype.off = function(event, action) {
|
||||
}
|
||||
var actions = this._listeners[event];
|
||||
if (actions) {
|
||||
this._listeners[event] = actions.filter(function(li) {
|
||||
this._listeners[event] = actions.filter(li => {
|
||||
return li !== action;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -71,7 +71,7 @@ Connection.prototype._emit = function(event, data) {
|
||||
}
|
||||
|
||||
var listeners = this._listeners[event];
|
||||
listeners.forEach(function(listener) {
|
||||
listeners.forEach(listener => {
|
||||
// Fail fast if we mutate the list of listeners while emitting
|
||||
if (listeners !== this._listeners[event]) {
|
||||
throw new Error('Listener list changed while emitting');
|
||||
@ -84,7 +84,7 @@ Connection.prototype._emit = function(event, data) {
|
||||
console.log('Error calling listeners to ' + event);
|
||||
console.error(ex);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -131,9 +131,9 @@ Connectors.prototype.remove = function(connector) {
|
||||
* Get access to the list of known connectors
|
||||
*/
|
||||
Connectors.prototype.getAll = function() {
|
||||
return Object.keys(this._registered).map(function(name) {
|
||||
return Object.keys(this._registered).map(name => {
|
||||
return this._registered[name];
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
var defaultConnectorName;
|
||||
|
@ -220,9 +220,9 @@ Converters.prototype.get = function(from, to) {
|
||||
* Get all the registered converters. Most for debugging
|
||||
*/
|
||||
Converters.prototype.getAll = function() {
|
||||
return Object.keys(this._registered.from).map(function(name) {
|
||||
return Object.keys(this._registered.from).map(name => {
|
||||
return this._registered.from[name];
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -257,15 +257,15 @@ Converters.prototype.convert = function(data, from, to, conversionContext) {
|
||||
}
|
||||
|
||||
var converter = this.get(from, to);
|
||||
return host.exec(function() {
|
||||
return host.exec(() => {
|
||||
return converter.exec(data, conversionContext);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
catch (ex) {
|
||||
var converter = this.get('error', to);
|
||||
return host.exec(function() {
|
||||
return host.exec(() => {
|
||||
return converter.exec(ex, conversionContext);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ SelectionField.prototype.setConversion = function(conversion) {
|
||||
this.setMessage(conversion.message);
|
||||
|
||||
var context = this.requisition.executionContext;
|
||||
conversion.getPredictions(context).then(function(predictions) {
|
||||
conversion.getPredictions(context).then(predictions => {
|
||||
var items = predictions.map(function(prediction) {
|
||||
// If the prediction value is an 'item' (that is an object with a name and
|
||||
// description) then use that, otherwise use the prediction itself, because
|
||||
@ -77,17 +77,17 @@ SelectionField.prototype.setConversion = function(conversion) {
|
||||
if (this.menu != null) {
|
||||
this.menu.show(items, conversion.arg.text);
|
||||
}
|
||||
}.bind(this)).catch(util.errorHandler);
|
||||
}).catch(util.errorHandler);
|
||||
};
|
||||
|
||||
SelectionField.prototype.itemClicked = function(ev) {
|
||||
var arg = new Argument(ev.name, '', ' ');
|
||||
var context = this.requisition.executionContext;
|
||||
|
||||
this.type.parse(arg, context).then(function(conversion) {
|
||||
this.type.parse(arg, context).then(conversion => {
|
||||
this.onFieldChange({ conversion: conversion });
|
||||
this.setMessage(conversion.message);
|
||||
}.bind(this)).catch(util.errorHandler);
|
||||
}).catch(util.errorHandler);
|
||||
};
|
||||
|
||||
SelectionField.prototype.getConversion = function() {
|
||||
|
@ -97,7 +97,7 @@ var commandLanguage = exports.commandLanguage = {
|
||||
commandHtmlPromise = host.staticRequire(module, './command.html');
|
||||
}
|
||||
|
||||
return commandHtmlPromise.then(function(commandHtml) {
|
||||
return commandHtmlPromise.then(commandHtml => {
|
||||
this.commandDom = host.toDom(this.document, commandHtml);
|
||||
|
||||
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
|
||||
@ -107,7 +107,7 @@ var commandLanguage = exports.commandLanguage = {
|
||||
this.requisition.onExternalUpdate.add(this.textChanged, this);
|
||||
|
||||
return this;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
@ -249,11 +249,11 @@ var commandLanguage = exports.commandLanguage = {
|
||||
// If the user is on a valid value, then we increment the value, but if
|
||||
// they've typed something that's not right we page through predictions
|
||||
if (this.assignment.getStatus() === Status.VALID) {
|
||||
return this.requisition.nudge(this.assignment, 1).then(function() {
|
||||
return this.requisition.nudge(this.assignment, 1).then(() => {
|
||||
this.textChanged();
|
||||
this.focusManager.onInputChange();
|
||||
return true;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve(false);
|
||||
@ -264,11 +264,11 @@ var commandLanguage = exports.commandLanguage = {
|
||||
*/
|
||||
handleDownArrow: function() {
|
||||
if (this.assignment.getStatus() === Status.VALID) {
|
||||
return this.requisition.nudge(this.assignment, -1).then(function() {
|
||||
return this.requisition.nudge(this.assignment, -1).then(() => {
|
||||
this.textChanged();
|
||||
this.focusManager.onInputChange();
|
||||
return true;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve(false);
|
||||
@ -289,10 +289,10 @@ var commandLanguage = exports.commandLanguage = {
|
||||
this.terminal._previousValue = this.terminal.inputElement.value;
|
||||
this.terminal.inputElement.value = '';
|
||||
|
||||
return this.requisition.exec().then(function() {
|
||||
return this.requisition.exec().then(() => {
|
||||
this.textChanged();
|
||||
return true;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -313,14 +313,14 @@ var commandLanguage = exports.commandLanguage = {
|
||||
// the call to complete() we should avoid making changes before the end
|
||||
// of the event loop
|
||||
var index = this.terminal.getChoiceIndex();
|
||||
return this.requisition.complete(inputState.cursor, index).then(function(updated) {
|
||||
return this.requisition.complete(inputState.cursor, index).then(updated => {
|
||||
// Abort UI changes if this UI update has been overtaken
|
||||
if (!updated) {
|
||||
return RESOLVED;
|
||||
}
|
||||
this.textChanged();
|
||||
return this.terminal.unsetChoice();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -329,14 +329,14 @@ var commandLanguage = exports.commandLanguage = {
|
||||
handleInput: function(value) {
|
||||
this.terminal._caretChange = Caret.NO_CHANGE;
|
||||
|
||||
return this.requisition.update(value).then(function(updated) {
|
||||
return this.requisition.update(value).then(updated => {
|
||||
// Abort UI changes if this UI update has been overtaken
|
||||
if (!updated) {
|
||||
return RESOLVED;
|
||||
}
|
||||
this.textChanged();
|
||||
return this.terminal.unsetChoice();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -437,9 +437,9 @@ var commandLanguage = exports.commandLanguage = {
|
||||
*/
|
||||
fieldChanged: function(ev) {
|
||||
this.requisition.setAssignment(this.assignment, ev.conversion.arg,
|
||||
{ matchPadding: true }).then(function() {
|
||||
{ matchPadding: true }).then(() => {
|
||||
this.textChanged();
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
var isError = ev.conversion.message != null && ev.conversion.message !== '';
|
||||
this.focusManager.setError(isError);
|
||||
@ -473,7 +473,7 @@ var commandLanguage = exports.commandLanguage = {
|
||||
|
||||
domtemplate.template(template, data, templateOptions);
|
||||
|
||||
ev.output.promise.then(function() {
|
||||
ev.output.promise.then(() => {
|
||||
var document = data.rowoutEle.ownerDocument;
|
||||
|
||||
if (ev.output.completed) {
|
||||
@ -485,7 +485,7 @@ var commandLanguage = exports.commandLanguage = {
|
||||
|
||||
util.clearElement(data.rowoutEle);
|
||||
|
||||
return ev.output.convert('dom', context).then(function(node) {
|
||||
return ev.output.convert('dom', context).then(node => {
|
||||
this.terminal.scrollToBottom();
|
||||
data.throbEle.style.display = ev.output.completed ? 'none' : 'block';
|
||||
|
||||
@ -501,8 +501,8 @@ var commandLanguage = exports.commandLanguage = {
|
||||
event.initEvent('load', true, true);
|
||||
event.addedElement = node;
|
||||
node.dispatchEvent(event);
|
||||
}.bind(this));
|
||||
}.bind(this)).catch(console.error);
|
||||
});
|
||||
}).catch(console.error);
|
||||
|
||||
this.terminal.addElement(data.rowinEle);
|
||||
this.terminal.addElement(data.rowoutEle);
|
||||
|
@ -42,7 +42,7 @@ exports.items = [
|
||||
},
|
||||
|
||||
exec: function(input) {
|
||||
return this.evaluate(input).then(function(response) {
|
||||
return this.evaluate(input).then(response => {
|
||||
var output = (response.exception != null) ?
|
||||
response.exception.class :
|
||||
response.output;
|
||||
@ -76,7 +76,7 @@ exports.items = [
|
||||
|
||||
var grammar = prism.languages[this.name];
|
||||
return prism.highlight(line, grammar, this.name);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
evaluate: function(input) {
|
||||
|
@ -57,9 +57,9 @@ var baseLanguage = {
|
||||
|
||||
handleInput: function(input) {
|
||||
if (input === ':') {
|
||||
return this.terminal.setInput('').then(function() {
|
||||
return this.terminal.setInput('').then(() => {
|
||||
return this.terminal.pushLanguage('commands');
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
return this.terminal.unsetChoice().then(function() {
|
||||
@ -73,7 +73,7 @@ var baseLanguage = {
|
||||
rowoutEle.classList.add('gcli-row-script');
|
||||
rowoutEle.setAttribute('aria-live', 'assertive');
|
||||
|
||||
return this.exec(input).then(function(line) {
|
||||
return this.exec(input).then(line => {
|
||||
rowoutEle.innerHTML = line;
|
||||
|
||||
this.terminal.addElement(rowoutEle);
|
||||
@ -83,7 +83,7 @@ var baseLanguage = {
|
||||
|
||||
this.terminal.unsetChoice().catch(util.errorHandler);
|
||||
this.terminal.inputElement.value = '';
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
setCursor: function(cursor) {
|
||||
@ -141,9 +141,9 @@ Languages.prototype.remove = function(language) {
|
||||
* Get access to the list of known languages
|
||||
*/
|
||||
Languages.prototype.getAll = function() {
|
||||
return Object.keys(this._registered).map(function(name) {
|
||||
return Object.keys(this._registered).map(name => {
|
||||
return this._registered[name];
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -111,7 +111,7 @@ Completer.prototype.resized = function(ev) {
|
||||
Completer.prototype.update = function(ev) {
|
||||
this.choice = (ev && ev.choice != null) ? ev.choice : 0;
|
||||
|
||||
this._getCompleterTemplateData().then(function(data) {
|
||||
this._getCompleterTemplateData().then(data => {
|
||||
if (this.template == null) {
|
||||
return; // destroy() has been called
|
||||
}
|
||||
@ -123,7 +123,7 @@ Completer.prototype.update = function(ev) {
|
||||
while (template.hasChildNodes()) {
|
||||
this.element.appendChild(template.firstChild);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -362,10 +362,10 @@ Inputter.prototype._checkAssignment = function(start) {
|
||||
*/
|
||||
Inputter.prototype.setInput = function(str) {
|
||||
this._caretChange = Caret.TO_END;
|
||||
return this.requisition.update(str).then(function(updated) {
|
||||
return this.requisition.update(str).then(updated => {
|
||||
this.textChanged();
|
||||
return updated;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -479,14 +479,14 @@ Inputter.prototype.handleKeyUp = function(ev) {
|
||||
this._completed = this.requisition.update(this.element.value);
|
||||
this._previousValue = this.element.value;
|
||||
|
||||
return this._completed.then(function() {
|
||||
return this._completed.then(() => {
|
||||
// Abort UI changes if this UI update has been overtaken
|
||||
if (this._previousValue === this.element.value) {
|
||||
this._choice = null;
|
||||
this.textChanged();
|
||||
this.onChoiceChange({ choice: this._choice });
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -500,22 +500,22 @@ Inputter.prototype._handleUpArrow = function() {
|
||||
|
||||
if (this.element.value === '' || this._scrollingThroughHistory) {
|
||||
this._scrollingThroughHistory = true;
|
||||
return this.requisition.update(this.history.backward()).then(function(updated) {
|
||||
return this.requisition.update(this.history.backward()).then(updated => {
|
||||
this.textChanged();
|
||||
return updated;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
// If the user is on a valid value, then we increment the value, but if
|
||||
// they've typed something that's not right we page through predictions
|
||||
if (this.assignment.getStatus() === Status.VALID) {
|
||||
return this.requisition.nudge(this.assignment, 1).then(function() {
|
||||
return this.requisition.nudge(this.assignment, 1).then(() => {
|
||||
// See notes on focusManager.onInputChange in onKeyDown
|
||||
this.textChanged();
|
||||
if (this.focusManager) {
|
||||
this.focusManager.onInputChange();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
this.changeChoice(-1);
|
||||
@ -533,21 +533,21 @@ Inputter.prototype._handleDownArrow = function() {
|
||||
|
||||
if (this.element.value === '' || this._scrollingThroughHistory) {
|
||||
this._scrollingThroughHistory = true;
|
||||
return this.requisition.update(this.history.forward()).then(function(updated) {
|
||||
return this.requisition.update(this.history.forward()).then(updated => {
|
||||
this.textChanged();
|
||||
return updated;
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
// See notes above for the UP key
|
||||
if (this.assignment.getStatus() === Status.VALID) {
|
||||
return this.requisition.nudge(this.assignment, -1).then(function() {
|
||||
return this.requisition.nudge(this.assignment, -1).then(() => {
|
||||
// See notes on focusManager.onInputChange in onKeyDown
|
||||
this.textChanged();
|
||||
if (this.focusManager) {
|
||||
this.focusManager.onInputChange();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
this.changeChoice(+1);
|
||||
@ -566,9 +566,9 @@ Inputter.prototype._handleReturn = function() {
|
||||
let name = this.requisition.commandAssignment.value.name;
|
||||
this._telemetry.logKeyed("DEVTOOLS_GCLI_COMMANDS_KEYED", name);
|
||||
|
||||
return this.requisition.exec().then(function() {
|
||||
return this.requisition.exec().then(() => {
|
||||
this.textChanged();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
// If we can't execute the command, but there is a menu choice to use
|
||||
@ -617,14 +617,14 @@ Inputter.prototype._handleTab = function(ev) {
|
||||
this.lastTabDownAt = 0;
|
||||
this._scrollingThroughHistory = false;
|
||||
|
||||
return this._completed.then(function(updated) {
|
||||
return this._completed.then(updated => {
|
||||
// Abort UI changes if this UI update has been overtaken
|
||||
if (updated) {
|
||||
this.textChanged();
|
||||
this._choice = null;
|
||||
this.onChoiceChange({ choice: this._choice });
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -170,10 +170,10 @@ Tooltip.prototype.choiceChanged = function(ev) {
|
||||
if (this.field && this.field.menu) {
|
||||
var conversion = this.assignment.conversion;
|
||||
var context = this.requisition.executionContext;
|
||||
conversion.constrainPredictionIndex(context, ev.choice).then(function(choice) {
|
||||
conversion.constrainPredictionIndex(context, ev.choice).then(choice => {
|
||||
this.field.menu._choice = choice;
|
||||
this.field.menu._updateHighlight();
|
||||
}.bind(this)).catch(util.errorHandler);
|
||||
}).catch(util.errorHandler);
|
||||
}
|
||||
};
|
||||
|
||||
@ -202,9 +202,9 @@ Tooltip.prototype.fieldChanged = function(ev) {
|
||||
// Nasty hack, the inputter won't know about the text change yet, so it will
|
||||
// get it's calculations wrong. We need to wait until the current set of
|
||||
// changes has had a chance to propagate
|
||||
this.document.defaultView.setTimeout(function() {
|
||||
this.document.defaultView.setTimeout(() => {
|
||||
this.inputter.focus();
|
||||
}.bind(this), 10);
|
||||
}, 10);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -75,15 +75,15 @@ Settings.prototype._readSystem = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
imports.prefBranch.getChildList('').forEach(function(name) {
|
||||
imports.prefBranch.getChildList('').forEach(name => {
|
||||
var setting = new Setting(this, name);
|
||||
this._settingsAll.push(setting);
|
||||
this._settingsMap.set(name, setting);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this._settingsAll.sort(function(s1, s2) {
|
||||
this._settingsAll.sort((s1, s2) => {
|
||||
return s1.name.localeCompare(s2.name);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this._hasReadSystem = true;
|
||||
};
|
||||
@ -99,9 +99,9 @@ Settings.prototype.getAll = function(filter) {
|
||||
return this._settingsAll;
|
||||
}
|
||||
|
||||
return this._settingsAll.filter(function(setting) {
|
||||
return this._settingsAll.filter(setting => {
|
||||
return setting.name.indexOf(filter) !== -1;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -179,9 +179,9 @@ exports.createSystem = function(options) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
else {
|
||||
return Promise.all(promises).then(function() {
|
||||
return Promise.all(promises).then(() => {
|
||||
this.commands.onCommandsChange.resumeFire();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -213,9 +213,9 @@ exports.createSystem = function(options) {
|
||||
Object.keys(modules).forEach(unloadModule);
|
||||
pendingChanges = false;
|
||||
|
||||
return Promise.all(promises).then(function() {
|
||||
return Promise.all(promises).then(() => {
|
||||
this.commands.onCommandsChange.resumeFire();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
|
@ -60,12 +60,12 @@ exports.items = [
|
||||
// Hack alert. ArrayConversion needs to be able to answer questions about
|
||||
// the status of individual conversions in addition to the overall state.
|
||||
// |subArg.conversion| allows us to do that easily.
|
||||
var subArgParse = function(subArg) {
|
||||
return this.subtype.parse(subArg, context).then(function(conversion) {
|
||||
var subArgParse = subArg => {
|
||||
return this.subtype.parse(subArg, context).then(conversion => {
|
||||
subArg.conversion = conversion;
|
||||
return conversion;
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
});
|
||||
};
|
||||
|
||||
var conversionPromises = arg.getArguments().map(subArgParse);
|
||||
return Promise.all(conversionPromises).then(function(conversions) {
|
||||
|
@ -42,23 +42,23 @@ exports.items = [
|
||||
delegateType: undefined,
|
||||
|
||||
stringify: function(value, context) {
|
||||
return this.getType(context).then(function(delegated) {
|
||||
return this.getType(context).then(delegated => {
|
||||
return delegated.stringify(value, context);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
parse: function(arg, context) {
|
||||
return this.getType(context).then(function(delegated) {
|
||||
return this.getType(context).then(delegated => {
|
||||
return delegated.parse(arg, context);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
nudge: function(value, by, context) {
|
||||
return this.getType(context).then(function(delegated) {
|
||||
return this.getType(context).then(delegated => {
|
||||
return delegated.nudge ?
|
||||
delegated.nudge(value, by, context) :
|
||||
undefined;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
getType: function(context) {
|
||||
@ -125,16 +125,16 @@ exports.items = [
|
||||
},
|
||||
|
||||
parse: function(arg, context) {
|
||||
return this.front.parseType(context.typed, this.paramName).then(function(json) {
|
||||
return this.front.parseType(context.typed, this.paramName).then(json => {
|
||||
var status = Status.fromString(json.status);
|
||||
return new Conversion(undefined, arg, status, json.message, json.predictions);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
nudge: function(value, by, context) {
|
||||
return this.front.nudgeType(context.typed, by, this.paramName).then(function(json) {
|
||||
return this.front.nudgeType(context.typed, by, this.paramName).then(json => {
|
||||
return { stringified: json.arg };
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
},
|
||||
// 'blank' is a type for use with DelegateType when we don't know yet.
|
||||
|
@ -64,9 +64,9 @@ function CssResource(domSheet) {
|
||||
CssResource.prototype = Object.create(Resource.prototype);
|
||||
|
||||
CssResource.prototype.loadContents = function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(this.element.ownerNode.innerHTML);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
CssResource._getAllStyles = function(context) {
|
||||
@ -130,7 +130,7 @@ function ScriptResource(scriptNode) {
|
||||
ScriptResource.prototype = Object.create(Resource.prototype);
|
||||
|
||||
ScriptResource.prototype.loadContents = function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.inline) {
|
||||
resolve(this.element.innerHTML);
|
||||
}
|
||||
@ -146,7 +146,7 @@ ScriptResource.prototype.loadContents = function() {
|
||||
xhr.open('GET', this.element.src, true);
|
||||
xhr.send();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
ScriptResource._getAllScripts = function(context) {
|
||||
|
@ -90,7 +90,7 @@ SelectionType.prototype.stringify = function(value, context) {
|
||||
return value[this.stringifyProperty];
|
||||
}
|
||||
|
||||
return this.getLookup(context).then(function(lookup) {
|
||||
return this.getLookup(context).then(lookup => {
|
||||
var name = null;
|
||||
lookup.some(function(item) {
|
||||
if (item.value === value) {
|
||||
@ -100,7 +100,7 @@ SelectionType.prototype.stringify = function(value, context) {
|
||||
return false;
|
||||
}, this);
|
||||
return name;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -265,10 +265,10 @@ exports.findPredictions = function(arg, lookup) {
|
||||
};
|
||||
|
||||
SelectionType.prototype.parse = function(arg, context) {
|
||||
return Promise.resolve(this.getLookup(context)).then(function(lookup) {
|
||||
return Promise.resolve(this.getLookup(context)).then(lookup => {
|
||||
var predictions = exports.findPredictions(arg, lookup);
|
||||
return exports.convertPredictions(arg, predictions);
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -303,13 +303,13 @@ function isHidden(option) {
|
||||
}
|
||||
|
||||
SelectionType.prototype.getBlank = function(context) {
|
||||
var predictFunc = function(context2) {
|
||||
var predictFunc = context2 => {
|
||||
return Promise.resolve(this.getLookup(context2)).then(function(lookup) {
|
||||
return lookup.filter(function(option) {
|
||||
return !isHidden(option);
|
||||
}).slice(0, Conversion.maxPredictions - 1);
|
||||
});
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
return new Conversion(undefined, new BlankArgument(), Status.INCOMPLETE, '',
|
||||
predictFunc);
|
||||
@ -330,7 +330,7 @@ SelectionType.prototype.getBlank = function(context) {
|
||||
* So for selections, we treat +1 as -1 and -1 as +1.
|
||||
*/
|
||||
SelectionType.prototype.nudge = function(value, by, context) {
|
||||
return this.getLookup(context).then(function(lookup) {
|
||||
return this.getLookup(context).then(lookup => {
|
||||
var index = this._findValue(lookup, value);
|
||||
if (index === -1) {
|
||||
if (by < 0) {
|
||||
@ -354,7 +354,7 @@ SelectionType.prototype.nudge = function(value, by, context) {
|
||||
index = 0;
|
||||
}
|
||||
return lookup[index].value;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -827,7 +827,7 @@ Conversion.prototype.constrainPredictionIndex = function(context, index) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return this.getPredictions(context).then(function(value) {
|
||||
return this.getPredictions(context).then(value => {
|
||||
if (value.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
@ -837,7 +837,7 @@ Conversion.prototype.constrainPredictionIndex = function(context, index) {
|
||||
index = value.length + index;
|
||||
}
|
||||
return index;
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -30,16 +30,16 @@ exports.items = [
|
||||
constructor: function() {
|
||||
// Get the properties of the type. Later types in the list should always
|
||||
// be more general, so 'catch all' types like string must be last
|
||||
this.alternatives = this.alternatives.map(function(typeData) {
|
||||
this.alternatives = this.alternatives.map(typeData => {
|
||||
return this.types.createType(typeData);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
getSpec: function(command, param) {
|
||||
var spec = { name: 'union', alternatives: [] };
|
||||
this.alternatives.forEach(function(type) {
|
||||
this.alternatives.forEach(type => {
|
||||
spec.alternatives.push(type.getSpec(command, param));
|
||||
}.bind(this));
|
||||
});
|
||||
return spec;
|
||||
},
|
||||
|
||||
@ -56,22 +56,22 @@ exports.items = [
|
||||
},
|
||||
|
||||
parse: function(arg, context) {
|
||||
var conversionPromises = this.alternatives.map(function(type) {
|
||||
var conversionPromises = this.alternatives.map(type => {
|
||||
return type.parse(arg, context);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return Promise.all(conversionPromises).then(function(conversions) {
|
||||
return Promise.all(conversionPromises).then(conversions => {
|
||||
// Find a list of the predictions made by any conversion
|
||||
var predictionPromises = conversions.map(function(conversion) {
|
||||
var predictionPromises = conversions.map(conversion => {
|
||||
return conversion.getPredictions(context);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return Promise.all(predictionPromises).then(function(allPredictions) {
|
||||
return Promise.all(predictionPromises).then(allPredictions => {
|
||||
// Take one prediction from each set of predictions, ignoring
|
||||
// duplicates, until we've got up to Conversion.maxPredictions
|
||||
var maxIndex = allPredictions.reduce(function(prev, prediction) {
|
||||
var maxIndex = allPredictions.reduce((prev, prediction) => {
|
||||
return Math.max(prev, prediction.length);
|
||||
}.bind(this), 0);
|
||||
}, 0);
|
||||
var predictions = [];
|
||||
|
||||
indexLoop:
|
||||
@ -110,8 +110,8 @@ exports.items = [
|
||||
'' :
|
||||
l10n.lookupFormat('typesSelectionNomatch', [ arg.text ]);
|
||||
return new Conversion(value, arg, bestStatus, msg, predictions);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
];
|
||||
|
@ -49,7 +49,7 @@ exports.items = [
|
||||
|
||||
// Maybe the URL was missing a scheme?
|
||||
if (arg.text.indexOf('://') === -1) {
|
||||
[ 'http', 'https' ].forEach(function(scheme) {
|
||||
[ 'http', 'https' ].forEach(scheme => {
|
||||
try {
|
||||
var http = host.createUrl(scheme + '://' + arg.text);
|
||||
predictions.push({ name: http.href, value: http });
|
||||
@ -57,7 +57,7 @@ exports.items = [
|
||||
catch (ex) {
|
||||
// Ignore
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Try to create a URL with the current page as a base ref
|
||||
if ('window' in context.environment) {
|
||||
|
@ -135,8 +135,8 @@ FocusManager.prototype.addMonitoredElement = function(element, where) {
|
||||
var monitor = {
|
||||
element: element,
|
||||
where: where,
|
||||
onFocus: function() { this._reportFocus(where); }.bind(this),
|
||||
onBlur: function() { this._reportBlur(where); }.bind(this)
|
||||
onFocus: () => { this._reportFocus(where); },
|
||||
onBlur: () => { this._reportBlur(where); }
|
||||
};
|
||||
|
||||
element.addEventListener('focus', monitor.onFocus, true);
|
||||
@ -241,14 +241,14 @@ FocusManager.prototype._reportBlur = function(where) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._blurDelayTimeout = this.window.setTimeout(function() {
|
||||
this._blurDelayTimeout = this.window.setTimeout(() => {
|
||||
if (this.debug) {
|
||||
console.log('FocusManager.blur');
|
||||
}
|
||||
this._hasFocus = false;
|
||||
this._checkShow();
|
||||
this._blurDelayTimeout = null;
|
||||
}.bind(this), this.blurDelay);
|
||||
}, this.blurDelay);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -55,24 +55,24 @@ function Menu(options) {
|
||||
if (menuCssPromise == null) {
|
||||
menuCssPromise = host.staticRequire(module, './menu.css');
|
||||
}
|
||||
menuCssPromise.then(function(menuCss) {
|
||||
menuCssPromise.then(menuCss => {
|
||||
// Pull the HTML into the DOM, but don't add it to the document
|
||||
if (menuCss != null) {
|
||||
util.importCss(menuCss, this.document, 'gcli-menu');
|
||||
}
|
||||
}.bind(this), console.error);
|
||||
}, console.error);
|
||||
|
||||
this.templateOptions = { blankNullUndefined: true, stack: 'menu.html' };
|
||||
if (menuHtmlPromise == null) {
|
||||
menuHtmlPromise = host.staticRequire(module, './menu.html');
|
||||
}
|
||||
menuHtmlPromise.then(function(menuHtml) {
|
||||
menuHtmlPromise.then(menuHtml => {
|
||||
if (this.document == null) {
|
||||
return; // destroy() has been called
|
||||
}
|
||||
|
||||
this.template = host.toDom(this.document, menuHtml);
|
||||
}.bind(this), console.error);
|
||||
}, console.error);
|
||||
|
||||
// Contains the items that should be displayed
|
||||
this.items = [];
|
||||
@ -152,13 +152,13 @@ Menu.prototype.show = function(items, match) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.items = items.filter(function(item) {
|
||||
this.items = items.filter(item => {
|
||||
return item.hidden === undefined || item.hidden !== true;
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.items = this.items.map(function(item) {
|
||||
this.items = this.items.map(item => {
|
||||
return getHighlightingProxy(item, match, this.template.ownerDocument);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
if (this.items.length === 0) {
|
||||
this.element.style.display = 'none';
|
||||
|
@ -105,7 +105,7 @@ exports.staticRequire = function(requistingModule, name) {
|
||||
return Promise.resolve('');
|
||||
}
|
||||
else {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var filename = resourceDirName(requistingModule.id) + '/' + name;
|
||||
filename = filename.replace(/\/\.\//g, '/');
|
||||
filename = 'resource://devtools/shared/gcli/source/lib/' + filename;
|
||||
@ -113,17 +113,17 @@ exports.staticRequire = function(requistingModule, name) {
|
||||
var xhr = Cc['@mozilla.org/xmlextras/xmlhttprequest;1']
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
|
||||
xhr.onload = function onload() {
|
||||
xhr.onload = () => {
|
||||
resolve(xhr.responseText);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
xhr.onabort = xhr.onerror = xhr.ontimeout = function(err) {
|
||||
xhr.onabort = xhr.onerror = xhr.ontimeout = err => {
|
||||
reject(err);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
xhr.open('GET', filename);
|
||||
xhr.send();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -152,7 +152,7 @@ exports.script.useTarget = function(tgt) {
|
||||
target.makeRemote();
|
||||
|
||||
return targetPromise.then(function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
client = target._client;
|
||||
|
||||
client.addListener('pageError', function(packet) {
|
||||
@ -203,7 +203,7 @@ exports.script.useTarget = function(tgt) {
|
||||
|
||||
var listeners = [ 'PageError', 'ConsoleAPI' ];
|
||||
client.attachConsole(consoleActor, listeners, onAttach);
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -211,7 +211,7 @@ exports.script.useTarget = function(tgt) {
|
||||
* Execute some JavaScript
|
||||
*/
|
||||
exports.script.evaluate = function(javascript) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var onResult = function(response) {
|
||||
var output = response.result;
|
||||
if (typeof output === 'object' && output.type === 'undefined') {
|
||||
@ -226,5 +226,5 @@ exports.script.evaluate = function(javascript) {
|
||||
};
|
||||
|
||||
webConsoleClient.evaluateJS(javascript, onResult, {});
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
} else {
|
||||
root.prettyFast = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
}(this, () => {
|
||||
"use strict";
|
||||
|
||||
var acorn = this.acorn || require("acorn/acorn");
|
||||
@ -870,4 +870,4 @@
|
||||
return result.toStringWithSourceMap({ file: options.url });
|
||||
};
|
||||
|
||||
}.bind(this)));
|
||||
}));
|
||||
|
@ -239,10 +239,10 @@ SimulatorCore.prototype = {
|
||||
clientY,
|
||||
});
|
||||
let content = this.getContent(target);
|
||||
let timeout = content.setTimeout((function contextMenu() {
|
||||
let timeout = content.setTimeout(() => {
|
||||
target.dispatchEvent(evt);
|
||||
this.cancelClick = true;
|
||||
}).bind(this), delay);
|
||||
}, delay);
|
||||
|
||||
return timeout;
|
||||
},
|
||||
|
@ -21,18 +21,18 @@
|
||||
*/
|
||||
function AnimationEventHandler(target) {
|
||||
this.target = target;
|
||||
this.target.onanimationstart = function(evt) {
|
||||
this.target.onanimationstart = evt => {
|
||||
this.animationstart = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.onanimationiteration = function(evt) {
|
||||
};
|
||||
this.target.onanimationiteration = evt => {
|
||||
this.animationiteration = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.onanimationend = function(evt) {
|
||||
};
|
||||
this.target.onanimationend = evt => {
|
||||
this.animationend = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.onanimationcancel = function(evt) {
|
||||
};
|
||||
this.target.onanimationcancel = evt => {
|
||||
this.animationcancel = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
AnimationEventHandler.prototype.clear = function() {
|
||||
this.animationstart = undefined;
|
||||
|
@ -43,11 +43,11 @@ function setupAnimation(t, animationStyle, receiveEvents) {
|
||||
'animationend' ]);
|
||||
|
||||
['start', 'iteration', 'end'].forEach(name => {
|
||||
div['onanimation' + name] = function(evt) {
|
||||
div['onanimation' + name] = evt => {
|
||||
receiveEvents.push({ type: evt.type,
|
||||
target: evt.target,
|
||||
elapsedTime: evt.elapsedTime });
|
||||
}.bind(this);
|
||||
};
|
||||
});
|
||||
|
||||
const animation = div.getAnimations()[0];
|
||||
|
@ -15,18 +15,18 @@
|
||||
*/
|
||||
function TransitionEventHandler(target) {
|
||||
this.target = target;
|
||||
this.target.ontransitionrun = function(evt) {
|
||||
this.target.ontransitionrun = evt => {
|
||||
this.transitionrun = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.ontransitionstart = function(evt) {
|
||||
};
|
||||
this.target.ontransitionstart = evt => {
|
||||
this.transitionstart = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.ontransitionend = function(evt) {
|
||||
};
|
||||
this.target.ontransitionend = evt => {
|
||||
this.transitionend = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
this.target.ontransitioncancel = function(evt) {
|
||||
};
|
||||
this.target.ontransitioncancel = evt => {
|
||||
this.transitioncancel = evt.elapsedTime;
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
|
||||
TransitionEventHandler.prototype.clear = function() {
|
||||
|
@ -303,10 +303,10 @@ DOMRequestIpcHelper.prototype = {
|
||||
* which is immediately called with the generated resolverId.
|
||||
*/
|
||||
createPromiseWithId: function(aCallback) {
|
||||
return this.createPromise(function(aResolve, aReject) {
|
||||
return this.createPromise((aResolve, aReject) => {
|
||||
let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject });
|
||||
aCallback(resolverId);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
forEachRequest: function(aCallback) {
|
||||
|
@ -143,7 +143,7 @@ IndexedDBHelper.prototype = {
|
||||
* Error callback to call when an error is encountered.
|
||||
*/
|
||||
newTxn: function newTxn(txn_type, store_name, callback, successCb, failureCb) {
|
||||
this.ensureDB(function () {
|
||||
this.ensureDB(() => {
|
||||
if (DEBUG) debug("Starting new transaction" + txn_type);
|
||||
let txn;
|
||||
try {
|
||||
@ -182,7 +182,7 @@ IndexedDBHelper.prototype = {
|
||||
}
|
||||
};
|
||||
callback(txn, stores);
|
||||
}.bind(this), failureCb);
|
||||
}, failureCb);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -744,10 +744,10 @@ BrowserElementChild.prototype = {
|
||||
|
||||
_activateNextPaintListener: function(e) {
|
||||
if (!this._nextPaintHandler) {
|
||||
this._nextPaintHandler = this._addMozAfterPaintHandler(function () {
|
||||
this._nextPaintHandler = this._addMozAfterPaintHandler(() => {
|
||||
this._nextPaintHandler = null;
|
||||
sendAsyncMsg('nextpaint');
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -153,8 +153,7 @@ IdlArray.prototype.internal_add_idls = function(parsed_idls)
|
||||
* .members) so that they'll be skipped by test() -- they'll only be
|
||||
* used for base interfaces of tested interfaces, return types, etc.
|
||||
*/
|
||||
parsed_idls.forEach(function(parsed_idl)
|
||||
{
|
||||
parsed_idls.forEach(parsed_idl => {
|
||||
if (parsed_idl.type == "interface" && parsed_idl.partial)
|
||||
{
|
||||
this.partials.push(parsed_idl);
|
||||
@ -210,7 +209,7 @@ IdlArray.prototype.internal_add_idls = function(parsed_idls)
|
||||
default:
|
||||
throw parsed_idl.name + ": " + parsed_idl.type + " not yet supported";
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
//@}
|
||||
@ -277,8 +276,7 @@ IdlArray.prototype.test = function()
|
||||
|
||||
// First merge in all the partial interfaces and implements statements we
|
||||
// encountered.
|
||||
this.partials.forEach(function(parsed_idl)
|
||||
{
|
||||
this.partials.forEach(parsed_idl => {
|
||||
if (!(parsed_idl.name in this.members)
|
||||
|| !(this.members[parsed_idl.name] instanceof IdlInterface))
|
||||
{
|
||||
@ -286,32 +284,28 @@ IdlArray.prototype.test = function()
|
||||
}
|
||||
if (parsed_idl.extAttrs)
|
||||
{
|
||||
parsed_idl.extAttrs.forEach(function(extAttr)
|
||||
{
|
||||
parsed_idl.extAttrs.forEach(extAttr => {
|
||||
this.members[parsed_idl.name].extAttrs.push(extAttr);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
parsed_idl.members.forEach(function(member)
|
||||
{
|
||||
parsed_idl.members.forEach(member => {
|
||||
this.members[parsed_idl.name].members.push(new IdlInterfaceMember(member));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
this.partials = [];
|
||||
|
||||
for (var lhs in this["implements"])
|
||||
{
|
||||
this.recursively_get_implements(lhs).forEach(function(rhs)
|
||||
{
|
||||
this.recursively_get_implements(lhs).forEach(rhs => {
|
||||
var errStr = lhs + " implements " + rhs + ", but ";
|
||||
if (!(lhs in this.members)) throw errStr + lhs + " is undefined.";
|
||||
if (!(this.members[lhs] instanceof IdlInterface)) throw errStr + lhs + " is not an interface.";
|
||||
if (!(rhs in this.members)) throw errStr + rhs + " is undefined.";
|
||||
if (!(this.members[rhs] instanceof IdlInterface)) throw errStr + rhs + " is not an interface.";
|
||||
this.members[rhs].members.forEach(function(member)
|
||||
{
|
||||
this.members[rhs].members.forEach(member => {
|
||||
this.members[lhs].members.push(new IdlInterfaceMember(member));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
}
|
||||
this["implements"] = {};
|
||||
|
||||
@ -321,10 +315,9 @@ IdlArray.prototype.test = function()
|
||||
this.members[name].test();
|
||||
if (name in this.objects)
|
||||
{
|
||||
this.objects[name].forEach(function(str)
|
||||
{
|
||||
this.objects[name].forEach(str => {
|
||||
this.members[name].test_object(str);
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -638,8 +631,7 @@ IdlInterface.prototype.test = function()
|
||||
IdlInterface.prototype.test_self = function()
|
||||
//@{
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
// This function tests WebIDL as of 2015-01-13.
|
||||
// TODO: Consider [Exposed].
|
||||
|
||||
@ -736,17 +728,17 @@ IdlInterface.prototype.test_self = function()
|
||||
//
|
||||
// "If I was not declared with a [Constructor] extended attribute,
|
||||
// then throw a TypeError."
|
||||
assert_throws(new TypeError(), function() {
|
||||
assert_throws(new TypeError(), () => {
|
||||
self[this.name]();
|
||||
}.bind(this), "interface object didn't throw TypeError when called as a function");
|
||||
assert_throws(new TypeError(), function() {
|
||||
}, "interface object didn't throw TypeError when called as a function");
|
||||
assert_throws(new TypeError(), () => {
|
||||
new self[this.name]();
|
||||
}.bind(this), "interface object didn't throw TypeError when called as a constructor");
|
||||
}, "interface object didn't throw TypeError when called as a constructor");
|
||||
}
|
||||
}.bind(this), this.name + " interface: existence and properties of interface object");
|
||||
}, this.name + " interface: existence and properties of interface object");
|
||||
|
||||
if (!this.is_callback()) {
|
||||
test(function() {
|
||||
test(() => {
|
||||
// This function tests WebIDL as of 2014-10-25.
|
||||
// https://heycam.github.io/webidl/#es-interface-call
|
||||
|
||||
@ -769,13 +761,12 @@ IdlInterface.prototype.test_self = function()
|
||||
.filter(function(attr) { return attr.name == "Constructor"; });
|
||||
var expected_length = minOverloadLength(constructors);
|
||||
assert_equals(self[this.name].length, expected_length, "wrong value for " + this.name + ".length");
|
||||
}.bind(this), this.name + " interface object length");
|
||||
}, this.name + " interface object length");
|
||||
}
|
||||
|
||||
// TODO: Test named constructors if I find any interfaces that have them.
|
||||
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
// This function tests WebIDL as of 2015-01-21.
|
||||
// https://heycam.github.io/webidl/#interface-object
|
||||
|
||||
@ -878,10 +869,9 @@ IdlInterface.prototype.test_self = function()
|
||||
assert_equals(String(self[this.name].prototype), "[object " + this.name + "Prototype]",
|
||||
"String(" + this.name + ".prototype)");
|
||||
}
|
||||
}.bind(this), this.name + " interface: existence and properties of interface prototype object");
|
||||
}, this.name + " interface: existence and properties of interface prototype object");
|
||||
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -913,15 +903,14 @@ IdlInterface.prototype.test_self = function()
|
||||
assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
|
||||
assert_equals(self[this.name].prototype.constructor, self[this.name],
|
||||
this.name + '.prototype.constructor is not the same object as ' + this.name);
|
||||
}.bind(this), this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
|
||||
}, this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
|
||||
};
|
||||
|
||||
//@}
|
||||
IdlInterface.prototype.test_member_const = function(member)
|
||||
//@{
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -946,11 +935,10 @@ IdlInterface.prototype.test_member_const = function(member)
|
||||
assert_false(desc.writable, "property is writable");
|
||||
assert_true(desc.enumerable, "property is not enumerable");
|
||||
assert_false(desc.configurable, "property is configurable");
|
||||
}.bind(this), this.name + " interface: constant " + member.name + " on interface object");
|
||||
}, this.name + " interface: constant " + member.name + " on interface object");
|
||||
// "In addition, a property with the same characteristics must
|
||||
// exist on the interface prototype object."
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -976,7 +964,7 @@ IdlInterface.prototype.test_member_const = function(member)
|
||||
assert_false(desc.writable, "property is writable");
|
||||
assert_true(desc.enumerable, "property is not enumerable");
|
||||
assert_false(desc.configurable, "property is configurable");
|
||||
}.bind(this), this.name + " interface: constant " + member.name + " on interface prototype object");
|
||||
}, this.name + " interface: constant " + member.name + " on interface prototype object");
|
||||
};
|
||||
|
||||
|
||||
@ -984,8 +972,7 @@ IdlInterface.prototype.test_member_const = function(member)
|
||||
IdlInterface.prototype.test_member_attribute = function(member)
|
||||
//@{
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -1032,24 +1019,23 @@ IdlInterface.prototype.test_member_attribute = function(member)
|
||||
format_value(member.name));
|
||||
|
||||
if (!member.has_extended_attribute("LenientThis")) {
|
||||
assert_throws(new TypeError(), function() {
|
||||
assert_throws(new TypeError(), () => {
|
||||
self[this.name].prototype[member.name];
|
||||
}.bind(this), "getting property on prototype object must throw TypeError");
|
||||
}, "getting property on prototype object must throw TypeError");
|
||||
} else {
|
||||
assert_equals(self[this.name].prototype[member.name], undefined,
|
||||
"getting property on prototype object must return undefined");
|
||||
}
|
||||
this.do_interface_attribute_asserts(self[this.name].prototype, member);
|
||||
}
|
||||
}.bind(this), this.name + " interface: attribute " + member.name);
|
||||
}, this.name + " interface: attribute " + member.name);
|
||||
};
|
||||
|
||||
//@}
|
||||
IdlInterface.prototype.test_member_operation = function(member)
|
||||
//@{
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -1090,7 +1076,7 @@ IdlInterface.prototype.test_member_operation = function(member)
|
||||
}
|
||||
|
||||
this.do_member_operation_asserts(memberHolderObject, member);
|
||||
}.bind(this), this.name + " interface: operation " + member.name +
|
||||
}, this.name + " interface: operation " + member.name +
|
||||
"(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
|
||||
")");
|
||||
};
|
||||
@ -1165,8 +1151,7 @@ IdlInterface.prototype.do_member_operation_asserts = function(memberHolderObject
|
||||
IdlInterface.prototype.test_member_stringifier = function(member)
|
||||
//@{
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
if (this.is_callback() && !this.has_constants()) {
|
||||
return;
|
||||
}
|
||||
@ -1222,7 +1207,7 @@ IdlInterface.prototype.test_member_stringifier = function(member)
|
||||
assert_throws(new TypeError(), function() {
|
||||
self[this.name].prototype.toString.apply({}, []);
|
||||
}, "calling stringifier with this = {} didn't throw TypeError");
|
||||
}.bind(this), this.name + " interface: stringifier");
|
||||
}, this.name + " interface: stringifier");
|
||||
};
|
||||
|
||||
//@}
|
||||
@ -1324,8 +1309,7 @@ IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception
|
||||
if (!this.has_extended_attribute("NoInterfaceObject")
|
||||
&& (typeof obj != expected_typeof || obj instanceof Object))
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
assert_own_property(self, this.name,
|
||||
@ -1340,14 +1324,13 @@ IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception
|
||||
assert_equals(Object.getPrototypeOf(obj),
|
||||
self[this.name].prototype,
|
||||
desc + "'s prototype is not " + this.name + ".prototype");
|
||||
}.bind(this), this.name + " must be primary interface of " + desc);
|
||||
}, this.name + " must be primary interface of " + desc);
|
||||
}
|
||||
|
||||
// "The class string of a platform object that implements one or more
|
||||
// interfaces must be the identifier of the primary interface of the
|
||||
// platform object."
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
assert_class_string(obj, this.name, "class string of " + desc);
|
||||
@ -1355,7 +1338,7 @@ IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception
|
||||
{
|
||||
assert_equals(String(obj), "[object " + this.name + "]", "String(" + desc + ")");
|
||||
}
|
||||
}.bind(this), "Stringification of " + desc);
|
||||
}, "Stringification of " + desc);
|
||||
};
|
||||
|
||||
//@}
|
||||
@ -1370,33 +1353,30 @@ IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect
|
||||
var member = this.members[i];
|
||||
if (member.type == "attribute" && member.isUnforgeable)
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
this.do_interface_attribute_asserts(obj, member);
|
||||
}.bind(this), this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
|
||||
}, this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
|
||||
}
|
||||
else if (member.type == "operation" &&
|
||||
member.name &&
|
||||
member.isUnforgeable)
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
assert_own_property(obj, member.name,
|
||||
"Doesn't have the unforgeable operation property");
|
||||
this.do_member_operation_asserts(obj, member);
|
||||
}.bind(this), this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
|
||||
}, this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
|
||||
}
|
||||
else if ((member.type == "const"
|
||||
|| member.type == "attribute"
|
||||
|| member.type == "operation")
|
||||
&& member.name)
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
if (!member["static"]) {
|
||||
@ -1434,15 +1414,14 @@ IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect
|
||||
assert_equals(typeof obj[member.name], "function");
|
||||
}
|
||||
}
|
||||
}.bind(this), this.name + " interface: " + desc + ' must inherit property "' + member.name + '" with the proper type (' + i + ')');
|
||||
}, this.name + " interface: " + desc + ' must inherit property "' + member.name + '" with the proper type (' + i + ')');
|
||||
}
|
||||
// TODO: This is wrong if there are multiple operations with the same
|
||||
// identifier.
|
||||
// TODO: Test passing arguments of the wrong type.
|
||||
if (member.type == "operation" && member.name && member.arguments.length)
|
||||
{
|
||||
test(function()
|
||||
{
|
||||
test(() => {
|
||||
assert_equals(exception, null, "Unexpected exception when evaluating object");
|
||||
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
|
||||
if (!member["static"]) {
|
||||
@ -1462,14 +1441,13 @@ IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect
|
||||
}));
|
||||
var args = [];
|
||||
for (var i = 0; i < minLength; i++) {
|
||||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
assert_throws(new TypeError(), () => {
|
||||
obj[member.name].apply(obj, args);
|
||||
}.bind(this), "Called with " + i + " arguments");
|
||||
}, "Called with " + i + " arguments");
|
||||
|
||||
args.push(create_suitable_object(member.arguments[i].idlType));
|
||||
}
|
||||
}.bind(this), this.name + " interface: calling " + member.name +
|
||||
}, this.name + " interface: calling " + member.name +
|
||||
"(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
|
||||
") on " + desc + " with too few arguments must throw TypeError");
|
||||
}
|
||||
@ -1540,9 +1518,9 @@ IdlInterface.prototype.do_interface_attribute_asserts = function(obj, member)
|
||||
// attribute, then return undefined.
|
||||
// "Otherwise, throw a TypeError."
|
||||
if (!member.has_extended_attribute("LenientThis")) {
|
||||
assert_throws(new TypeError(), function() {
|
||||
assert_throws(new TypeError(), () => {
|
||||
desc.get.call({});
|
||||
}.bind(this), "calling getter on wrong object type must throw TypeError");
|
||||
}, "calling getter on wrong object type must throw TypeError");
|
||||
} else {
|
||||
assert_equals(desc.get.call({}), undefined,
|
||||
"calling getter on wrong object type must return undefined");
|
||||
@ -1580,9 +1558,9 @@ IdlInterface.prototype.do_interface_attribute_asserts = function(obj, member)
|
||||
// attribute, then: ..."
|
||||
// "If validThis is false, then return."
|
||||
if (!member.has_extended_attribute("LenientThis")) {
|
||||
assert_throws(new TypeError(), function() {
|
||||
assert_throws(new TypeError(), () => {
|
||||
desc.set.call({});
|
||||
}.bind(this), "calling setter on wrong object type must throw TypeError");
|
||||
}, "calling setter on wrong object type must throw TypeError");
|
||||
} else {
|
||||
assert_equals(desc.set.call({}), undefined,
|
||||
"calling setter on wrong object type must return undefined");
|
||||
|
@ -1520,13 +1520,13 @@ policies and contribution forms [3].
|
||||
RemoteTest.prototype.structured_clone = function() {
|
||||
var clone = {};
|
||||
Object.keys(this).forEach(
|
||||
(function(key) {
|
||||
key => {
|
||||
if (typeof(this[key]) === "object") {
|
||||
clone[key] = merge({}, this[key]);
|
||||
} else {
|
||||
clone[key] = this[key];
|
||||
}
|
||||
}).bind(this));
|
||||
});
|
||||
clone.phases = merge({}, this.phases);
|
||||
return clone;
|
||||
};
|
||||
|
@ -733,21 +733,21 @@ RequestCounter.prototype = {
|
||||
|
||||
handler: function(type, preventDefault) {
|
||||
this.incr();
|
||||
return function(event) {
|
||||
return event => {
|
||||
is(event.type, type || "success", "Correct type");
|
||||
this.decr();
|
||||
}.bind(this);
|
||||
};
|
||||
},
|
||||
|
||||
errorHandler: function(eventType, errorName) {
|
||||
this.incr();
|
||||
return function(event) {
|
||||
return event => {
|
||||
is(event.type, eventType || "error", "Correct type");
|
||||
is(event.target.error.name, errorName || "QuotaExceededError",
|
||||
"Correct error name");
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.decr();
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ var Manifests = {
|
||||
return this.started;
|
||||
}
|
||||
|
||||
this.started = (async function() {
|
||||
this.started = (async () => {
|
||||
|
||||
// Make sure the manifests have the folder needed to save into
|
||||
await OS.File.makeDir(MANIFESTS_DIR, {ignoreExisting: true});
|
||||
@ -159,7 +159,7 @@ var Manifests = {
|
||||
// and we do not want multiple file handles
|
||||
this.manifestObjs = {};
|
||||
|
||||
}).bind(this)();
|
||||
})();
|
||||
|
||||
return this.started;
|
||||
},
|
||||
|
@ -1644,11 +1644,11 @@ function MediaTestManager() {
|
||||
|
||||
// Always wait for explicit finish.
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({'set': gTestPrefs}, (function() {
|
||||
SpecialPowers.pushPrefEnv({'set': gTestPrefs}, () => {
|
||||
this.nextTest();
|
||||
}).bind(this));
|
||||
});
|
||||
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
if (this.tokens.length > 0) {
|
||||
info("Test timed out. Remaining tests=" + this.tokens);
|
||||
}
|
||||
@ -1658,7 +1658,7 @@ function MediaTestManager() {
|
||||
handler.ontimeout();
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
// Registers that the test corresponding to 'token' has been started.
|
||||
@ -1668,11 +1668,11 @@ function MediaTestManager() {
|
||||
this.numTestsRunning++;
|
||||
this.handlers[token] = handler;
|
||||
|
||||
var onTimeout = function() {
|
||||
var onTimeout = () => {
|
||||
this.hasTimeout = true;
|
||||
ok(false, `${token} timed out!`);
|
||||
this.finished(token);
|
||||
}.bind(this);
|
||||
};
|
||||
// Default timeout to 180s for each test.
|
||||
this.timers[token] = setTimeout(onTimeout, 180000);
|
||||
|
||||
@ -1738,12 +1738,12 @@ function MediaTestManager() {
|
||||
if (this.hasTimeout) {
|
||||
dumpDebugInfo();
|
||||
}
|
||||
var onCleanup = function() {
|
||||
var onCleanup = () => {
|
||||
var end = new Date();
|
||||
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
|
||||
SimpleTest.info("Running time: " + elapsedTime(this.startTime) + "s");
|
||||
SimpleTest.finish();
|
||||
}.bind(this);
|
||||
};
|
||||
mediaTestCleanup(onCleanup);
|
||||
return;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ var NotificationDB = {
|
||||
load: function() {
|
||||
var promise = OS.File.read(NOTIFICATION_STORE_PATH, { encoding: "utf-8"});
|
||||
return promise.then(
|
||||
function onSuccess(data) {
|
||||
data => {
|
||||
if (data.length > 0) {
|
||||
// Preprocessing phase intends to cleanly separate any migration-related
|
||||
// tasks.
|
||||
@ -124,13 +124,13 @@ var NotificationDB = {
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
}.bind(this),
|
||||
},
|
||||
|
||||
// If read failed, we assume we have no notifications to load.
|
||||
function onFailure(reason) {
|
||||
reason => {
|
||||
this.loaded = true;
|
||||
return this.createStore();
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@ -262,7 +262,7 @@ var NotificationDB = {
|
||||
|
||||
// Always make sure we are loaded before performing any read/write tasks.
|
||||
this.ensureLoaded()
|
||||
.then(function() {
|
||||
.then(() => {
|
||||
var task = this.runningTask;
|
||||
|
||||
switch (task.operation) {
|
||||
@ -279,22 +279,22 @@ var NotificationDB = {
|
||||
break;
|
||||
}
|
||||
|
||||
}.bind(this))
|
||||
.then(function(payload) {
|
||||
})
|
||||
.then(payload => {
|
||||
if (DEBUG) {
|
||||
debug("Finishing task: " + this.runningTask.operation);
|
||||
}
|
||||
this.runningTask.defer.resolve(payload);
|
||||
}.bind(this))
|
||||
.catch(function(err) {
|
||||
})
|
||||
.catch(err => {
|
||||
if (DEBUG) {
|
||||
debug("Error while running " + this.runningTask.operation + ": " + err);
|
||||
}
|
||||
this.runningTask.defer.reject(new String(err));
|
||||
}.bind(this))
|
||||
.then(function() {
|
||||
})
|
||||
.then(() => {
|
||||
this.runNextTask();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
taskGetAll: function(data) {
|
||||
|
@ -248,7 +248,7 @@ NotificationStorage.prototype = {
|
||||
},
|
||||
|
||||
_populateCache: function(notifications) {
|
||||
notifications.forEach(function(notification) {
|
||||
notifications.forEach(notification => {
|
||||
this._notifications[notification.id] = notification;
|
||||
if (notification.tag && notification.origin) {
|
||||
let tag = notification.tag;
|
||||
@ -258,7 +258,7 @@ NotificationStorage.prototype = {
|
||||
}
|
||||
this._byTag[origin][tag] = notification;
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
this._cached = true;
|
||||
},
|
||||
|
||||
|
@ -239,9 +239,9 @@ function registerService() {
|
||||
this.serviceRegistered++;
|
||||
return {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
|
||||
cancel: function() {
|
||||
cancel: () => {
|
||||
this.serviceUnregistered++;
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
},
|
||||
resolveService: function(serviceInfo, listener) {},
|
||||
@ -328,9 +328,9 @@ function registerServiceDynamically() {
|
||||
this.serviceRegistered++;
|
||||
return {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
|
||||
cancel: function() {
|
||||
cancel: () => {
|
||||
this.serviceUnregistered++;
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
},
|
||||
resolveService: function(serviceInfo, listener) {},
|
||||
@ -1176,9 +1176,9 @@ function serverClosed() {
|
||||
this.serviceRegistered++;
|
||||
return {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
|
||||
cancel: function() {
|
||||
cancel: () => {
|
||||
this.serviceUnregistered++;
|
||||
}.bind(this)
|
||||
}
|
||||
};
|
||||
},
|
||||
resolveService: function(serviceInfo, listener) {
|
||||
|
@ -391,16 +391,16 @@ WifiGeoPositionProvider.prototype = {
|
||||
xhr.responseType = "json";
|
||||
xhr.mozBackgroundRequest = true;
|
||||
xhr.timeout = Services.prefs.getIntPref("geo.wifi.xhr.timeout");
|
||||
xhr.ontimeout = (function() {
|
||||
xhr.ontimeout = () => {
|
||||
LOG("Location request XHR timed out.")
|
||||
this.notifyListener("notifyError",
|
||||
[POSITION_UNAVAILABLE]);
|
||||
}).bind(this);
|
||||
xhr.onerror = (function() {
|
||||
};
|
||||
xhr.onerror = () => {
|
||||
this.notifyListener("notifyError",
|
||||
[POSITION_UNAVAILABLE]);
|
||||
}).bind(this);
|
||||
xhr.onload = (function() {
|
||||
};
|
||||
xhr.onload = () => {
|
||||
LOG("server returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response));
|
||||
if ((xhr.channel instanceof Ci.nsIHttpChannel && xhr.status != 200) ||
|
||||
!xhr.response || !xhr.response.location) {
|
||||
@ -415,7 +415,7 @@ WifiGeoPositionProvider.prototype = {
|
||||
|
||||
this.notifyListener("update", [newLocation]);
|
||||
gCachedRequest = new CachedRequest(newLocation, data.cellTowers, data.wifiAccessPoints);
|
||||
}).bind(this);
|
||||
};
|
||||
|
||||
var requestData = JSON.stringify(data);
|
||||
LOG("sending " + requestData);
|
||||
|
@ -33,9 +33,9 @@ gaia_switch/examples/index.html from the Gaia repository.
|
||||
|
||||
// The setTimeout is necessary to avoid missing @import styles
|
||||
// when appending two stylesheets. Bug 1003294.
|
||||
setTimeout(function nextTick() {
|
||||
setTimeout(() => {
|
||||
this.shadowRoot.appendChild(style.cloneNode(true));
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -67,13 +67,13 @@
|
||||
// or until maxTime ms have passed
|
||||
function waitForRequest(request, delay, maxTime, func) {
|
||||
timeLimit = Date.now() + maxTime;
|
||||
var intervalId = window.setInterval(function() {
|
||||
var intervalId = window.setInterval(() => {
|
||||
var req = getLastRequest();
|
||||
if (req == request || Date.now() > timeLimit) {
|
||||
window.clearInterval(intervalId);
|
||||
func();
|
||||
}
|
||||
}.bind(this), delay);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
// initially disable the second of the <style> elements,
|
||||
|
@ -143,10 +143,10 @@ BrowserBot.prototype = {
|
||||
// "https://localhost:8080/bot/browser/" on chrome for Android.
|
||||
AndroidChromeBot = function (name, androidDeviceManager, callback) {
|
||||
Bot.call(this, name, callback);
|
||||
androidDeviceManager.getNewDevice(function (serialNumber) {
|
||||
androidDeviceManager.getNewDevice(serialNumber => {
|
||||
this.serialNumber_ = serialNumber;
|
||||
this.spawnBotProcess_();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
AndroidChromeBot.prototype = {
|
||||
@ -155,14 +155,14 @@ AndroidChromeBot.prototype = {
|
||||
var runChrome = 'adb -s ' + this.serialNumber_ + ' shell am start ' +
|
||||
'-n com.android.chrome/com.google.android.apps.chrome.Main ' +
|
||||
'-d https://localhost:8080/bot/browser/';
|
||||
child.exec(runChrome, function (error, stdout, stderr) {
|
||||
child.exec(runChrome, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
this.log(error);
|
||||
process.exit(1);
|
||||
}
|
||||
this.log('Opening Chrome for Android...');
|
||||
this.log(stdout);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
__proto__: Bot.prototype
|
||||
@ -174,7 +174,7 @@ AndroidDeviceManager = function () {
|
||||
|
||||
AndroidDeviceManager.prototype = {
|
||||
getNewDevice: function (callback) {
|
||||
this.listDevices_(function (devices) {
|
||||
this.listDevices_(devices => {
|
||||
for (var i = 0; i < devices.length; i++) {
|
||||
if (!this.connectedDevices_[devices[i]]) {
|
||||
this.connectedDevices_[devices[i]] = devices[i];
|
||||
@ -188,7 +188,7 @@ AndroidDeviceManager.prototype = {
|
||||
console.log('Error: There is no enough connected devices.');
|
||||
}
|
||||
process.exit(1);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
listDevices_: function (callback) {
|
||||
|
@ -136,13 +136,13 @@ StatisticsReport.prototype = {
|
||||
},
|
||||
|
||||
finish: function (doneCallback) {
|
||||
fs.exists("test/reports/", function (exists) {
|
||||
fs.exists("test/reports/", exists => {
|
||||
if(exists) {
|
||||
writeFile.bind(this)();
|
||||
} else {
|
||||
fs.mkdir("test/reports/", 0o777, writeFile.bind(this));
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
function writeFile () {
|
||||
fs.writeFile("test/reports/" + this.outputFileName_ + "_" +
|
||||
|
@ -620,7 +620,7 @@ var CastingApps = {
|
||||
return this.allowableExtension(aVideo.sourceURI, aService.extensions) || this.allowableMimeType(aVideo.type, aService.types);
|
||||
}
|
||||
|
||||
this.prompt(function(aService) {
|
||||
this.prompt(aService => {
|
||||
if (!aService)
|
||||
return;
|
||||
|
||||
@ -638,14 +638,14 @@ var CastingApps = {
|
||||
}
|
||||
}
|
||||
|
||||
app.stop(function() {
|
||||
app.start(function(aStarted) {
|
||||
app.stop(() => {
|
||||
app.start(aStarted => {
|
||||
if (!aStarted) {
|
||||
dump("CastingApps: Unable to start app");
|
||||
return;
|
||||
}
|
||||
|
||||
app.remoteMedia(function(aRemoteMedia) {
|
||||
app.remoteMedia(aRemoteMedia => {
|
||||
if (!aRemoteMedia) {
|
||||
dump("CastingApps: Failed to create remotemedia");
|
||||
return;
|
||||
@ -662,10 +662,10 @@ var CastingApps = {
|
||||
},
|
||||
videoRef: Cu.getWeakReference(aVideo.element)
|
||||
};
|
||||
}.bind(this), this);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this), filterFunc.bind(this));
|
||||
}, this);
|
||||
});
|
||||
});
|
||||
}, filterFunc.bind(this));
|
||||
},
|
||||
|
||||
closeExternal: function() {
|
||||
|
@ -76,13 +76,13 @@ var FeedHandler = {
|
||||
title: Strings.browser.GetStringFromName("feedHandler.chooseFeed")
|
||||
}).setSingleChoiceItems(feeds.map(function(feed) {
|
||||
return { label: feed.title || feed.href }
|
||||
})).show((function(data) {
|
||||
})).show(data => {
|
||||
feedIndex = data.button;
|
||||
if (feedIndex == -1)
|
||||
return;
|
||||
|
||||
this.loadFeed(feeds[feedIndex], browser);
|
||||
}).bind(this));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ var InputWidgetHelper = {
|
||||
type: type,
|
||||
min: aElement.min,
|
||||
max: aElement.max,
|
||||
}).show((function(data) {
|
||||
}).show(data => {
|
||||
let changed = false;
|
||||
if (data.button == -1) {
|
||||
// This type is not supported with this android version.
|
||||
@ -59,7 +59,7 @@ var InputWidgetHelper = {
|
||||
|
||||
if (changed)
|
||||
this.fireOnChange(aElement);
|
||||
}).bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
hasInputWidget: function(aElement) {
|
||||
|
@ -87,7 +87,7 @@ Linkifier.prototype = {
|
||||
}
|
||||
|
||||
let nodeWalker = aDoc.createTreeWalker(aDoc.body, NodeFilter.SHOW_TEXT, filterNode, false);
|
||||
let parseNode = function() {
|
||||
let parseNode = () => {
|
||||
let node = nodeWalker.nextNode();
|
||||
if (!node) {
|
||||
this._linkifyTimer = null;
|
||||
@ -101,7 +101,7 @@ Linkifier.prototype = {
|
||||
} else {
|
||||
this._linkifyTimer = setTimeout(parseNode, LINKIFY_TIMEOUT);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
this._linkifyTimer = setTimeout(parseNode, LINKIFY_TIMEOUT);
|
||||
}
|
||||
|
@ -150,10 +150,10 @@ var Addons = {
|
||||
outer.className = "addon-item list-item";
|
||||
outer.setAttribute("role", "button");
|
||||
outer.setAttribute("contextmenu", "addonmenu");
|
||||
outer.addEventListener("click", function() {
|
||||
outer.addEventListener("click", () => {
|
||||
this.showDetails(outer);
|
||||
history.pushState({ id: aAddon.id }, document.title);
|
||||
}.bind(this), true);
|
||||
}, true);
|
||||
|
||||
let img = document.createElement("img");
|
||||
img.className = "icon";
|
||||
|
@ -2343,11 +2343,11 @@ var NativeWindow = {
|
||||
aButtons.length = 2;
|
||||
}
|
||||
|
||||
aButtons.forEach((function(aButton) {
|
||||
aButtons.forEach(aButton => {
|
||||
this._callbacks[this._callbacksId] = { cb: aButton.callback, prompt: this._promptId };
|
||||
aButton.callback = this._callbacksId;
|
||||
this._callbacksId++;
|
||||
}).bind(this));
|
||||
});
|
||||
|
||||
this._promptId++;
|
||||
let json = {
|
||||
@ -2550,7 +2550,7 @@ var NativeWindow = {
|
||||
},
|
||||
|
||||
imageShareableContext: {
|
||||
matches: function imageShareableContextMatches(aElement) {
|
||||
matches: aElement => {
|
||||
let imgSrc = '';
|
||||
if (aElement instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
imgSrc = aElement.src;
|
||||
@ -2570,7 +2570,7 @@ var NativeWindow = {
|
||||
let MAX_IMG_SRC_LEN = 62500;
|
||||
let isTooLong = imgSrc.length >= MAX_IMG_SRC_LEN;
|
||||
return !isTooLong && this.NativeWindow.contextmenus.imageSaveableContext.matches(aElement);
|
||||
}.bind(this)
|
||||
}
|
||||
},
|
||||
|
||||
mediaSaveableContext: {
|
||||
@ -4095,10 +4095,10 @@ Tab.prototype = {
|
||||
|
||||
if (docURI.startsWith("about:certerror") || docURI.startsWith("about:blocked")) {
|
||||
this.browser.addEventListener("click", ErrorPageEventHandler, true);
|
||||
let listener = function() {
|
||||
let listener = () => {
|
||||
this.browser.removeEventListener("click", ErrorPageEventHandler, true);
|
||||
this.browser.removeEventListener("pagehide", listener, true);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
this.browser.addEventListener("pagehide", listener, true);
|
||||
}
|
||||
@ -6255,7 +6255,7 @@ var SearchEngines = {
|
||||
window: browser.contentWindow
|
||||
}).setSingleChoiceItems(engines.map(function(e) {
|
||||
return { label: e.title };
|
||||
})).show((function(data) {
|
||||
})).show(data => {
|
||||
if (data.button == -1)
|
||||
return;
|
||||
|
||||
@ -6272,7 +6272,7 @@ var SearchEngines = {
|
||||
|
||||
GlobalEventDispatcher.sendRequest(newEngineMessage);
|
||||
}
|
||||
}).bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
addOpenSearchEngine: function addOpenSearchEngine(engine) {
|
||||
|
@ -240,11 +240,11 @@ var AboutConfig = {
|
||||
clearTimeout(this._filterChangeTimer);
|
||||
}
|
||||
|
||||
this._filterChangeTimer = setTimeout((function() {
|
||||
this._filterChangeTimer = setTimeout(() => {
|
||||
this._filterChangeTimer = null;
|
||||
// Display updated prefs list when filterInput value settles
|
||||
this._displayNewList();
|
||||
}).bind(this), FILTER_CHANGE_TRIGGER);
|
||||
}, FILTER_CHANGE_TRIGGER);
|
||||
},
|
||||
|
||||
// Update displayed list when filterInput value changes
|
||||
@ -265,9 +265,9 @@ var AboutConfig = {
|
||||
window.onscroll = this.onScroll.bind(this);
|
||||
|
||||
// Pause for screen to settle, then ensure at top
|
||||
setTimeout((function() {
|
||||
setTimeout(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}).bind(this), INITIAL_PAGE_DELAY);
|
||||
}, INITIAL_PAGE_DELAY);
|
||||
},
|
||||
|
||||
// Clear the displayed preferences list
|
||||
|
@ -178,7 +178,7 @@ SessionStore.prototype = {
|
||||
if (data) {
|
||||
// Be ready to handle any restore failures by making sure we have a valid tab opened
|
||||
let window = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let restoreCleanup = (function (aSubject, aTopic, aData) {
|
||||
let restoreCleanup = (aSubject, aTopic, aData) => {
|
||||
Services.obs.removeObserver(restoreCleanup, "sessionstore-windows-restored");
|
||||
|
||||
if (window.BrowserApp.tabs.length == 0) {
|
||||
@ -190,7 +190,7 @@ SessionStore.prototype = {
|
||||
// but we want to make sure it's set even in case of a restore failure.
|
||||
this._startupRestoreFinished = true;
|
||||
log("startupRestoreFinished = true (through notification)");
|
||||
}).bind(this);
|
||||
};
|
||||
Services.obs.addObserver(restoreCleanup, "sessionstore-windows-restored");
|
||||
|
||||
// Do a restore, triggered by Java
|
||||
|
@ -1018,7 +1018,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||
return r;
|
||||
};
|
||||
rpp.setElements = function(start, vals) {
|
||||
vals.forEach(function(v, i) { this.set(start+i, v); }.bind(this));
|
||||
vals.forEach((v, i) => { this.set(start+i, v); });
|
||||
};
|
||||
r['new'] = function(length) {
|
||||
return wrap(jenvpp().NewObjectArray(jenv, length, elemClass, null),
|
||||
|
@ -68,9 +68,9 @@ function RemoteMedia(id, listener) {
|
||||
this._listener = listener;
|
||||
|
||||
if ("onRemoteMediaStart" in this._listener) {
|
||||
Services.tm.dispatchToMainThread((function() {
|
||||
Services.tm.dispatchToMainThread(() => {
|
||||
this._listener.onRemoteMediaStart(this);
|
||||
}).bind(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,15 +228,15 @@ this.UserAgentUpdates = {
|
||||
_update: function() {
|
||||
let url = this._getUpdateURL();
|
||||
url && this._fetchUpdate(url,
|
||||
(function(response) { // success
|
||||
response => { // success
|
||||
// apply update and save overrides to profile
|
||||
this._applyUpdate(response);
|
||||
this._saveToFile(response);
|
||||
this._scheduleUpdate(); // cancel any retries
|
||||
}).bind(this),
|
||||
(function(response) { // error
|
||||
},
|
||||
response => { // error
|
||||
this._scheduleUpdate(true /* retry */);
|
||||
}).bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
_scheduleUpdate: function(retry) {
|
||||
|
@ -776,10 +776,10 @@ var RootFolder = function(rootId, rootName) {
|
||||
}
|
||||
PlacesWrapper.updateCachedFolderIds(folderCache, rootId)
|
||||
.then(getGuidForRootFolder, getGuidForRootFolder)
|
||||
.then(function(guid) {
|
||||
.then(guid => {
|
||||
rootGuid = guid;
|
||||
deferred.resolve(this);
|
||||
}.bind(this),
|
||||
},
|
||||
deferred.reject);
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -137,7 +137,7 @@ PlacesWrapper.prototype = {
|
||||
query.params.item_type = PlacesUtils.bookmarks.TYPE_FOLDER;
|
||||
|
||||
this.asyncQuery(query, ["id", "guid"]).then(
|
||||
function(items) {
|
||||
items => {
|
||||
let previousIds = folderCache.getChildren(folder);
|
||||
let currentIds = new Set();
|
||||
for (let item of items) {
|
||||
@ -169,7 +169,7 @@ PlacesWrapper.prototype = {
|
||||
for (let missingId of missingIds) {
|
||||
folderCache.remove(missingId);
|
||||
}
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
|
||||
return deferred.promise;
|
||||
|
@ -1346,14 +1346,14 @@ StorageServer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let ensureUserExists = function ensureUserExists(username) {
|
||||
let ensureUserExists = username => {
|
||||
if (this.userExists(username)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.info("StorageServer: Unknown user: " + username);
|
||||
throw HTTP_401;
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
let auth = req.getHeader("authorization");
|
||||
this._log.debug("Authorization: " + auth);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user