Bug 1207498 - Part 1: Remove use of expression closure from toolkit/components/, except tests. r=Gijs

--HG--
extra : commitid : 5yrVqfOUmEG
extra : rebase_source : e2ec30261bd76c1966b0e61fd7e08c2924f270b0
This commit is contained in:
Tooru Fujisawa 2015-09-24 20:32:23 +09:00
parent 3c752ad87d
commit accd89d4fd
32 changed files with 310 additions and 182 deletions

View File

@ -829,8 +829,8 @@ ContentPrefService2.prototype = {
cps._genericObservers = [];
let tables = ["prefs", "groups", "settings"];
let stmts = tables.map(function (t) this._stmt(`DELETE FROM ${t}`), this);
this._execStmts(stmts, { onDone: function () callback() });
let stmts = tables.map(t => this._stmt(`DELETE FROM ${t}`));
this._execStmts(stmts, { onDone: () => callback() });
},
QueryInterface: function CPS2_QueryInterface(iid) {
@ -839,7 +839,7 @@ ContentPrefService2.prototype = {
Ci.nsIObserver,
Ci.nsISupports,
];
if (supportedIIDs.some(function (i) iid.equals(i)))
if (supportedIIDs.some(i => iid.equals(i)))
return this;
if (iid.equals(Ci.nsIContentPrefService))
return this._cps;

View File

@ -59,7 +59,7 @@ ContentPrefService.prototype = {
Ci.nsIContentPrefService,
Ci.nsISupports,
];
if (supportedIIDs.some(function (i) iid.equals(i)))
if (supportedIIDs.some(i => iid.equals(i)))
return this;
if (iid.equals(Ci.nsIContentPrefService2)) {
if (!this._contentPrefService2) {

View File

@ -647,19 +647,19 @@ extApplication.prototype = {
get console() {
let console = new Console();
this.__defineGetter__("console", function () console);
this.__defineGetter__("console", () => console);
return this.console;
},
get storage() {
let storage = new SessionStorage();
this.__defineGetter__("storage", function () storage);
this.__defineGetter__("storage", () => storage);
return this.storage;
},
get prefs() {
let prefs = new PreferenceBranch("");
this.__defineGetter__("prefs", function () prefs);
this.__defineGetter__("prefs", () => prefs);
return this.prefs;
},
@ -687,7 +687,7 @@ extApplication.prototype = {
}
let events = new Events(registerCheck);
this.__defineGetter__("events", function () events);
this.__defineGetter__("events", () => events);
return this.events;
},

View File

@ -769,8 +769,8 @@ this.Download.prototype = {
if (!this._promiseCanceled) {
// Start a new cancellation request.
let deferCanceled = Promise.defer();
this._currentAttempt.then(function () deferCanceled.resolve(),
function () deferCanceled.resolve());
this._currentAttempt.then(() => deferCanceled.resolve(),
() => deferCanceled.resolve());
this._promiseCanceled = deferCanceled.promise;
// The download can already be restarted.

View File

@ -159,7 +159,9 @@ this.DownloadIntegration = {
/**
* Gets and sets test mode
*/
get testMode() this._testMode,
get testMode() {
return this._testMode;
},
set testMode(mode) {
this._downloadsDirectory = null;
return (this._testMode = mode);

View File

@ -51,15 +51,21 @@ this.Downloads = {
/**
* Work on downloads that were not started from a private browsing window.
*/
get PUBLIC() "{Downloads.PUBLIC}",
get PUBLIC() {
return "{Downloads.PUBLIC}";
},
/**
* Work on downloads that were started from a private browsing window.
*/
get PRIVATE() "{Downloads.PRIVATE}",
get PRIVATE() {
return "{Downloads.PRIVATE}";
},
/**
* Work on both Downloads.PRIVATE and Downloads.PUBLIC downloads.
*/
get ALL() "{Downloads.ALL}",
get ALL() {
return "{Downloads.ALL}";
},
/**
* Creates a new Download object.

View File

@ -1247,8 +1247,12 @@ var DirectoryIterator = function DirectoryIterator(path, options) {
this._isClosed = false;
};
DirectoryIterator.prototype = {
iterator: function () this,
__iterator__: function () this,
iterator: function () {
return this;
},
__iterator__: function () {
return this;
},
// Once close() is called, _itmsg should reject with a
// StopIteration. However, we don't want to create the promise until

View File

@ -955,7 +955,7 @@ var LoginManagerContent = {
// password if we find a matching login.
var username = usernameField.value.toLowerCase();
let matchingLogins = logins.filter(function(l)
let matchingLogins = logins.filter(l =>
l.username.toLowerCase() == username);
if (matchingLogins.length == 0) {
log("Password not filled. None of the stored logins match the username already present.");
@ -982,9 +982,9 @@ var LoginManagerContent = {
// (user+pass or pass-only) when there's exactly one that matches.
let matchingLogins;
if (usernameField)
matchingLogins = logins.filter(function(l) l.username);
matchingLogins = logins.filter(l => l.username);
else
matchingLogins = logins.filter(function(l) !l.username);
matchingLogins = logins.filter(l => !l.username);
if (matchingLogins.length != 1) {
log("Multiple logins for form, so not filling any.");

View File

@ -281,7 +281,10 @@ LoginStore.prototype = {
/**
* Called when the data changed, this triggers asynchronous serialization.
*/
saveSoon: function () this._saver.arm(),
saveSoon: function ()
{
return this._saver.arm();
},
/**
* DeferredTask that handles the save operation.

View File

@ -313,7 +313,7 @@ function SignonMatchesFilter(aSignon, aFilterValue) {
function FilterPasswords(aFilterValue, view) {
aFilterValue = aFilterValue.toLowerCase();
return signons.filter(function (s) SignonMatchesFilter(s, aFilterValue));
return signons.filter(s => SignonMatchesFilter(s, aFilterValue));
}
function SignonSaveState() {

View File

@ -298,7 +298,7 @@ LoginManager.prototype = {
var logins = this.findLogins({}, login.hostname, login.formSubmitURL,
login.httpRealm);
if (logins.some(function(l) login.matches(l, true)))
if (logins.some(l => login.matches(l, true)))
throw new Error("This login already exists.");
log("Adding login");

View File

@ -1333,7 +1333,7 @@ LoginManagerPrompter.prototype = {
promptToChangePasswordWithUsernames : function (logins, count, aNewLogin) {
const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
var usernames = logins.map(function (l) l.username);
var usernames = logins.map(l => l.username);
var dialogText = this._getLocalizedString("userSelectText");
var dialogTitle = this._getLocalizedString("passwordChangeTitle");
var selectedIndex = { value: null };

View File

@ -501,7 +501,7 @@ LoginManagerStorage_mozStorage.prototype = {
// Build query
let query = "SELECT * FROM moz_logins";
if (conditions.length) {
conditions = conditions.map(function(c) "(" + c + ")");
conditions = conditions.map(c => "(" + c + ")");
query += " WHERE " + conditions.join(" AND ");
}
@ -713,7 +713,7 @@ LoginManagerStorage_mozStorage.prototype = {
let query = "SELECT COUNT(1) AS numLogins FROM moz_logins";
if (conditions.length) {
conditions = conditions.map(function(c) "(" + c + ")");
conditions = conditions.map(c => "(" + c + ")");
query += " WHERE " + conditions.join(" AND ");
}

View File

@ -91,7 +91,9 @@ this.PlacesBackups = {
* 3: contents hash
* 4: file extension
*/
get filenamesRegex() filenamesRegex,
get filenamesRegex() {
return filenamesRegex;
},
get folder() {
Deprecated.warning(
@ -133,7 +135,9 @@ this.PlacesBackups = {
}.bind(this));
},
get profileRelativeFolderPath() "bookmarkbackups",
get profileRelativeFolderPath() {
return "bookmarkbackups";
},
/**
* Cache current backups in a sorted (by date DESC) array.

View File

@ -188,8 +188,9 @@ this.PlacesDBUtils = {
* @param [optional] aTasks
* Tasks object to execute.
*/
_checkIntegritySkipReindex: function PDBU__checkIntegritySkipReindex(aTasks)
this.checkIntegrity(aTasks, true),
_checkIntegritySkipReindex: function PDBU__checkIntegritySkipReindex(aTasks) {
return this.checkIntegrity(aTasks, true);
},
/**
* Checks integrity and tries to fix the database through a reindex.
@ -277,7 +278,7 @@ this.PlacesDBUtils = {
PlacesDBUtils._executeTasks(tasks);
}
});
stmts.forEach(function (aStmt) aStmt.finalize());
stmts.forEach(aStmt => aStmt.finalize());
},
_getBoundCoherenceStatements: function PDBU__getBoundCoherenceStatements()
@ -1120,7 +1121,10 @@ Tasks.prototype = {
*
* @return next task or undefined if no task is left.
*/
pop: function T_pop() this._list.shift(),
pop: function T_pop()
{
return this._list.shift();
},
/**
* Removes all tasks.
@ -1133,7 +1137,10 @@ Tasks.prototype = {
/**
* Returns array of tasks ordered from the next to be run to the latest.
*/
get list() this._list.slice(0, this._list.length),
get list()
{
return this._list.slice(0, this._list.length);
},
/**
* Adds a message to the log.
@ -1149,5 +1156,8 @@ Tasks.prototype = {
/**
* Returns array of log messages ordered from oldest to newest.
*/
get messages() this._log.slice(0, this._log.length),
get messages()
{
return this._log.slice(0, this._log.length);
},
}

View File

@ -196,7 +196,9 @@ TransactionsHistory.__proto__ = {
// The index of the first undo entry (if any) - See the documentation
// at the top of this file.
_undoPosition: 0,
get undoPosition() this._undoPosition,
get undoPosition() {
return this._undoPosition;
},
// Handy shortcuts
get topUndoEntry() {

View File

@ -71,8 +71,12 @@ function QI_node(aNode, aIID) {
}
return result;
}
function asContainer(aNode) QI_node(aNode, Ci.nsINavHistoryContainerResultNode);
function asQuery(aNode) QI_node(aNode, Ci.nsINavHistoryQueryResultNode);
function asContainer(aNode) {
return QI_node(aNode, Ci.nsINavHistoryContainerResultNode);
}
function asQuery(aNode) {
return QI_node(aNode, Ci.nsINavHistoryQueryResultNode);
}
/**
* Sends a bookmarks notification through the given observers.
@ -241,8 +245,8 @@ this.PlacesUtils = {
TOPIC_BOOKMARKS_RESTORE_SUCCESS: "bookmarks-restore-success",
TOPIC_BOOKMARKS_RESTORE_FAILED: "bookmarks-restore-failed",
asContainer: function(aNode) asContainer(aNode),
asQuery: function(aNode) asQuery(aNode),
asContainer: aNode => asContainer(aNode),
asQuery: aNode => asQuery(aNode),
endl: NEWLINE,
@ -2539,45 +2543,61 @@ function TransactionItemCache()
}
TransactionItemCache.prototype = {
set id(v)
this._id = (parseInt(v) > 0 ? v : null),
get id()
this._id || -1,
set parentId(v)
this._parentId = (parseInt(v) > 0 ? v : null),
get parentId()
this._parentId || -1,
set id(v) {
this._id = (parseInt(v) > 0 ? v : null);
},
get id() {
return this._id || -1;
},
set parentId(v) {
this._parentId = (parseInt(v) > 0 ? v : null);
},
get parentId() {
return this._parentId || -1;
},
keyword: null,
title: null,
dateAdded: null,
lastModified: null,
postData: null,
itemType: null,
set uri(v)
this._uri = (v instanceof Ci.nsIURI ? v.clone() : null),
get uri()
this._uri || null,
set feedURI(v)
this._feedURI = (v instanceof Ci.nsIURI ? v.clone() : null),
get feedURI()
this._feedURI || null,
set siteURI(v)
this._siteURI = (v instanceof Ci.nsIURI ? v.clone() : null),
get siteURI()
this._siteURI || null,
set index(v)
this._index = (parseInt(v) >= 0 ? v : null),
set uri(v) {
this._uri = (v instanceof Ci.nsIURI ? v.clone() : null);
},
get uri() {
return this._uri || null;
},
set feedURI(v) {
this._feedURI = (v instanceof Ci.nsIURI ? v.clone() : null);
},
get feedURI() {
return this._feedURI || null;
},
set siteURI(v) {
this._siteURI = (v instanceof Ci.nsIURI ? v.clone() : null);
},
get siteURI() {
return this._siteURI || null;
},
set index(v) {
this._index = (parseInt(v) >= 0 ? v : null);
},
// Index can be 0.
get index()
this._index != null ? this._index : PlacesUtils.bookmarks.DEFAULT_INDEX,
set annotations(v)
this._annotations = Array.isArray(v) ? Cu.cloneInto(v, {}) : null,
get annotations()
this._annotations || null,
set tags(v)
this._tags = (v && Array.isArray(v) ? Array.slice(v) : null),
get tags()
this._tags || null,
get index() {
return this._index != null ? this._index : PlacesUtils.bookmarks.DEFAULT_INDEX;
},
set annotations(v) {
this._annotations = Array.isArray(v) ? Cu.cloneInto(v, {}) : null;
},
get annotations() {
return this._annotations || null;
},
set tags(v) {
this._tags = (v && Array.isArray(v) ? Array.slice(v) : null);
},
get tags() {
return this._tags || null;
},
};
@ -2592,15 +2612,23 @@ function BaseTransaction()
BaseTransaction.prototype = {
name: null,
set childTransactions(v)
this._childTransactions = (Array.isArray(v) ? Array.slice(v) : null),
get childTransactions()
this._childTransactions || null,
set childTransactions(v) {
this._childTransactions = (Array.isArray(v) ? Array.slice(v) : null);
},
get childTransactions() {
return this._childTransactions || null;
},
doTransaction: function BTXN_doTransaction() {},
redoTransaction: function BTXN_redoTransaction() this.doTransaction(),
redoTransaction: function BTXN_redoTransaction() {
return this.doTransaction();
},
undoTransaction: function BTXN_undoTransaction() {},
merge: function BTXN_merge() false,
get isTransient() false,
merge: function BTXN_merge() {
return false;
},
get isTransient() {
return false;
},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsITransaction
]),

View File

@ -506,8 +506,9 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => {
* The text to unescape and modify.
* @return the modified spec.
*/
function fixupSearchText(spec)
textURIService.unEscapeURIForUI("UTF-8", stripPrefix(spec));
function fixupSearchText(spec) {
return textURIService.unEscapeURIForUI("UTF-8", stripPrefix(spec));
}
/**
* Generates the tokens used in searching from a given string.
@ -519,8 +520,9 @@ function fixupSearchText(spec)
* empty string. We don't want that, as it'll break our logic, so return
* an empty array then.
*/
function getUnfilteredSearchTokens(searchString)
searchString.length ? searchString.split(REGEXP_SPACES) : [];
function getUnfilteredSearchTokens(searchString) {
return searchString.length ? searchString.split(REGEXP_SPACES) : [];
}
/**
* Strip prefixes from the URI that we don't care about for searching.
@ -1572,18 +1574,20 @@ Search.prototype = {
* @return an array consisting of the correctly optimized query to search the
* database with and an object containing the params to bound.
*/
get _switchToTabQuery() [
SQL_SWITCHTAB_QUERY,
{
query_type: QUERYTYPE_FILTERED,
matchBehavior: this._matchBehavior,
searchBehavior: this._behavior,
// We only want to search the tokens that we are left with - not the
// original search string.
searchString: this._searchTokens.join(" "),
maxResults: Prefs.maxRichResults
}
],
get _switchToTabQuery() {
return [
SQL_SWITCHTAB_QUERY,
{
query_type: QUERYTYPE_FILTERED,
matchBehavior: this._matchBehavior,
searchBehavior: this._behavior,
// We only want to search the tokens that we are left with - not the
// original search string.
searchString: this._searchTokens.join(" "),
maxResults: Prefs.maxRichResults
}
];
},
/**
* Obtains the query to search for adaptive results.
@ -1591,16 +1595,18 @@ Search.prototype = {
* @return an array consisting of the correctly optimized query to search the
* database with and an object containing the params to bound.
*/
get _adaptiveQuery() [
SQL_ADAPTIVE_QUERY,
{
parent: PlacesUtils.tagsFolderId,
search_string: this._searchString,
query_type: QUERYTYPE_FILTERED,
matchBehavior: this._matchBehavior,
searchBehavior: this._behavior
}
],
get _adaptiveQuery() {
return [
SQL_ADAPTIVE_QUERY,
{
parent: PlacesUtils.tagsFolderId,
search_string: this._searchString,
query_type: QUERYTYPE_FILTERED,
matchBehavior: this._matchBehavior,
searchBehavior: this._behavior
}
];
},
/**
* Whether we should try to autoFill.

View File

@ -453,7 +453,9 @@ function Livemark(aLivemarkInfo)
}
Livemark.prototype = {
get status() this._status,
get status() {
return this._status;
},
set status(val) {
if (this._status != val) {
this._status = val;
@ -553,7 +555,9 @@ Livemark.prototype = {
this.updateChildren(aForceUpdate);
},
get children() this._children,
get children() {
return this._children;
},
set children(val) {
this._children = val;
@ -591,23 +595,48 @@ Livemark.prototype = {
// The QueryInterface is needed cause aContainerNode is a jsval.
// This is required to avoid issues with scriptable wrappers that would
// not allow the view to correctly set expandos.
get parent()
aContainerNode.QueryInterface(Ci.nsINavHistoryContainerResultNode),
get parentResult() this.parent.parentResult,
get uri() localChild.uri.spec,
get type() Ci.nsINavHistoryResultNode.RESULT_TYPE_URI,
get title() localChild.title,
get accessCount()
Number(livemark._isURIVisited(NetUtil.newURI(this.uri))),
get time() 0,
get icon() "",
get indentLevel() this.parent.indentLevel + 1,
get bookmarkIndex() -1,
get itemId() -1,
get dateAdded() now,
get lastModified() now,
get tags()
PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(this.uri)).join(", "),
get parent() {
return aContainerNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
},
get parentResult() {
return this.parent.parentResult;
},
get uri() {
return localChild.uri.spec;
},
get type() {
return Ci.nsINavHistoryResultNode.RESULT_TYPE_URI;
},
get title() {
return localChild.title;
},
get accessCount() {
return Number(livemark._isURIVisited(NetUtil.newURI(this.uri)));
},
get time() {
return 0;
},
get icon() {
return "";
},
get indentLevel() {
return this.parent.indentLevel + 1;
},
get bookmarkIndex() {
return -1;
},
get itemId() {
return -1;
},
get dateAdded() {
return now;
},
get lastModified() {
return now;
},
get tags() {
return PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(this.uri)).join(", ");
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryResultNode])
};
nodes.push(node);

View File

@ -721,8 +721,9 @@ nsPlacesAutoComplete.prototype = {
//////////////////////////////////////////////////////////////////////////////
//// nsPlacesAutoComplete
get _databaseInitialized()
Object.getOwnPropertyDescriptor(this, "_db").value !== undefined,
get _databaseInitialized() {
return Object.getOwnPropertyDescriptor(this, "_db").value !== undefined;
},
/**
* Generates the tokens used in searching from a given string.

View File

@ -721,7 +721,9 @@ nsPlacesExpiration.prototype = {
}
return aNewStatus;
},
get status() this._status,
get status() {
return this._status;
},
_isIdleObserver: false,
_expireOnIdle: false,
@ -746,7 +748,9 @@ nsPlacesExpiration.prototype = {
this._expireOnIdle = aExpireOnIdle;
return this._expireOnIdle;
},
get expireOnIdle() this._expireOnIdle,
get expireOnIdle() {
return this._expireOnIdle;
},
_loadPrefs: function PEX__loadPrefs() {
// Get the user's limit, if it was set.

View File

@ -522,7 +522,9 @@ TagAutoCompleteResult.prototype = {
return this._results.length;
},
get typeAheadResult() false,
get typeAheadResult() {
return false;
},
/**
* Get the value of the result at the given index

View File

@ -141,7 +141,7 @@ CommonDialog.prototype = {
// set the icon
let icon = this.ui.infoIcon;
if (icon)
this.iconClass.forEach(function(el,idx,arr) icon.classList.add(el));
this.iconClass.forEach((el,idx,arr) => icon.classList.add(el));
// set default result to cancelled
this.args.ok = false;

View File

@ -56,7 +56,9 @@ var AutoCompleteE10SView = {
getColumnProperties: function(column) { return ""; },
// nsIAutoCompleteController
get matchCount() this.rowCount,
get matchCount() {
return this.rowCount;
},
handleEnter: function(aIsPopupSelection) {
AutoCompleteE10S.handleEnter(aIsPopupSelection);

View File

@ -601,7 +601,7 @@ function dbClose(aShutdown) {
dbStmts = new Map();
let closed = false;
_dbConnection.asyncClose(function () closed = true);
_dbConnection.asyncClose(() => closed = true);
if (!aShutdown) {
let thread = Services.tm.currentThread;
@ -773,7 +773,9 @@ function expireOldEntriesVacuum(aExpireTime, aBeginningCount) {
}
this.FormHistory = {
get enabled() Prefs.enabled,
get enabled() {
return Prefs.enabled;
},
search : function formHistorySearch(aSelectTerms, aSearchData, aCallbacks) {
// if no terms selected, select everything

View File

@ -242,7 +242,7 @@ FormAutoComplete.prototype = {
let entry = entries[i];
// Remove results that do not contain the token
// XXX bug 394604 -- .toLowerCase can be wrong for some intl chars
if(searchTokens.some(function (tok) entry.textLowerCase.indexOf(tok) < 0))
if(searchTokens.some(tok => entry.textLowerCase.indexOf(tok) < 0))
continue;
this._calculateScore(entry, searchString, searchTokens);
this.log("Reusing autocomplete entry '" + entry.text +

View File

@ -1013,8 +1013,9 @@ function sanitizeName(aName) {
* @param prefName
* The name of the pref.
**/
function getMozParamPref(prefName)
Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "param." + prefName);
function getMozParamPref(prefName) {
return Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "param." + prefName);
}
/**
* Notifies watchers of SEARCH_ENGINE_TOPIC about changes to an engine or to
@ -1241,8 +1242,9 @@ EngineURL.prototype = {
return queryParam ? queryParam.name : "";
},
_hasRelation: function SRC_EURL__hasRelation(aRel)
this.rels.some(function(e) e == aRel.toLowerCase()),
_hasRelation: function SRC_EURL__hasRelation(aRel) {
return this.rels.some(e => e == aRel.toLowerCase());
},
_initWithJSON: function SRC_EURL__initWithJSON(aJson, aEngine) {
if (!aJson.params)
@ -1285,8 +1287,9 @@ EngineURL.prototype = {
if (this.method != "GET")
json.method = this.method;
function collapseMozParams(aParam)
this.mozparams[aParam.name] || aParam;
function collapseMozParams(aParam) {
return this.mozparams[aParam.name] || aParam;
}
json.params = this.params.map(collapseMozParams, this);
return json;
@ -3194,10 +3197,12 @@ SearchService.prototype = {
cache.directories[aDir.path].lastModifiedTime != aDir.lastModifiedTime);
}
function notInCachePath(aPathToLoad)
cachePaths.indexOf(aPathToLoad.path) == -1;
function notInCacheVisibleEngines(aEngineName)
cache.visibleDefaultEngines.indexOf(aEngineName) == -1;
function notInCachePath(aPathToLoad) {
return cachePaths.indexOf(aPathToLoad.path) == -1;
}
function notInCacheVisibleEngines(aEngineName) {
return cache.visibleDefaultEngines.indexOf(aEngineName) == -1;
}
let buildID = Services.appinfo.platformBuildID;
let cachePaths = [path for (path in cache.directories)];
@ -3316,10 +3321,12 @@ SearchService.prototype = {
});
}
function notInCachePath(aPathToLoad)
cachePaths.indexOf(aPathToLoad.path) == -1;
function notInCacheVisibleEngines(aEngineName)
cache.visibleDefaultEngines.indexOf(aEngineName) == -1;
function notInCachePath(aPathToLoad) {
return cachePaths.indexOf(aPathToLoad.path) == -1;
}
function notInCacheVisibleEngines(aEngineName) {
return cache.visibleDefaultEngines.indexOf(aEngineName) == -1;
}
let buildID = Services.appinfo.platformBuildID;
let cachePaths = [path for (path in cache.directories)];
@ -3748,7 +3755,7 @@ SearchService.prototype = {
_parseListTxt: function SRCH_SVC_parseListTxt(list, jarPackaging,
chromeFiles, uris) {
let names = list.split("\n").filter(function (n) !!n);
let names = list.split("\n").filter(n => !!n);
// This maps the names of our built-in engines to a boolean
// indicating whether it should be hidden by default.
let jarNames = new Map();
@ -4913,8 +4920,10 @@ var engineMetadataService = {
/**
* Flush any waiting write.
*/
finalize: function () this._lazyWriter ? this._lazyWriter.finalize()
: Promise.resolve(),
finalize: function () {
return this._lazyWriter ? this._lazyWriter.finalize()
: Promise.resolve();
},
/**
* Commit changes to disk, asynchronously.

View File

@ -28,7 +28,9 @@ AbstractPort.prototype = {
return "MessagePort(portType='" + this._portType + "', portId="
+ this._portid + (this._closed ? ", closed=true" : "") + ")";
},
_JSONParse: function fw_AbstractPort_JSONParse(data) JSON.parse(data),
_JSONParse: function fw_AbstractPort_JSONParse(data) {
return JSON.parse(data);
},
_postControlMessage: function fw_AbstractPort_postControlMessage(topic, data) {
let postData = {

View File

@ -34,7 +34,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "etld",
// Internal helper methods and state
var SocialServiceInternal = {
get enabled() this.providerArray.length > 0,
get enabled() {
return this.providerArray.length > 0;
},
get providerArray() {
return [p for ([, p] of Iterator(this.providers))];
@ -122,7 +124,7 @@ var SocialServiceInternal = {
// all enabled providers get sorted even with frecency zero.
let providerList = SocialServiceInternal.providerArray;
// reverse sort
aCallback(providerList.sort(function(a, b) b.frecency - a.frecency));
aCallback(providerList.sort((a, b) => b.frecency - a.frecency));
}
});
} finally {

View File

@ -115,17 +115,23 @@ this.PageThumbs = {
/**
* The scheme to use for thumbnail urls.
*/
get scheme() "moz-page-thumb",
get scheme() {
return "moz-page-thumb";
},
/**
* The static host to use for thumbnail urls.
*/
get staticHost() "thumbnail",
get staticHost() {
return "thumbnail";
},
/**
* The thumbnails' image type.
*/
get contentType() "image/png",
get contentType() {
return "image/png";
},
init: function PageThumbs_init() {
if (!this._initialized) {

View File

@ -40,12 +40,16 @@ Protocol.prototype = {
/**
* The scheme used by this protocol.
*/
get scheme() PageThumbs.scheme,
get scheme() {
return PageThumbs.scheme;
},
/**
* The default port for this protocol (we don't support ports).
*/
get defaultPort() -1,
get defaultPort() {
return -1;
},
/**
* The flags specific to this protocol implementation.
@ -92,7 +96,7 @@ Protocol.prototype = {
* Decides whether to allow a blacklisted port.
* @return Always false, we'll never allow ports.
*/
allowPort: function () false,
allowPort: () => false,
classID: Components.ID("{5a4ae9b5-f475-48ae-9dce-0b4c1d347884}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])

View File

@ -87,9 +87,9 @@ nsURLFormatterService.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIURLFormatter]),
_defaults: {
LOCALE: function() Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry).
getSelectedLocale('global'),
LOCALE: () => Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry).
getSelectedLocale('global'),
REGION: function() {
try {
// When the geoip lookup failed to identify the region, we fallback to
@ -99,27 +99,27 @@ nsURLFormatterService.prototype = {
return "ZZ";
}
},
VENDOR: function() this.appInfo.vendor,
NAME: function() this.appInfo.name,
ID: function() this.appInfo.ID,
VERSION: function() this.appInfo.version,
APPBUILDID: function() this.appInfo.appBuildID,
PLATFORMVERSION: function() this.appInfo.platformVersion,
PLATFORMBUILDID: function() this.appInfo.platformBuildID,
APP: function() this.appInfo.name.toLowerCase().replace(/ /, ""),
OS: function() this.appInfo.OS,
XPCOMABI: function() this.ABI,
BUILD_TARGET: function() this.appInfo.OS + "_" + this.ABI,
OS_VERSION: function() this.OSVersion,
CHANNEL: function() UpdateUtils.UpdateChannel,
MOZILLA_API_KEY: function() "@MOZ_MOZILLA_API_KEY@",
GOOGLE_API_KEY: function() "@MOZ_GOOGLE_API_KEY@",
GOOGLE_OAUTH_API_CLIENTID:function() "@MOZ_GOOGLE_OAUTH_API_CLIENTID@",
GOOGLE_OAUTH_API_KEY: function() "@MOZ_GOOGLE_OAUTH_API_KEY@",
BING_API_CLIENTID:function() "@MOZ_BING_API_CLIENTID@",
BING_API_KEY: function() "@MOZ_BING_API_KEY@",
DISTRIBUTION: function() this.distribution.id,
DISTRIBUTION_VERSION: function() this.distribution.version
VENDOR: function() { return this.appInfo.vendor; },
NAME: function() { return this.appInfo.name; },
ID: function() { return this.appInfo.ID; },
VERSION: function() { return this.appInfo.version; },
APPBUILDID: function() { return this.appInfo.appBuildID; },
PLATFORMVERSION: function() { return this.appInfo.platformVersion; },
PLATFORMBUILDID: function() { return this.appInfo.platformBuildID; },
APP: function() { return this.appInfo.name.toLowerCase().replace(/ /, ""); },
OS: function() { return this.appInfo.OS; },
XPCOMABI: function() { return this.ABI; },
BUILD_TARGET: function() { return this.appInfo.OS + "_" + this.ABI; },
OS_VERSION: function() { return this.OSVersion; },
CHANNEL: () => UpdateUtils.UpdateChannel,
MOZILLA_API_KEY: () => "@MOZ_MOZILLA_API_KEY@",
GOOGLE_API_KEY: () => "@MOZ_GOOGLE_API_KEY@",
GOOGLE_OAUTH_API_CLIENTID:() => "@MOZ_GOOGLE_OAUTH_API_CLIENTID@",
GOOGLE_OAUTH_API_KEY: () => "@MOZ_GOOGLE_OAUTH_API_KEY@",
BING_API_CLIENTID:() => "@MOZ_BING_API_CLIENTID@",
BING_API_KEY: () => "@MOZ_BING_API_KEY@",
DISTRIBUTION: function() { return this.distribution.id; },
DISTRIBUTION_VERSION: function() { return this.distribution.version; }
},
formatURL: function uf_formatURL(aFormat) {