зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland
This commit is contained in:
Коммит
e1e203f1f5
|
@ -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)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -362,9 +362,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),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -378,9 +378,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));
|
||||
|
|
|
@ -62,7 +62,9 @@ function clear_history() {
|
|||
var waitForLoad = Task.async(function*(uri) {
|
||||
info("Loading " + uri);
|
||||
// Longwinded but this ensures we don't just shortcut to LoadInNewProcess
|
||||
gBrowser.selectedBrowser.webNavigation.loadURI(uri, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
|
||||
gBrowser.selectedBrowser.webNavigation.loadURI(uri, Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
|
||||
null, null, null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal());
|
||||
|
||||
yield waitForDocLoadComplete();
|
||||
gExpectedHistory.index++;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -139,7 +139,9 @@ add_task(function* save_worthy_tabs_remote_final() {
|
|||
ok(browser.isRemoteBrowser, "browser is remote");
|
||||
|
||||
// Replace about:blank with a new remote page.
|
||||
let snippet = 'webNavigation.loadURI("https://example.com/", null, null, null, null)';
|
||||
let snippet = 'webNavigation.loadURI("https://example.com/",\
|
||||
null, null, null, null,\
|
||||
Services.scriptSecurityManager.getSystemPrincipal())';
|
||||
yield promiseNewLocationAndHistoryEntryReplaced(browser, snippet);
|
||||
|
||||
// Remotness shouldn't have changed.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -988,12 +988,14 @@ html|span.ac-emphasize-text-url {
|
|||
|
||||
.ac-type-icon[type=keyword],
|
||||
.ac-site-icon[type=searchengine] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg);
|
||||
/* uncomment after bug 1350010 lands: context-properties: fill; */
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=keyword][selected],
|
||||
.ac-site-icon[type=searchengine][selected] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon-inverted);
|
||||
fill: highlighttext;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=switchtab],
|
||||
|
|
|
@ -1765,12 +1765,14 @@ html|span.ac-emphasize-text-url {
|
|||
|
||||
.ac-type-icon[type=keyword],
|
||||
.ac-site-icon[type=searchengine] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg);
|
||||
/* uncomment after bug 1350010 lands: context-properties: fill; */
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=keyword][selected],
|
||||
.ac-site-icon[type=searchengine][selected] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon-inverted);
|
||||
fill: highlighttext;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=switchtab],
|
||||
|
|
|
@ -72,7 +72,9 @@
|
|||
|
||||
#urlbar[actiontype="searchengine"] > #identity-box > #identity-icon {
|
||||
-moz-image-region: inherit;
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg);
|
||||
/* uncomment after bug 1350010 lands: context-properties: fill; */
|
||||
fill: GrayText;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
|
|
@ -1508,12 +1508,14 @@ html|span.ac-emphasize-text-url {
|
|||
|
||||
.ac-type-icon[type=keyword],
|
||||
.ac-site-icon[type=searchengine] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg);
|
||||
/* uncomment after bug 1350010 lands: context-properties: fill; */
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=keyword][selected],
|
||||
.ac-site-icon[type=searchengine][selected] {
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon-inverted);
|
||||
fill: highlighttext;
|
||||
}
|
||||
|
||||
.ac-type-icon[type=switchtab],
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
};
|
||||
|
|
|
@ -332,7 +332,7 @@ function deflateStack(frames, uniqueStacks) {
|
|||
*/
|
||||
function deflateSamples(samples, uniqueStacks) {
|
||||
// Schema:
|
||||
// [stack, time, responsiveness, rss, uss, frameNumber, power]
|
||||
// [stack, time, responsiveness, rss, uss]
|
||||
|
||||
let deflatedSamples = new Array(samples.length);
|
||||
for (let i = 0; i < samples.length; i++) {
|
||||
|
@ -342,9 +342,7 @@ function deflateSamples(samples, uniqueStacks) {
|
|||
sample.time,
|
||||
sample.responsiveness,
|
||||
sample.rss,
|
||||
sample.uss,
|
||||
sample.frameNumber,
|
||||
sample.power
|
||||
sample.uss
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -459,9 +457,7 @@ function samplesWithSchema(data) {
|
|||
time: slot++,
|
||||
responsiveness: slot++,
|
||||
rss: slot++,
|
||||
uss: slot++,
|
||||
frameNumber: slot++,
|
||||
power: slot++
|
||||
uss: slot++
|
||||
},
|
||||
data: data
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ struct ComputedTiming
|
|||
// indefinitely.
|
||||
StickyTimeDuration mActiveDuration;
|
||||
// The time within the active interval.
|
||||
StickyTimeDuration mActiveTime;
|
||||
StickyTimeDuration mActiveTime;
|
||||
// The effect end time in local time (i.e. an offset from the effect's
|
||||
// start time). Will equal StickyTimeDuration::Forever() if the animation
|
||||
// plays indefinitely.
|
||||
|
@ -73,7 +73,6 @@ struct ComputedTiming
|
|||
|
||||
ComputedTimingFunction::BeforeFlag mBeforeFlag =
|
||||
ComputedTimingFunction::BeforeFlag::Unset;
|
||||
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1018,6 +1018,11 @@ TimeoutManager::ClearAllTimeouts()
|
|||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("ClearAllTimeouts(TimeoutManager=%p)\n", this));
|
||||
|
||||
if (mThrottleTrackingTimeoutsTimer) {
|
||||
mThrottleTrackingTimeoutsTimer->Cancel();
|
||||
mThrottleTrackingTimeoutsTimer = nullptr;
|
||||
}
|
||||
|
||||
ForEachUnorderedTimeout([&](Timeout* aTimeout) {
|
||||
/* If RunTimeout() is higher up on the stack for this
|
||||
window, e.g. as a result of document.write from a timeout,
|
||||
|
@ -1123,6 +1128,11 @@ TimeoutManager::Suspend()
|
|||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("Suspend(TimeoutManager=%p)\n", this));
|
||||
|
||||
if (mThrottleTrackingTimeoutsTimer) {
|
||||
mThrottleTrackingTimeoutsTimer->Cancel();
|
||||
mThrottleTrackingTimeoutsTimer = nullptr;
|
||||
}
|
||||
|
||||
ForEachUnorderedTimeout([](Timeout* aTimeout) {
|
||||
// Leave the timers with the current time remaining. This will
|
||||
// cause the timers to potentially fire when the window is
|
||||
|
@ -1146,6 +1156,13 @@ TimeoutManager::Resume()
|
|||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("Resume(TimeoutManager=%p)\n", this));
|
||||
|
||||
// When Suspend() has been called after IsDocumentLoaded(), but the
|
||||
// throttle tracking timer never managed to fire, start the timer
|
||||
// again.
|
||||
if (mWindow.AsInner()->IsDocumentLoaded() && !mThrottleTrackingTimeouts) {
|
||||
MaybeStartThrottleTrackingTimout();
|
||||
}
|
||||
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
DebugOnly<bool> _seenDummyTimeout = false;
|
||||
|
||||
|
@ -1311,6 +1328,12 @@ TimeoutManager::StartThrottlingTrackingTimeouts()
|
|||
|
||||
void
|
||||
TimeoutManager::OnDocumentLoaded()
|
||||
{
|
||||
MaybeStartThrottleTrackingTimout();
|
||||
}
|
||||
|
||||
void
|
||||
TimeoutManager::MaybeStartThrottleTrackingTimout()
|
||||
{
|
||||
if (gTrackingTimeoutThrottlingDelay <= 0) {
|
||||
return;
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
|
||||
private:
|
||||
nsresult ResetTimersForThrottleReduction(int32_t aPreviousThrottleDelayMS);
|
||||
void MaybeStartThrottleTrackingTimout();
|
||||
|
||||
private:
|
||||
struct Timeouts {
|
||||
|
|
|
@ -4330,6 +4330,12 @@ nsPIDOMWindowInner::IsPlayingAudio()
|
|||
return acs->IsWindowActive(outer);
|
||||
}
|
||||
|
||||
bool
|
||||
nsPIDOMWindowInner::IsDocumentLoaded() const
|
||||
{
|
||||
return mIsDocumentLoaded;
|
||||
}
|
||||
|
||||
mozilla::dom::TimeoutManager&
|
||||
nsPIDOMWindowInner::TimeoutManager()
|
||||
{
|
||||
|
|
|
@ -890,6 +890,8 @@ public:
|
|||
|
||||
bool IsPlayingAudio();
|
||||
|
||||
bool IsDocumentLoaded() const;
|
||||
|
||||
mozilla::dom::TimeoutManager& TimeoutManager();
|
||||
|
||||
bool IsRunningTimeout();
|
||||
|
|
|
@ -450,21 +450,8 @@ void
|
|||
nsTextFragment::UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength)
|
||||
{
|
||||
if (mState.mIs2b && !mState.mIsBidi) {
|
||||
const char16_t* cp = aBuffer;
|
||||
const char16_t* end = cp + aLength;
|
||||
while (cp < end) {
|
||||
char16_t ch1 = *cp++;
|
||||
uint32_t utf32Char = ch1;
|
||||
if (NS_IS_HIGH_SURROGATE(ch1) &&
|
||||
cp < end &&
|
||||
NS_IS_LOW_SURROGATE(*cp)) {
|
||||
char16_t ch2 = *cp++;
|
||||
utf32Char = SURROGATE_TO_UCS4(ch1, ch2);
|
||||
}
|
||||
if (UTF32_CHAR_IS_BIDI(utf32Char) || IsBidiControlRTL(utf32Char)) {
|
||||
mState.mIsBidi = true;
|
||||
break;
|
||||
}
|
||||
if (HasRTLChars(aBuffer, aLength)) {
|
||||
mState.mIsBidi = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ def web_socket_do_extra_handshake(request):
|
|||
time.sleep(13)
|
||||
elif request.ws_protocol == "test-41b":
|
||||
request.sts = "max-age=100"
|
||||
elif request.ws_protocol == "test-49":
|
||||
# subprotocols are compared case-sensitively, so this should fail
|
||||
request.ws_protocol = "teST-49"
|
||||
else:
|
||||
pass
|
||||
|
||||
|
|
|
@ -19,14 +19,24 @@
|
|||
document.documentElement.clientWidth || document.body.clientWidth;
|
||||
var viewportHeight =
|
||||
document.documentElement.clientHeight || document.body.clientHeight;
|
||||
var passed = records.length === 1 &&
|
||||
var result = records.length === 1 &&
|
||||
records[0].rootBounds.top === 0 &&
|
||||
records[0].rootBounds.left === 0 &&
|
||||
records[0].rootBounds.right === viewportWidth &&
|
||||
records[0].rootBounds.width === viewportWidth &&
|
||||
records[0].rootBounds.bottom === viewportHeight &&
|
||||
records[0].rootBounds.height === viewportHeight;
|
||||
window.opener.postMessage(passed, '*');
|
||||
if (!result) {
|
||||
result = [records[0].rootBounds.top,
|
||||
records[0].rootBounds.left,
|
||||
records[0].rootBounds.right,
|
||||
records[0].rootBounds.width,
|
||||
records[0].rootBounds.bottom,
|
||||
records[0].rootBounds.height,
|
||||
viewportWidth,
|
||||
viewportHeight].join(',');
|
||||
}
|
||||
window.opener.postMessage(result, '*');
|
||||
});
|
||||
io.observe(document.getElementById("target"));
|
||||
</script>
|
||||
|
|
|
@ -653,7 +653,8 @@ skip-if = (toolkit == 'android') # Android: Bug 775227
|
|||
[test_innersize_scrollport.html]
|
||||
[test_integer_attr_with_leading_zero.html]
|
||||
[test_intersectionobservers.html]
|
||||
skip-if = true # Track Bug 1320704
|
||||
[test_intersectionobserver_no_root.html]
|
||||
skip-if = (os == "android") # bug 1360041
|
||||
[test_link_prefetch.html]
|
||||
skip-if = !e10s # Track Bug 1281415
|
||||
[test_link_stylesheet.html]
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1313927</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="onLoad()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1313927">Mozilla Bug 1313927</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
function runTest() {
|
||||
var win;
|
||||
|
||||
window.onmessage = function (e) {
|
||||
win.close();
|
||||
is(e.data, true);
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
win = window.open("intersectionobserver_window.html");
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.IntersectionObserver.enabled", true]]}, runTest);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<div id="log">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -24,14 +24,11 @@ limitations under the License.
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="next()">
|
||||
<body onload="onLoad()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1243846">Mozilla Bug 1243846</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
SpecialPowers.setIntPref("layout.visibility.min-notify-intersection-observers-interval-ms", 0);
|
||||
|
||||
var tests = [];
|
||||
var curDescribeMsg = '';
|
||||
var curItMsg = '';
|
||||
|
@ -1242,6 +1239,10 @@ limitations under the License.
|
|||
targetEl4 = null;
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.IntersectionObserver.enabled", true]]}, next);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -21,6 +21,7 @@ var tests = [
|
|||
test47, // Make sure onerror/onclose aren't called during close()
|
||||
test48, // see bug 1227136 - client calls close() from onopen() and waits
|
||||
// until WebSocketChannel::mSocketIn is nulled out on socket thread
|
||||
test49, // Test that we fail if subprotocol returned from server doesn't match
|
||||
];
|
||||
|
||||
function testWebSocket() {
|
||||
|
|
|
@ -1242,3 +1242,29 @@ function test48() {
|
|||
SpecialPowers.clearUserPref(pref_close);
|
||||
});
|
||||
}
|
||||
|
||||
function test49()
|
||||
{
|
||||
return new Promise(function(resolve, reject) {
|
||||
var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-49");
|
||||
var gotError = 0;
|
||||
ok(ws.readyState == 0, "create bad readyState in test-49!");
|
||||
|
||||
ws.onopen = function()
|
||||
{
|
||||
ok(false, "Connection must fail in test-49")
|
||||
}
|
||||
|
||||
ws.onerror = function(e)
|
||||
{
|
||||
gotError = 1
|
||||
}
|
||||
|
||||
ws.onclose = function(e)
|
||||
{
|
||||
ok(gotError, "Should get error in test-49!");
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -89,9 +89,17 @@ FileSystemSecurity::ContentProcessHasAccessTo(ContentParentId aId,
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AssertIsInMainProcess();
|
||||
|
||||
if (FindInReadable(NS_LITERAL_STRING(".."), aPath)) {
|
||||
#if defined(XP_WIN)
|
||||
if (StringBeginsWith(aPath, NS_LITERAL_STRING("..\\")) ||
|
||||
FindInReadable(NS_LITERAL_STRING("\\..\\"), aPath)) {
|
||||
return false;
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
if (StringBeginsWith(aPath, NS_LITERAL_STRING("../")) ||
|
||||
FindInReadable(NS_LITERAL_STRING("/../"), aPath)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsTArray<nsString>* paths;
|
||||
if (!mPaths.Get(aId, &paths)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ addMessageListener("entries.open", function (e) {
|
|||
dir1.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o700);
|
||||
|
||||
var file2 = dir1.clone();
|
||||
file2.append('bar.txt');
|
||||
file2.append('bar..txt'); // Note the double ..
|
||||
file2.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o600);
|
||||
|
||||
var dir2 = dir1.clone();
|
||||
|
|
|
@ -176,9 +176,9 @@ function test_directoryEntry_getFile_simple() {
|
|||
}
|
||||
|
||||
function test_directoryEntry_getFile_deep() {
|
||||
directoryEntry.getFile("subdir/bar.txt", {},
|
||||
directoryEntry.getFile("subdir/bar..txt", {},
|
||||
function(e) {
|
||||
is(e.name, "bar.txt", "We have the right FileEntry.");
|
||||
is(e.name, "bar..txt", "We have the right FileEntry.");
|
||||
test_getParent(e, directoryEntry, /* nested */ true);
|
||||
}, function(e) {
|
||||
ok(false, "This should not happen.");
|
||||
|
@ -316,9 +316,9 @@ function test_root_getFile_simple() {
|
|||
}
|
||||
|
||||
function test_root_getFile_deep() {
|
||||
fileEntry.filesystem.root.getFile(directoryEntry.name + "/subdir/bar.txt", {},
|
||||
fileEntry.filesystem.root.getFile(directoryEntry.name + "/subdir/bar..txt", {},
|
||||
function(e) {
|
||||
is(e.name, "bar.txt", "We have the right FileEntry.");
|
||||
is(e.name, "bar..txt", "We have the right FileEntry.");
|
||||
next();
|
||||
}, function(e) {
|
||||
ok(false, "This should not happen.");
|
||||
|
|
|
@ -412,6 +412,72 @@ NS_DEFINE_STATIC_IID_ACCESSOR(HTMLInputElementState, NS_INPUT_ELEMENT_STATE_IID)
|
|||
|
||||
NS_IMPL_ISUPPORTS(HTMLInputElementState, HTMLInputElementState)
|
||||
|
||||
struct HTMLInputElement::FileData
|
||||
{
|
||||
/**
|
||||
* The value of the input if it is a file input. This is the list of files or
|
||||
* directories DOM objects used when uploading a file. It is vital that this
|
||||
* is kept separate from mValue so that it won't be possible to 'leak' the
|
||||
* value from a text-input to a file-input. Additionally, the logic for this
|
||||
* value is kept as simple as possible to avoid accidental errors where the
|
||||
* wrong filename is used. Therefor the list of filenames is always owned by
|
||||
* this member, never by the frame. Whenever the frame wants to change the
|
||||
* filename it has to call SetFilesOrDirectories to update this member.
|
||||
*/
|
||||
nsTArray<OwningFileOrDirectory> mFilesOrDirectories;
|
||||
|
||||
RefPtr<GetFilesHelper> mGetFilesRecursiveHelper;
|
||||
RefPtr<GetFilesHelper> mGetFilesNonRecursiveHelper;
|
||||
|
||||
/**
|
||||
* Hack for bug 1086684: Stash the .value when we're a file picker.
|
||||
*/
|
||||
nsString mFirstFilePath;
|
||||
|
||||
RefPtr<FileList> mFileList;
|
||||
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||
|
||||
nsString mStaticDocFileList;
|
||||
|
||||
void ClearGetFilesHelpers()
|
||||
{
|
||||
if (mGetFilesNonRecursiveHelper) {
|
||||
mGetFilesRecursiveHelper->Unlink();
|
||||
mGetFilesRecursiveHelper = nullptr;
|
||||
}
|
||||
|
||||
if (mGetFilesNonRecursiveHelper) {
|
||||
mGetFilesNonRecursiveHelper->Unlink();
|
||||
mGetFilesNonRecursiveHelper = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Cycle Collection support.
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
{
|
||||
FileData* tmp = this;
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFilesOrDirectories)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFileList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEntries)
|
||||
if (mGetFilesRecursiveHelper) {
|
||||
mGetFilesRecursiveHelper->Traverse(cb);
|
||||
}
|
||||
|
||||
if (mGetFilesNonRecursiveHelper) {
|
||||
mGetFilesNonRecursiveHelper->Traverse(cb);
|
||||
}
|
||||
}
|
||||
|
||||
void Unlink()
|
||||
{
|
||||
FileData* tmp = this;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFilesOrDirectories)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFileList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEntries)
|
||||
ClearGetFilesHelpers();
|
||||
}
|
||||
};
|
||||
|
||||
HTMLInputElement::nsFilePickerShownCallback::nsFilePickerShownCallback(
|
||||
HTMLInputElement* aInput, nsIFilePicker* aFilePicker)
|
||||
: mFilePicker(aFilePicker)
|
||||
|
@ -1106,6 +1172,12 @@ HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
|||
, mSelectionCached(true)
|
||||
, mIsPreviewEnabled(false)
|
||||
{
|
||||
// If size is above 512, mozjemalloc allocates 1kB, see
|
||||
// memory/mozjemalloc/jemalloc.c
|
||||
static_assert(sizeof(HTMLInputElement) <= 512,
|
||||
"Keep the size of HTMLInputElement under 512 to avoid "
|
||||
"performance regression!");
|
||||
|
||||
// We are in a type=text so we now we currenty need a nsTextEditorState.
|
||||
mInputData.mState =
|
||||
nsTextEditorState::Construct(this, &sCachedTextEditorState);
|
||||
|
@ -1171,33 +1243,23 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLInputElement,
|
|||
if (tmp->IsSingleLineTextControl(false)) {
|
||||
tmp->mInputData.mState->Traverse(cb);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFilesOrDirectories)
|
||||
|
||||
if (tmp->mGetFilesRecursiveHelper) {
|
||||
tmp->mGetFilesRecursiveHelper->Traverse(cb);
|
||||
if (tmp->mFileData) {
|
||||
tmp->mFileData->Traverse(cb);
|
||||
}
|
||||
|
||||
if (tmp->mGetFilesNonRecursiveHelper) {
|
||||
tmp->mGetFilesNonRecursiveHelper->Traverse(cb);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFileList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEntries)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLInputElement,
|
||||
nsGenericHTMLFormElementWithState)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFilesOrDirectories)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFileList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEntries)
|
||||
if (tmp->IsSingleLineTextControl(false)) {
|
||||
tmp->mInputData.mState->Unlink();
|
||||
}
|
||||
|
||||
tmp->ClearGetFilesHelpers();
|
||||
|
||||
if (tmp->mFileData) {
|
||||
tmp->mFileData->Unlink();
|
||||
}
|
||||
//XXX should unlink more?
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
@ -1250,11 +1312,12 @@ HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) co
|
|||
if (it->OwnerDoc()->IsStaticDocument()) {
|
||||
// We're going to be used in print preview. Since the doc is static
|
||||
// we can just grab the pretty string and use it as wallpaper
|
||||
GetDisplayFileName(it->mStaticDocFileList);
|
||||
GetDisplayFileName(it->mFileData->mStaticDocFileList);
|
||||
} else {
|
||||
it->ClearGetFilesHelpers();
|
||||
it->mFilesOrDirectories.Clear();
|
||||
it->mFilesOrDirectories.AppendElements(mFilesOrDirectories);
|
||||
it->mFileData->ClearGetFilesHelpers();
|
||||
it->mFileData->mFilesOrDirectories.Clear();
|
||||
it->mFileData->mFilesOrDirectories.AppendElements(
|
||||
mFileData->mFilesOrDirectories);
|
||||
}
|
||||
break;
|
||||
case VALUE_MODE_DEFAULT_ON:
|
||||
|
@ -1671,17 +1734,17 @@ HTMLInputElement::GetValueInternal(nsAString& aValue,
|
|||
}
|
||||
|
||||
if (aCallerType == CallerType::System) {
|
||||
aValue.Assign(mFirstFilePath);
|
||||
aValue.Assign(mFileData->mFirstFilePath);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFilesOrDirectories.IsEmpty()) {
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
aValue.Truncate();
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString file;
|
||||
GetDOMFileOrDirectoryName(mFilesOrDirectories[0], file);
|
||||
GetDOMFileOrDirectoryName(mFileData->mFilesOrDirectories[0], file);
|
||||
if (file.IsEmpty()) {
|
||||
aValue.Truncate();
|
||||
return;
|
||||
|
@ -2507,9 +2570,15 @@ void
|
|||
HTMLInputElement::MozGetFileNameArray(nsTArray<nsString>& aArray,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
for (uint32_t i = 0; i < mFilesOrDirectories.Length(); i++) {
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nsTArray<OwningFileOrDirectory>& filesOrDirs =
|
||||
GetFilesOrDirectoriesInternal();
|
||||
for (uint32_t i = 0; i < filesOrDirs.Length(); i++) {
|
||||
nsAutoString str;
|
||||
GetDOMFileOrDirectoryPath(mFilesOrDirectories[i], str, aRv);
|
||||
GetDOMFileOrDirectoryPath(filesOrDirs[i], str, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
@ -2521,6 +2590,10 @@ HTMLInputElement::MozGetFileNameArray(nsTArray<nsString>& aArray,
|
|||
void
|
||||
HTMLInputElement::MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles)
|
||||
{
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
if (!global) {
|
||||
|
@ -2543,6 +2616,10 @@ void
|
|||
HTMLInputElement::MozSetFileNameArray(const Sequence<nsString>& aFileNames,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
|
@ -2588,6 +2665,10 @@ void
|
|||
HTMLInputElement::MozSetDirectory(const nsAString& aDirectoryPath,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
aRv = NS_NewLocalFile(aDirectoryPath, true, getter_AddRefs(file));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
@ -2968,19 +3049,21 @@ HTMLInputElement::GetPreviewVisibility()
|
|||
void
|
||||
HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(mFileData);
|
||||
|
||||
if (OwnerDoc()->IsStaticDocument()) {
|
||||
aValue = mStaticDocFileList;
|
||||
aValue = mFileData->mStaticDocFileList;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFilesOrDirectories.Length() == 1) {
|
||||
GetDOMFileOrDirectoryName(mFilesOrDirectories[0], aValue);
|
||||
if (mFileData->mFilesOrDirectories.Length() == 1) {
|
||||
GetDOMFileOrDirectoryName(mFileData->mFilesOrDirectories[0], aValue);
|
||||
return;
|
||||
}
|
||||
|
||||
nsXPIDLString value;
|
||||
|
||||
if (mFilesOrDirectories.IsEmpty()) {
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
if ((IsDirPickerEnabled() && Allowdirs()) ||
|
||||
(IsWebkitDirPickerEnabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
|
||||
|
@ -2995,7 +3078,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
|||
}
|
||||
} else {
|
||||
nsString count;
|
||||
count.AppendInt(int(mFilesOrDirectories.Length()));
|
||||
count.AppendInt(int(mFileData->mFilesOrDirectories.Length()));
|
||||
|
||||
const char16_t* params[] = { count.get() };
|
||||
nsContentUtils::FormatLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
|
@ -3005,19 +3088,27 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
|||
aValue = value;
|
||||
}
|
||||
|
||||
const nsTArray<OwningFileOrDirectory>&
|
||||
HTMLInputElement::GetFilesOrDirectoriesInternal() const
|
||||
{
|
||||
return mFileData->mFilesOrDirectories;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::SetFilesOrDirectories(const nsTArray<OwningFileOrDirectory>& aFilesOrDirectories,
|
||||
bool aSetValueChanged)
|
||||
{
|
||||
ClearGetFilesHelpers();
|
||||
MOZ_ASSERT(mFileData);
|
||||
|
||||
mFileData->ClearGetFilesHelpers();
|
||||
|
||||
if (IsWebkitFileSystemEnabled()) {
|
||||
HTMLInputElementBinding::ClearCachedWebkitEntriesValue(this);
|
||||
mEntries.Clear();
|
||||
mFileData->mEntries.Clear();
|
||||
}
|
||||
|
||||
mFilesOrDirectories.Clear();
|
||||
mFilesOrDirectories.AppendElements(aFilesOrDirectories);
|
||||
mFileData->mFilesOrDirectories.Clear();
|
||||
mFileData->mFilesOrDirectories.AppendElements(aFilesOrDirectories);
|
||||
|
||||
AfterSetFilesOrDirectories(aSetValueChanged);
|
||||
}
|
||||
|
@ -3026,20 +3117,23 @@ void
|
|||
HTMLInputElement::SetFiles(nsIDOMFileList* aFiles,
|
||||
bool aSetValueChanged)
|
||||
{
|
||||
MOZ_ASSERT(mFileData);
|
||||
|
||||
RefPtr<FileList> files = static_cast<FileList*>(aFiles);
|
||||
mFilesOrDirectories.Clear();
|
||||
ClearGetFilesHelpers();
|
||||
mFileData->mFilesOrDirectories.Clear();
|
||||
mFileData->ClearGetFilesHelpers();
|
||||
|
||||
if (IsWebkitFileSystemEnabled()) {
|
||||
HTMLInputElementBinding::ClearCachedWebkitEntriesValue(this);
|
||||
mEntries.Clear();
|
||||
mFileData->mEntries.Clear();
|
||||
}
|
||||
|
||||
if (aFiles) {
|
||||
uint32_t listLength;
|
||||
aFiles->GetLength(&listLength);
|
||||
for (uint32_t i = 0; i < listLength; i++) {
|
||||
OwningFileOrDirectory* element = mFilesOrDirectories.AppendElement();
|
||||
OwningFileOrDirectory* element =
|
||||
mFileData->mFilesOrDirectories.AppendElement();
|
||||
element->SetAsFile() = files->Item(i);
|
||||
}
|
||||
}
|
||||
|
@ -3051,6 +3145,10 @@ HTMLInputElement::SetFiles(nsIDOMFileList* aFiles,
|
|||
void
|
||||
HTMLInputElement::MozSetDndFilesAndDirectories(const nsTArray<OwningFileOrDirectory>& aFilesOrDirectories)
|
||||
{
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetFilesOrDirectories(aFilesOrDirectories, true);
|
||||
|
||||
if (IsWebkitFileSystemEnabled()) {
|
||||
|
@ -3094,11 +3192,12 @@ HTMLInputElement::AfterSetFilesOrDirectories(bool aSetValueChanged)
|
|||
// call under GetMozFullPath won't be rejected for not being urgent.
|
||||
// XXX Protected by the ifndef because the blob code doesn't allow us to send
|
||||
// this message in b2g.
|
||||
if (mFilesOrDirectories.IsEmpty()) {
|
||||
mFirstFilePath.Truncate();
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
mFileData->mFirstFilePath.Truncate();
|
||||
} else {
|
||||
ErrorResult rv;
|
||||
GetDOMFileOrDirectoryPath(mFilesOrDirectories[0], mFirstFilePath, rv);
|
||||
GetDOMFileOrDirectoryPath(mFileData->mFilesOrDirectories[0],
|
||||
mFileData->mFirstFilePath, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
rv.SuppressException();
|
||||
}
|
||||
|
@ -3146,12 +3245,12 @@ HTMLInputElement::GetFiles()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mFileList) {
|
||||
mFileList = new FileList(static_cast<nsIContent*>(this));
|
||||
if (!mFileData->mFileList) {
|
||||
mFileData->mFileList = new FileList(static_cast<nsIContent*>(this));
|
||||
UpdateFileList();
|
||||
}
|
||||
|
||||
return mFileList;
|
||||
return mFileData->mFileList;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
@ -3177,15 +3276,17 @@ HTMLInputElement::HandleNumberControlSpin(void* aData)
|
|||
void
|
||||
HTMLInputElement::UpdateFileList()
|
||||
{
|
||||
if (mFileList) {
|
||||
mFileList->Clear();
|
||||
MOZ_ASSERT(mFileData);
|
||||
|
||||
if (mFileData->mFileList) {
|
||||
mFileData->mFileList->Clear();
|
||||
|
||||
const nsTArray<OwningFileOrDirectory>& array =
|
||||
GetFilesOrDirectoriesInternal();
|
||||
|
||||
for (uint32_t i = 0; i < array.Length(); ++i) {
|
||||
if (array[i].IsFile()) {
|
||||
mFileList->Append(array[i].GetAsFile());
|
||||
mFileData->mFileList->Append(array[i].GetAsFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5086,10 +5187,12 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
|
|||
MOZ_ASSERT(oldType != aNewType);
|
||||
|
||||
if (aNewType == NS_FORM_INPUT_FILE || oldType == NS_FORM_INPUT_FILE) {
|
||||
// Strictly speaking, we only need to clear files on going _to_ or _from_
|
||||
// the NS_FORM_INPUT_FILE type, not both, since we'll never confuse values
|
||||
// and filenames. But this is safer.
|
||||
ClearFiles(false);
|
||||
if (aNewType == NS_FORM_INPUT_FILE) {
|
||||
mFileData.reset(new FileData());
|
||||
} else {
|
||||
mFileData->Unlink();
|
||||
mFileData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldType == NS_FORM_INPUT_RANGE && mIsDraggingRange) {
|
||||
|
@ -6647,9 +6750,9 @@ HTMLInputElement::SaveState()
|
|||
}
|
||||
break;
|
||||
case VALUE_MODE_FILENAME:
|
||||
if (!mFilesOrDirectories.IsEmpty()) {
|
||||
if (!mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
inputState = new HTMLInputElementState();
|
||||
inputState->SetFilesOrDirectories(mFilesOrDirectories);
|
||||
inputState->SetFilesOrDirectories(mFileData->mFilesOrDirectories);
|
||||
}
|
||||
break;
|
||||
case VALUE_MODE_VALUE:
|
||||
|
@ -8574,24 +8677,12 @@ HTMLInputElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|||
return HTMLInputElementBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::ClearGetFilesHelpers()
|
||||
{
|
||||
if (mGetFilesRecursiveHelper) {
|
||||
mGetFilesRecursiveHelper->Unlink();
|
||||
mGetFilesRecursiveHelper = nullptr;
|
||||
}
|
||||
|
||||
if (mGetFilesNonRecursiveHelper) {
|
||||
mGetFilesNonRecursiveHelper->Unlink();
|
||||
mGetFilesNonRecursiveHelper = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
GetFilesHelper*
|
||||
HTMLInputElement::GetOrCreateGetFilesHelper(bool aRecursiveFlag,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(mFileData);
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
if (!global) {
|
||||
|
@ -8600,36 +8691,36 @@ HTMLInputElement::GetOrCreateGetFilesHelper(bool aRecursiveFlag,
|
|||
}
|
||||
|
||||
if (aRecursiveFlag) {
|
||||
if (!mGetFilesRecursiveHelper) {
|
||||
mGetFilesRecursiveHelper =
|
||||
GetFilesHelper::Create(global,
|
||||
GetFilesOrDirectoriesInternal(),
|
||||
aRecursiveFlag, aRv);
|
||||
if (!mFileData->mGetFilesRecursiveHelper) {
|
||||
mFileData->mGetFilesRecursiveHelper =
|
||||
GetFilesHelper::Create(global,
|
||||
GetFilesOrDirectoriesInternal(),
|
||||
aRecursiveFlag, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return mGetFilesRecursiveHelper;
|
||||
return mFileData->mGetFilesRecursiveHelper;
|
||||
}
|
||||
|
||||
if (!mGetFilesNonRecursiveHelper) {
|
||||
mGetFilesNonRecursiveHelper =
|
||||
GetFilesHelper::Create(global,
|
||||
GetFilesOrDirectoriesInternal(),
|
||||
aRecursiveFlag, aRv);
|
||||
if (!mFileData->mGetFilesNonRecursiveHelper) {
|
||||
mFileData->mGetFilesNonRecursiveHelper =
|
||||
GetFilesHelper::Create(global,
|
||||
GetFilesOrDirectoriesInternal(),
|
||||
aRecursiveFlag, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return mGetFilesNonRecursiveHelper;
|
||||
return mFileData->mGetFilesNonRecursiveHelper;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrDirectories)
|
||||
{
|
||||
MOZ_ASSERT(mEntries.IsEmpty());
|
||||
MOZ_ASSERT(mFileData && mFileData->mEntries.IsEmpty());
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
|
@ -8654,14 +8745,18 @@ HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrD
|
|||
// dropped fileEntry and directoryEntry objects.
|
||||
fs->CreateRoot(entries);
|
||||
|
||||
mEntries.SwapElements(entries);
|
||||
mFileData->mEntries.SwapElements(entries);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::GetWebkitEntries(nsTArray<RefPtr<FileSystemEntry>>& aSequence)
|
||||
{
|
||||
if (NS_WARN_IF(mType != NS_FORM_INPUT_FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::BLINK_FILESYSTEM_USED, true);
|
||||
aSequence.AppendElements(mEntries);
|
||||
aSequence.AppendElements(mFileData->mEntries);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -256,10 +256,7 @@ public:
|
|||
|
||||
void GetDisplayFileName(nsAString& aFileName) const;
|
||||
|
||||
const nsTArray<OwningFileOrDirectory>& GetFilesOrDirectoriesInternal() const
|
||||
{
|
||||
return mFilesOrDirectories;
|
||||
}
|
||||
const nsTArray<OwningFileOrDirectory>& GetFilesOrDirectoriesInternal() const;
|
||||
|
||||
void SetFilesOrDirectories(const nsTArray<OwningFileOrDirectory>& aFilesOrDirectories,
|
||||
bool aSetValueChanged);
|
||||
|
@ -1533,30 +1530,8 @@ protected:
|
|||
nsTextEditorState* mState;
|
||||
} mInputData;
|
||||
|
||||
/**
|
||||
* The value of the input if it is a file input. This is the list of files or
|
||||
* directories DOM objects used when uploading a file. It is vital that this
|
||||
* is kept separate from mValue so that it won't be possible to 'leak' the
|
||||
* value from a text-input to a file-input. Additionally, the logic for this
|
||||
* value is kept as simple as possible to avoid accidental errors where the
|
||||
* wrong filename is used. Therefor the list of filenames is always owned by
|
||||
* this member, never by the frame. Whenever the frame wants to change the
|
||||
* filename it has to call SetFilesOrDirectories to update this member.
|
||||
*/
|
||||
nsTArray<OwningFileOrDirectory> mFilesOrDirectories;
|
||||
|
||||
RefPtr<GetFilesHelper> mGetFilesRecursiveHelper;
|
||||
RefPtr<GetFilesHelper> mGetFilesNonRecursiveHelper;
|
||||
|
||||
/**
|
||||
* Hack for bug 1086684: Stash the .value when we're a file picker.
|
||||
*/
|
||||
nsString mFirstFilePath;
|
||||
|
||||
RefPtr<FileList> mFileList;
|
||||
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||
|
||||
nsString mStaticDocFileList;
|
||||
struct FileData;
|
||||
UniquePtr<FileData> mFileData;
|
||||
|
||||
/**
|
||||
* The value of the input element when first initialized and it is updated
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче