зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1207497 - Part 1: Remove use of expression closure from toolkit/, exept tests. r=Gijs
--HG-- extra : commitid : 7TOGiSg7KEL extra : rebase_source : e6c1672e9b7e9d18aa4a430051789b5962c0ec14
This commit is contained in:
Родитель
3bebe8c6dc
Коммит
7ff6b0aae3
|
@ -68,7 +68,7 @@ var ZoomManager = {
|
|||
get zoomValues() {
|
||||
var zoomValues = this._prefBranch.getCharPref("toolkit.zoomManager.zoomValues")
|
||||
.split(",").map(parseFloat);
|
||||
zoomValues.sort(function (a, b) a - b);
|
||||
zoomValues.sort((a, b) => a - b);
|
||||
|
||||
while (zoomValues[0] < this.MIN)
|
||||
zoomValues.shift();
|
||||
|
|
|
@ -567,7 +567,7 @@
|
|||
({
|
||||
_autocomplete: this,
|
||||
_kGlobalClipboard: Components.interfaces.nsIClipboard.kGlobalClipboard,
|
||||
supportsCommand: function(aCommand) aCommand == "cmd_paste",
|
||||
supportsCommand: aCommand => aCommand == "cmd_paste",
|
||||
doCommand: function(aCommand) {
|
||||
this._autocomplete._valueIsPasted = true;
|
||||
this._autocomplete.editor.paste(this._kGlobalClipboard);
|
||||
|
|
|
@ -219,7 +219,9 @@
|
|||
let tmp = {};
|
||||
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
|
||||
let draghandle = new tmp.WindowDraggingElement(this);
|
||||
draghandle.mouseDownCheck = function () this._dragBindingAlive;
|
||||
draghandle.mouseDownCheck = function () {
|
||||
return this._dragBindingAlive;
|
||||
};
|
||||
} catch (e) {}
|
||||
}
|
||||
</constructor>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<![CDATA[
|
||||
var closedNotification = this._closedNotification;
|
||||
var notifications = this.getElementsByTagName('notification');
|
||||
return Array.filter(notifications, function(n) n != closedNotification);
|
||||
return Array.filter(notifications, n => n != closedNotification);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
|
|
@ -272,7 +272,9 @@
|
|||
let tmp = {};
|
||||
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
|
||||
let draghandle = new tmp.WindowDraggingElement(this);
|
||||
draghandle.mouseDownCheck = function () this._dragBindingAlive;
|
||||
draghandle.mouseDownCheck = function () {
|
||||
return this._dragBindingAlive;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
]]>
|
||||
|
|
|
@ -556,7 +556,7 @@
|
|||
const XULNS =
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
return Array.map(this.getElementsByTagNameNS(XULNS, "label"),
|
||||
function (label) label.value)
|
||||
label => label.value)
|
||||
.join(" ");
|
||||
]]>
|
||||
</getter>
|
||||
|
|
|
@ -514,7 +514,7 @@
|
|||
else {
|
||||
let isVertical = event.axis == event.VERTICAL_AXIS;
|
||||
|
||||
if (this._prevMouseScrolls.every(function(prev) prev == isVertical))
|
||||
if (this._prevMouseScrolls.every(prev => prev == isVertical))
|
||||
this.scrollByIndex(isVertical && this._isRTLScrollbox ? -event.detail :
|
||||
event.detail);
|
||||
|
||||
|
|
|
@ -812,7 +812,7 @@
|
|||
// '-moz-user-focus' so that tabs can be focused by keyboard again.
|
||||
if (!isTabFocused) {
|
||||
this.setAttribute("ignorefocus", "true");
|
||||
setTimeout(function (tab) tab.removeAttribute("ignorefocus"), 0, this);
|
||||
setTimeout(tab => tab.removeAttribute("ignorefocus"), 0, this);
|
||||
}
|
||||
|
||||
if (stopwatchid) {
|
||||
|
|
|
@ -414,7 +414,9 @@
|
|||
toolbar: this,
|
||||
contextMenu: null,
|
||||
|
||||
get active () !!this.contextMenu,
|
||||
get active () {
|
||||
return !!this.contextMenu;
|
||||
},
|
||||
|
||||
init: function (event) {
|
||||
var node = event.target;
|
||||
|
|
|
@ -174,7 +174,7 @@ this.ForgetAboutSite = {
|
|||
let cps2 = Cc["@mozilla.org/content-pref/service;1"].
|
||||
getService(Ci.nsIContentPrefService2);
|
||||
cps2.removeBySubdomain(aDomain, null, {
|
||||
handleCompletion: function() onContentPrefsRemovalFinished(),
|
||||
handleCompletion: () => onContentPrefsRemovalFinished(),
|
||||
handleError: function() {}
|
||||
});
|
||||
|
||||
|
|
|
@ -134,7 +134,9 @@ this.DeferredTask.prototype = {
|
|||
* Indicates whether the task is currently requested to start again later,
|
||||
* regardless of whether it is currently running.
|
||||
*/
|
||||
get isArmed() this._armed,
|
||||
get isArmed() {
|
||||
return this._armed;
|
||||
},
|
||||
_armed: false,
|
||||
|
||||
/**
|
||||
|
@ -142,7 +144,9 @@ this.DeferredTask.prototype = {
|
|||
* read from code inside the task function, but can also be true when read
|
||||
* from external code, in case the task is an asynchronous generator function.
|
||||
*/
|
||||
get isRunning() !!this._runningPromise,
|
||||
get isRunning() {
|
||||
return !!this._runningPromise;
|
||||
},
|
||||
|
||||
/**
|
||||
* Promise resolved when the current execution of the task terminates, or null
|
||||
|
|
|
@ -9,8 +9,9 @@ const {classes: Cc, interfaces: Ci} = Components;
|
|||
// Strictly follow RFC 3986 when encoding URI components.
|
||||
// Accepts a unescaped string and returns the URI encoded string for use in
|
||||
// an HTTP request.
|
||||
function percentEncode(aString)
|
||||
encodeURIComponent(aString).replace(/[!'()]/g, escape).replace(/\*/g, "%2A");
|
||||
function percentEncode(aString) {
|
||||
return encodeURIComponent(aString).replace(/[!'()]/g, escape).replace(/\*/g, "%2A");
|
||||
}
|
||||
|
||||
/*
|
||||
* aOptions can have a variety of fields:
|
||||
|
@ -86,7 +87,7 @@ function httpRequest(aUrl, aOptions) {
|
|||
if (POSTData && Array.isArray(POSTData)) {
|
||||
xhr.setRequestHeader("Content-Type",
|
||||
"application/x-www-form-urlencoded; charset=utf-8");
|
||||
POSTData = POSTData.map(function(p) p[0] + "=" + percentEncode(p[1]))
|
||||
POSTData = POSTData.map(p => p[0] + "=" + percentEncode(p[1]))
|
||||
.join("&");
|
||||
}
|
||||
|
||||
|
|
|
@ -176,5 +176,5 @@ function _setImage(aElement, aActive, aURL) {
|
|||
function _parseRGB(aColorString) {
|
||||
var rgb = aColorString.match(/^rgba?\((\d+), (\d+), (\d+)/);
|
||||
rgb.shift();
|
||||
return rgb.map(function (x) parseInt(x));
|
||||
return rgb.map(x => parseInt(x));
|
||||
}
|
||||
|
|
|
@ -280,7 +280,9 @@ Logger.prototype = {
|
|||
},
|
||||
|
||||
_parent: null,
|
||||
get parent() this._parent,
|
||||
get parent() {
|
||||
return this._parent;
|
||||
},
|
||||
set parent(parent) {
|
||||
if (this._parent == parent) {
|
||||
return;
|
||||
|
|
|
@ -111,12 +111,16 @@ function LinksStorage() {
|
|||
}
|
||||
|
||||
LinksStorage.prototype = {
|
||||
get _version() 1,
|
||||
get _version() {
|
||||
return 1;
|
||||
},
|
||||
|
||||
get _prefs() Object.freeze({
|
||||
get _prefs() {
|
||||
return Object.freeze({
|
||||
pinnedLinks: "browser.newtabpage.pinned",
|
||||
blockedLinks: "browser.newtabpage.blocked",
|
||||
}),
|
||||
});
|
||||
},
|
||||
|
||||
get _storedVersion() {
|
||||
if (this.__storedVersion === undefined) {
|
||||
|
|
|
@ -173,7 +173,7 @@ PopupNotifications.prototype = {
|
|||
getNotification: function PopupNotifications_getNotification(id, browser) {
|
||||
let n = null;
|
||||
let notifications = this._getNotificationsForBrowser(browser || this.tabbrowser.selectedBrowser);
|
||||
notifications.some(function(x) x.id == id && (n = x));
|
||||
notifications.some(x => x.id == id && (n = x));
|
||||
return n;
|
||||
},
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ this.Preferences =
|
|||
*/
|
||||
Preferences.get = function(prefName, defaultValue, valueType = Ci.nsISupportsString) {
|
||||
if (Array.isArray(prefName))
|
||||
return prefName.map(function(v) this.get(v, defaultValue), this);
|
||||
return prefName.map(v => this.get(v, defaultValue));
|
||||
|
||||
return this._get(prefName, defaultValue, valueType);
|
||||
};
|
||||
|
@ -204,7 +204,7 @@ Preferences.modified = function(prefName) { return this.isSet(prefName) },
|
|||
|
||||
Preferences.reset = function(prefName) {
|
||||
if (Array.isArray(prefName)) {
|
||||
prefName.map(function(v) this.reset(v), this);
|
||||
prefName.map(v => this.reset(v));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ Preferences.ignore = function(prefName, callback, thisObject) {
|
|||
// make it. We could index by fullBranch, but we can't index by callback
|
||||
// or thisObject, as far as I know, since the keys to JavaScript hashes
|
||||
// (a.k.a. objects) can apparently only be primitive values.
|
||||
let [observer] = observers.filter(function(v) v.prefName == fullPrefName &&
|
||||
let [observer] = observers.filter(v => v.prefName == fullPrefName &&
|
||||
v.callback == callback &&
|
||||
v.thisObject == thisObject);
|
||||
|
||||
|
|
|
@ -259,11 +259,14 @@ BinaryPropertyListReader.prototype = {
|
|||
* Checks if the given ArrayBuffer can be read as a binary property list.
|
||||
* It can be called on the prototype.
|
||||
*/
|
||||
canProcess: function BPLR_canProcess(aBuffer)
|
||||
[String.fromCharCode(c) for each (c in new Uint8Array(aBuffer, 0, 8))].
|
||||
join("") == "bplist00",
|
||||
canProcess: function BPLR_canProcess(aBuffer) {
|
||||
return [String.fromCharCode(c) for each (c in new Uint8Array(aBuffer, 0, 8))].
|
||||
join("") == "bplist00";
|
||||
},
|
||||
|
||||
get root() this._readObject(this._rootObjectIndex),
|
||||
get root() {
|
||||
return this._readObject(this._rootObjectIndex);
|
||||
},
|
||||
|
||||
_readTrailerInfo: function BPLR__readTrailer() {
|
||||
// The first 6 bytes of the 32-bytes trailer are unused
|
||||
|
@ -656,7 +659,9 @@ function XMLPropertyListReader(aDOMDoc) {
|
|||
}
|
||||
|
||||
XMLPropertyListReader.prototype = {
|
||||
get root() this._readObject(this._plistRootElement),
|
||||
get root() {
|
||||
return this._readObject(this._plistRootElement);
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert a dom element to a property list object.
|
||||
|
|
|
@ -106,7 +106,7 @@ DownloadLastDir.prototype = {
|
|||
return this.fakeContext.usePrivateBrowsing;
|
||||
},
|
||||
// compat shims
|
||||
get file() this._getLastFile(),
|
||||
get file() { return this._getLastFile(); },
|
||||
set file(val) { this.setFile(null, val); },
|
||||
cleanupPrivateFile: function () {
|
||||
gDownloadLastDirFile = null;
|
||||
|
@ -146,7 +146,7 @@ DownloadLastDir.prototype = {
|
|||
getFileAsync: function(aURI, aCallback) {
|
||||
let plainPrefFile = this._getLastFile();
|
||||
if (!aURI || !isContentPrefEnabled()) {
|
||||
Services.tm.mainThread.dispatch(function() aCallback(plainPrefFile),
|
||||
Services.tm.mainThread.dispatch(() => aCallback(plainPrefFile),
|
||||
Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ DownloadLastDir.prototype = {
|
|||
.getService(Components.interfaces.nsIContentPrefService2);
|
||||
let result = null;
|
||||
cps2.getByDomainAndName(uri, LAST_DIR_PREF, this.fakeContext, {
|
||||
handleResult: function(aResult) result = aResult,
|
||||
handleResult: aResult => result = aResult,
|
||||
handleCompletion: function(aReason) {
|
||||
let file = plainPrefFile;
|
||||
if (aReason == Components.interfaces.nsIContentPrefCallback2.COMPLETE_OK &&
|
||||
|
|
|
@ -273,7 +273,7 @@ this.DownloadUtils = {
|
|||
return [gBundle.GetStringFromName(gStr.timeUnknown), aLastSec];
|
||||
|
||||
// Try to find a cached lastSec for the given second
|
||||
aLastSec = gCachedLast.reduce(function(aResult, aItem)
|
||||
aLastSec = gCachedLast.reduce((aResult, aItem) =>
|
||||
aItem[0] == aSeconds ? aItem[1] : aResult, aLastSec);
|
||||
|
||||
// Add the current second/lastSec pair unless we have too many
|
||||
|
|
|
@ -320,7 +320,7 @@ function copySourceLocation(aDownload)
|
|||
// Check if we should initialize a callback
|
||||
if (gPerformAllCallback === null) {
|
||||
let uris = [];
|
||||
gPerformAllCallback = function(aURI) aURI ? uris.push(aURI) :
|
||||
gPerformAllCallback = aURI => aURI ? uris.push(aURI) :
|
||||
clipboard.copyString(uris.join("\n"));
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ function Startup()
|
|||
|
||||
// convert strings to those in the string bundle
|
||||
let sb = document.getElementById("downloadStrings");
|
||||
let getStr = function(string) sb.getString(string);
|
||||
let getStr = string => sb.getString(string);
|
||||
for (let [name, value] in Iterator(gStr))
|
||||
gStr[name] = typeof value == "string" ? getStr(value) : value.map(getStr);
|
||||
|
||||
|
@ -986,11 +986,11 @@ function updateStatus(aItem, aDownload) {
|
|||
}
|
||||
return sizeText;
|
||||
};
|
||||
stateSize[nsIDM.DOWNLOAD_FAILED] = function() gStr.stateFailed;
|
||||
stateSize[nsIDM.DOWNLOAD_CANCELED] = function() gStr.stateCanceled;
|
||||
stateSize[nsIDM.DOWNLOAD_BLOCKED_PARENTAL] = function() gStr.stateBlockedParentalControls;
|
||||
stateSize[nsIDM.DOWNLOAD_BLOCKED_POLICY] = function() gStr.stateBlockedPolicy;
|
||||
stateSize[nsIDM.DOWNLOAD_DIRTY] = function() gStr.stateDirty;
|
||||
stateSize[nsIDM.DOWNLOAD_FAILED] = () => gStr.stateFailed;
|
||||
stateSize[nsIDM.DOWNLOAD_CANCELED] = () => gStr.stateCanceled;
|
||||
stateSize[nsIDM.DOWNLOAD_BLOCKED_PARENTAL] = () => gStr.stateBlockedParentalControls;
|
||||
stateSize[nsIDM.DOWNLOAD_BLOCKED_POLICY] = () => gStr.stateBlockedPolicy;
|
||||
stateSize[nsIDM.DOWNLOAD_DIRTY] = () => gStr.stateDirty;
|
||||
|
||||
// Insert 1 is the download size or download state
|
||||
status = replaceInsert(gStr.doneStatus, 1, stateSize[state]());
|
||||
|
@ -1151,7 +1151,7 @@ function stepListBuilder(aNumItems) {
|
|||
if (!gStmt.executeStep()) {
|
||||
// Send a notification that we finished, but wait for clear list to update
|
||||
updateClearListButton();
|
||||
setTimeout(function() Cc["@mozilla.org/observer-service;1"].
|
||||
setTimeout(() => Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService).
|
||||
notifyObservers(window, "download-manager-ui-done", null), 0);
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ var AddonManagerInternal = {
|
|||
this.pendingProviders.delete(aProvider);
|
||||
|
||||
for (let type in this.types) {
|
||||
this.types[type].providers = this.types[type].providers.filter(function filterProvider(p) p != aProvider);
|
||||
this.types[type].providers = this.types[type].providers.filter(p => p != aProvider);
|
||||
if (this.types[type].providers.length == 0) {
|
||||
let oldType = this.types[type].type;
|
||||
delete this.types[type];
|
||||
|
@ -1696,8 +1696,7 @@ var AddonManagerInternal = {
|
|||
if (!(aType in this.startupChanges))
|
||||
return;
|
||||
|
||||
this.startupChanges[aType] = this.startupChanges[aType].filter(
|
||||
function filterItem(aItem) aItem != aID);
|
||||
this.startupChanges[aType] = this.startupChanges[aType].filter(aItem => aItem != aID);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,9 @@ var _themeIDBeingDisabled = null;
|
|||
})();
|
||||
|
||||
this.LightweightThemeManager = {
|
||||
get name() "LightweightThemeManager",
|
||||
get name() {
|
||||
return "LightweightThemeManager";
|
||||
},
|
||||
|
||||
// Themes that can be added for an application. They can't be removed, and
|
||||
// will always show up at the top of the list.
|
||||
|
@ -456,8 +458,12 @@ this.LightweightThemeManager = {
|
|||
* consumers of the AddonManager API.
|
||||
*/
|
||||
function AddonWrapper(aTheme) {
|
||||
this.__defineGetter__("id", function AddonWrapper_idGetter() aTheme.id + ID_SUFFIX);
|
||||
this.__defineGetter__("type", function AddonWrapper_typeGetter() ADDON_TYPE);
|
||||
this.__defineGetter__("id", function AddonWrapper_idGetter() {
|
||||
return aTheme.id + ID_SUFFIX;
|
||||
});
|
||||
this.__defineGetter__("type", function AddonWrapper_typeGetter() {
|
||||
return ADDON_TYPE;
|
||||
});
|
||||
this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() {
|
||||
let current = LightweightThemeManager.currentTheme;
|
||||
if (current)
|
||||
|
@ -465,7 +471,9 @@ function AddonWrapper(aTheme) {
|
|||
return false;
|
||||
});
|
||||
|
||||
this.__defineGetter__("name", function AddonWrapper_nameGetter() aTheme.name);
|
||||
this.__defineGetter__("name", function AddonWrapper_nameGetter() {
|
||||
return aTheme.name;
|
||||
});
|
||||
this.__defineGetter__("version", function AddonWrapper_versionGetter() {
|
||||
return "version" in aTheme ? aTheme.version : "";
|
||||
});
|
||||
|
@ -733,15 +741,20 @@ function _sanitizeTheme(aData, aBaseURI, aLocal) {
|
|||
return result;
|
||||
}
|
||||
|
||||
function _usedThemesExceptId(aId)
|
||||
LightweightThemeManager.usedThemes.filter(
|
||||
function usedThemesExceptId_filterID(t) "id" in t && t.id != aId);
|
||||
function _usedThemesExceptId(aId) {
|
||||
return LightweightThemeManager.usedThemes.filter(
|
||||
function usedThemesExceptId_filterID(t) {
|
||||
return "id" in t && t.id != aId;
|
||||
});
|
||||
}
|
||||
|
||||
function _version(aThemeData)
|
||||
aThemeData.version || "";
|
||||
function _version(aThemeData) {
|
||||
return aThemeData.version || "";
|
||||
}
|
||||
|
||||
function _makeURI(aURL, aBaseURI)
|
||||
Services.io.newURI(aURL, null, aBaseURI);
|
||||
function _makeURI(aURL, aBaseURI) {
|
||||
return Services.io.newURI(aURL, null, aBaseURI);
|
||||
}
|
||||
|
||||
function _updateUsedThemes(aList) {
|
||||
// Remove app-specific themes before saving them to the usedThemes pref.
|
||||
|
@ -794,7 +807,8 @@ function _prefObserver(aSubject, aTopic, aData) {
|
|||
}
|
||||
|
||||
function _persistImages(aData, aCallback) {
|
||||
function onSuccess(key) function () {
|
||||
function onSuccess(key) {
|
||||
return function () {
|
||||
let current = LightweightThemeManager.currentTheme;
|
||||
if (current && current.id == aData.id) {
|
||||
_prefs.setBoolPref("persisted." + key, true);
|
||||
|
@ -803,6 +817,7 @@ function _persistImages(aData, aCallback) {
|
|||
aCallback();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let numFilesToPersist = 0;
|
||||
for (let key in PERSIST_FILES) {
|
||||
|
|
|
@ -79,7 +79,9 @@ document.addEventListener("load", initialize, true);
|
|||
window.addEventListener("unload", shutdown, false);
|
||||
|
||||
var gPendingInitializations = 1;
|
||||
this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() gPendingInitializations > 0);
|
||||
this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() {
|
||||
return gPendingInitializations > 0;
|
||||
});
|
||||
|
||||
function initialize(event) {
|
||||
// XXXbz this listener gets _all_ load events for all nodes in the
|
||||
|
@ -830,7 +832,9 @@ var gViewController = {
|
|||
},
|
||||
|
||||
cmd_restartApp: {
|
||||
isEnabled: function cmd_restartApp_isEnabled() true,
|
||||
isEnabled: function cmd_restartApp_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_restartApp_doCommand() {
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
|
||||
createInstance(Ci.nsISupportsPRBool);
|
||||
|
@ -846,28 +850,36 @@ var gViewController = {
|
|||
},
|
||||
|
||||
cmd_enableCheckCompatibility: {
|
||||
isEnabled: function cmd_enableCheckCompatibility_isEnabled() true,
|
||||
isEnabled: function cmd_enableCheckCompatibility_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_enableCheckCompatibility_doCommand() {
|
||||
AddonManager.checkCompatibility = true;
|
||||
}
|
||||
},
|
||||
|
||||
cmd_enableUpdateSecurity: {
|
||||
isEnabled: function cmd_enableUpdateSecurity_isEnabled() true,
|
||||
isEnabled: function cmd_enableUpdateSecurity_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_enableUpdateSecurity_doCommand() {
|
||||
AddonManager.checkUpdateSecurity = true;
|
||||
}
|
||||
},
|
||||
|
||||
cmd_pluginCheck: {
|
||||
isEnabled: function cmd_pluginCheck_isEnabled() true,
|
||||
isEnabled: function cmd_pluginCheck_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_pluginCheck_doCommand() {
|
||||
openURL(Services.urlFormatter.formatURLPref("plugins.update.url"));
|
||||
}
|
||||
},
|
||||
|
||||
cmd_toggleAutoUpdateDefault: {
|
||||
isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() true,
|
||||
isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_toggleAutoUpdateDefault_doCommand() {
|
||||
if (!AddonManager.updateEnabled || !AddonManager.autoUpdateDefault) {
|
||||
// One or both of the prefs is false, i.e. the checkbox is not checked.
|
||||
|
@ -884,7 +896,9 @@ var gViewController = {
|
|||
},
|
||||
|
||||
cmd_resetAddonAutoUpdate: {
|
||||
isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() true,
|
||||
isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_resetAddonAutoUpdate_doCommand() {
|
||||
AddonManager.getAllAddons(function cmd_resetAddonAutoUpdate_getAllAddons(aAddonList) {
|
||||
for (let addon of aAddonList) {
|
||||
|
@ -905,14 +919,18 @@ var gViewController = {
|
|||
},
|
||||
|
||||
cmd_goToRecentUpdates: {
|
||||
isEnabled: function cmd_goToRecentUpdates_isEnabled() true,
|
||||
isEnabled: function cmd_goToRecentUpdates_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_goToRecentUpdates_doCommand() {
|
||||
gViewController.loadView("addons://updates/recent");
|
||||
}
|
||||
},
|
||||
|
||||
cmd_goToAvailableUpdates: {
|
||||
isEnabled: function cmd_goToAvailableUpdates_isEnabled() true,
|
||||
isEnabled: function cmd_goToAvailableUpdates_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_goToAvailableUpdates_doCommand() {
|
||||
gViewController.loadView("addons://updates/available");
|
||||
}
|
||||
|
@ -931,7 +949,9 @@ var gViewController = {
|
|||
|
||||
cmd_findAllUpdates: {
|
||||
inProgress: false,
|
||||
isEnabled: function cmd_findAllUpdates_isEnabled() !this.inProgress,
|
||||
isEnabled: function cmd_findAllUpdates_isEnabled() {
|
||||
return !this.inProgress;
|
||||
},
|
||||
doCommand: function cmd_findAllUpdates_doCommand() {
|
||||
this.inProgress = true;
|
||||
gViewController.updateCommand("cmd_findAllUpdates");
|
||||
|
@ -1234,7 +1254,9 @@ var gViewController = {
|
|||
},
|
||||
|
||||
cmd_installFromFile: {
|
||||
isEnabled: function cmd_installFromFile_isEnabled() true,
|
||||
isEnabled: function cmd_installFromFile_isEnabled() {
|
||||
return true;
|
||||
},
|
||||
doCommand: function cmd_installFromFile_doCommand() {
|
||||
const nsIFilePicker = Ci.nsIFilePicker;
|
||||
var fp = Cc["@mozilla.org/filepicker;1"]
|
||||
|
@ -2280,7 +2302,9 @@ var gDiscoverView = {
|
|||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
|
||||
getSelectedAddon: function gDiscoverView_getSelectedAddon() null
|
||||
getSelectedAddon: function gDiscoverView_getSelectedAddon() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -2311,16 +2335,15 @@ var gSearchView = {
|
|||
if (!AddonManager.isInstallEnabled("application/x-xpinstall"))
|
||||
this._filter.hidden = true;
|
||||
|
||||
var self = this;
|
||||
this._listBox.addEventListener("keydown", function listbox_onKeydown(aEvent) {
|
||||
this._listBox.addEventListener("keydown", aEvent => {
|
||||
if (aEvent.keyCode == aEvent.DOM_VK_RETURN) {
|
||||
var item = self._listBox.selectedItem;
|
||||
var item = this._listBox.selectedItem;
|
||||
if (item)
|
||||
item.showInDetailView();
|
||||
}
|
||||
}, false);
|
||||
|
||||
this._filter.addEventListener("command", function filter_onCommand() self.updateView(), false);
|
||||
this._filter.addEventListener("command", () => this.updateView(), false);
|
||||
},
|
||||
|
||||
shutdown: function gSearchView_shutdown() {
|
||||
|
|
|
@ -989,7 +989,7 @@ this.AddonRepository = {
|
|||
// Returns null if not unique tag name.
|
||||
_getUniqueDirectDescendant: function AddonRepo_getUniqueDirectDescendant(aElement, aTagName) {
|
||||
let elementsList = Array.filter(aElement.children,
|
||||
function arrayFiltering(aChild) aChild.tagName == aTagName);
|
||||
aChild => aChild.tagName == aTagName);
|
||||
return (elementsList.length == 1) ? elementsList[0] : null;
|
||||
},
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ this.AddonRepository = {
|
|||
|
||||
// Ignore add-on missing a required attribute
|
||||
let requiredAttributes = ["id", "name", "version", "type", "creator"];
|
||||
if (requiredAttributes.some(function parseAddons_attributeFilter(aAttribute) !result.addon[aAttribute]))
|
||||
if (requiredAttributes.some(aAttribute => !result.addon[aAttribute]))
|
||||
continue;
|
||||
|
||||
// Ignore add-on with a type AddonManager doesn't understand:
|
||||
|
@ -1428,7 +1428,7 @@ this.AddonRepository = {
|
|||
|
||||
let rangeNodes = aElement.querySelectorAll("version_ranges > version_range");
|
||||
compat.compatRanges = Array.map(rangeNodes, parseRangeNode.bind(this))
|
||||
.filter(function compatRangesFilter(aItem) !!aItem);
|
||||
.filter(aItem => !!aItem);
|
||||
if (compat.compatRanges.length == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ var logger = Log.repository.getLogger(LOGGER_ID);
|
|||
|
||||
function getIDHashForString(aStr) {
|
||||
// return the two-digit hexadecimal code for a byte
|
||||
function toHexString(charCode)
|
||||
("0" + charCode.toString(16)).slice(-2);
|
||||
let toHexString = charCode => ("0" + charCode.toString(16)).slice(-2);
|
||||
|
||||
let hasher = Cc["@mozilla.org/security/hash;1"].
|
||||
createInstance(Ci.nsICryptoHash);
|
||||
|
@ -49,7 +48,9 @@ function getIDHashForString(aStr) {
|
|||
}
|
||||
|
||||
var PluginProvider = {
|
||||
get name() "PluginProvider",
|
||||
get name() {
|
||||
return "PluginProvider";
|
||||
},
|
||||
|
||||
// A dictionary mapping IDs to names and descriptions
|
||||
plugins: null,
|
||||
|
@ -82,7 +83,7 @@ var PluginProvider = {
|
|||
let typeLabel = aSubject.getElementById("pluginMimeTypes"), types = [];
|
||||
for (let type of plugin.pluginMimeTypes) {
|
||||
let extras = [type.description.trim(), type.suffixes].
|
||||
filter(function(x) x).join(": ");
|
||||
filter(x => x).join(": ");
|
||||
types.push(type.type + (extras ? " (" + extras + ")" : ""));
|
||||
}
|
||||
typeLabel.textContent = types.join(",\n");
|
||||
|
@ -303,16 +304,16 @@ function PluginWrapper(aId, aName, aDescription, aTags) {
|
|||
if (/<A\s+HREF=[^>]*>/i.test(aDescription))
|
||||
homepageURL = /<A\s+HREF=["']?([^>"'\s]*)/i.exec(aDescription)[1];
|
||||
|
||||
this.__defineGetter__("id", function() aId);
|
||||
this.__defineGetter__("type", function() "plugin");
|
||||
this.__defineGetter__("name", function() aName);
|
||||
this.__defineGetter__("creator", function() null);
|
||||
this.__defineGetter__("description", function() safedesc);
|
||||
this.__defineGetter__("version", function() aTags[0].version);
|
||||
this.__defineGetter__("homepageURL", function() homepageURL);
|
||||
this.__defineGetter__("id", () => aId);
|
||||
this.__defineGetter__("type", () => "plugin");
|
||||
this.__defineGetter__("name", () => aName);
|
||||
this.__defineGetter__("creator", () => null);
|
||||
this.__defineGetter__("description", () => safedesc);
|
||||
this.__defineGetter__("version", () => aTags[0].version);
|
||||
this.__defineGetter__("homepageURL", () => homepageURL);
|
||||
|
||||
this.__defineGetter__("isActive", function() !aTags[0].blocklisted && !aTags[0].disabled);
|
||||
this.__defineGetter__("appDisabled", function() aTags[0].blocklisted);
|
||||
this.__defineGetter__("isActive", () => !aTags[0].blocklisted && !aTags[0].disabled);
|
||||
this.__defineGetter__("appDisabled", () => aTags[0].blocklisted);
|
||||
|
||||
this.__defineGetter__("userDisabled", function() {
|
||||
if (aTags[0].disabled)
|
||||
|
|
|
@ -2173,7 +2173,9 @@ this.XPIStates = {
|
|||
};
|
||||
|
||||
this.XPIProvider = {
|
||||
get name() "XPIProvider",
|
||||
get name() {
|
||||
return "XPIProvider";
|
||||
},
|
||||
|
||||
// An array of known install locations
|
||||
installLocations: null,
|
||||
|
@ -4591,8 +4593,7 @@ this.XPIProvider = {
|
|||
|
||||
function getHashStringForCrypto(aCrypto) {
|
||||
// return the two-digit hexadecimal code for a byte
|
||||
function toHexString(charCode)
|
||||
("0" + charCode.toString(16)).slice(-2);
|
||||
let toHexString = charCode => ("0" + charCode.toString(16)).slice(-2);
|
||||
|
||||
// convert the binary hash data to a hex string.
|
||||
let binary = aCrypto.finish(false);
|
||||
|
@ -5851,18 +5852,26 @@ function AddonInstallWrapper(aInstall) {
|
|||
|
||||
["name", "version", "icons", "releaseNotesURI", "file", "state", "error",
|
||||
"progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
|
||||
this.__defineGetter__(aProp, function AIW_propertyGetter() aInstall[aProp]);
|
||||
this.__defineGetter__(aProp, function AIW_propertyGetter() {
|
||||
return aInstall[aProp];
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.__defineGetter__("type", () => getExternalType(aInstall.type));
|
||||
|
||||
this.__defineGetter__("iconURL", function AIW_iconURL() aInstall.icons[32]);
|
||||
this.__defineGetter__("iconURL", function AIW_iconURL() {
|
||||
return aInstall.icons[32];
|
||||
});
|
||||
|
||||
this.__defineGetter__("existingAddon", function AIW_existingAddonGetter() {
|
||||
return createWrapper(aInstall.existingAddon);
|
||||
});
|
||||
this.__defineGetter__("addon", function AIW_addonGetter() createWrapper(aInstall.addon));
|
||||
this.__defineGetter__("sourceURI", function AIW_sourceURIGetter() aInstall.sourceURI);
|
||||
this.__defineGetter__("addon", function AIW_addonGetter() {
|
||||
return createWrapper(aInstall.addon);
|
||||
});
|
||||
this.__defineGetter__("sourceURI", function AIW_sourceURIGetter() {
|
||||
return aInstall.sourceURI;
|
||||
});
|
||||
|
||||
this.__defineGetter__("linkedInstalls", function AIW_linkedInstallsGetter() {
|
||||
if (!aInstall.linkedInstalls)
|
||||
|
@ -6443,7 +6452,9 @@ function AddonWrapper(aAddon) {
|
|||
"softDisabled", "skinnable", "size", "foreignInstall", "hasBinaryComponents",
|
||||
"strictCompatibility", "compatibilityOverrides", "updateURL",
|
||||
"getDataDirectory", "multiprocessCompatible", "signedState"].forEach(function(aProp) {
|
||||
this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() aAddon[aProp]);
|
||||
this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() {
|
||||
return aAddon[aProp];
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.__defineGetter__("type", () => getExternalType(aAddon.type));
|
||||
|
@ -6465,7 +6476,9 @@ function AddonWrapper(aAddon) {
|
|||
});
|
||||
|
||||
["installDate", "updateDate"].forEach(function(aProp) {
|
||||
this.__defineGetter__(aProp, function AddonWrapper_datePropertyGetter() new Date(aAddon[aProp]));
|
||||
this.__defineGetter__(aProp, function AddonWrapper_datePropertyGetter() {
|
||||
return new Date(aAddon[aProp]);
|
||||
});
|
||||
}, this);
|
||||
|
||||
["sourceURI", "releaseNotesURI"].forEach(function(aProp) {
|
||||
|
|
|
@ -39,7 +39,7 @@ function dir_entries(baseDir, subpath, ext) {
|
|||
while (enumerator.hasMoreElements()) {
|
||||
var file = enumerator.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (file.isDirectory()) {
|
||||
entries = entries.concat(dir_entries(dir, file.leafName, ext).map(function(p) subpath + "/" + p));
|
||||
entries = entries.concat(dir_entries(dir, file.leafName, ext).map(p => subpath + "/" + p));
|
||||
} else if (endsWith(file.leafName, ext)) {
|
||||
entries.push(subpath + "/" + file.leafName);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче