Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1325464 - Enable object-shorthand rule and run 'mach eslint --fix…
Browse files Browse the repository at this point in the history
…' with the rule enabled. r=MattN

MozReview-Commit-ID: 8WoGr8i6oCR
  • Loading branch information
msujaws committed Dec 29, 2016
1 parent e7023a7 commit 49079dd
Show file tree
Hide file tree
Showing 824 changed files with 7,775 additions and 7,791 deletions.
28 changes: 14 additions & 14 deletions browser/base/content/aboutDialog-appUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ appUpdater.prototype =
* @param aChildID
* The id of the deck's child to select, e.g. "apply".
*/
selectPanel: function(aChildID) {
selectPanel(aChildID) {
let panel = document.getElementById(aChildID);

let button = panel.querySelector("button");
Expand All @@ -191,7 +191,7 @@ appUpdater.prototype =
/**
* Check for updates
*/
checkForUpdates: function() {
checkForUpdates() {
// Clear prefs that could prevent a user from discovering available updates.
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CANCELATIONS_OSX)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_CANCELATIONS_OSX);
Expand All @@ -209,7 +209,7 @@ appUpdater.prototype =
* Handles oncommand for the "Restart to Update" button
* which is presented after the download has been downloaded.
*/
buttonRestartAfterDownload: function() {
buttonRestartAfterDownload() {
if (!this.isPending && !this.isApplied) {
return;
}
Expand Down Expand Up @@ -249,7 +249,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onCheckComplete: function(aRequest, aUpdates, aUpdateCount) {
onCheckComplete(aRequest, aUpdates, aUpdateCount) {
gAppUpdater.isChecking = false;
gAppUpdater.update = gAppUpdater.aus.
selectUpdate(aUpdates, aUpdates.length);
Expand Down Expand Up @@ -281,7 +281,7 @@ appUpdater.prototype =
/**
* See nsIUpdateService.idl
*/
onError: function(aRequest, aUpdate) {
onError(aRequest, aUpdate) {
// Errors in the update check are treated as no updates found. If the
// update check fails repeatedly without a success the user will be
// notified with the normal app update user interface so this is safe.
Expand All @@ -292,7 +292,7 @@ appUpdater.prototype =
/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (!aIID.equals(Components.interfaces.nsIUpdateCheckListener) &&
!aIID.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
Expand All @@ -303,7 +303,7 @@ appUpdater.prototype =
/**
* Starts the download of an update mar.
*/
startDownload: function() {
startDownload() {
if (!this.update)
this.update = this.um.activeUpdate;
this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
Expand All @@ -322,15 +322,15 @@ appUpdater.prototype =
/**
* Switches to the UI responsible for tracking the download.
*/
setupDownloadingUI: function() {
setupDownloadingUI() {
this.downloadStatus = document.getElementById("downloadStatus");
this.downloadStatus.value =
DownloadUtils.getTransferTotal(0, this.update.selectedPatch.size);
this.selectPanel("downloading");
this.aus.addDownloadListener(this);
},

removeDownloadListener: function() {
removeDownloadListener() {
if (this.aus) {
this.aus.removeDownloadListener(this);
}
Expand All @@ -339,13 +339,13 @@ appUpdater.prototype =
/**
* See nsIRequestObserver.idl
*/
onStartRequest: function(aRequest, aContext) {
onStartRequest(aRequest, aContext) {
},

/**
* See nsIRequestObserver.idl
*/
onStopRequest: function(aRequest, aContext, aStatusCode) {
onStopRequest(aRequest, aContext, aStatusCode) {
switch (aStatusCode) {
case Components.results.NS_ERROR_UNEXPECTED:
if (this.update.selectedPatch.state == "download-failed" &&
Expand Down Expand Up @@ -404,21 +404,21 @@ appUpdater.prototype =
/**
* See nsIProgressEventSink.idl
*/
onStatus: function(aRequest, aContext, aStatus, aStatusArg) {
onStatus(aRequest, aContext, aStatus, aStatusArg) {
},

/**
* See nsIProgressEventSink.idl
*/
onProgress: function(aRequest, aContext, aProgress, aProgressMax) {
onProgress(aRequest, aContext, aProgress, aProgressMax) {
this.downloadStatus.value =
DownloadUtils.getTransferTotal(aProgress, aProgressMax);
},

/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (!aIID.equals(Components.interfaces.nsIProgressEventSink) &&
!aIID.equals(Components.interfaces.nsIRequestObserver) &&
!aIID.equals(Components.interfaces.nsISupports))
Expand Down
32 changes: 16 additions & 16 deletions browser/base/content/aboutaccounts/aboutaccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function updateDisplayedEmail(user) {
var wrapper = {
iframe: null,

init: function(url, urlParams) {
init(url, urlParams) {
// If a master-password is enabled, we want to encourage the user to
// unlock it. Things still work if not, but the user will probably need
// to re-auth next startup (in which case we will get here again and
Expand Down Expand Up @@ -130,7 +130,7 @@ var wrapper = {
webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY, null, null, null);
},

retry: function() {
retry() {
let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
webNav.loadURI(this.url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
},
Expand All @@ -140,7 +140,7 @@ var wrapper = {
Ci.nsISupportsWeakReference,
Ci.nsISupports]),

onStateChange: function(aWebProgress, aRequest, aState, aStatus) {
onStateChange(aWebProgress, aRequest, aState, aStatus) {
let failure = false;

// Captive portals sometimes redirect users
Expand All @@ -164,19 +164,19 @@ var wrapper = {
}
},

onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
if (aRequest && aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
setErrorPage("networkError");
}
},

onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
onProgressChange() {},
onStatusChange() {},
onSecurityChange() {},
},

handleEvent: function(evt) {
handleEvent(evt) {
switch (evt.type) {
case "load":
this.iframe.contentWindow.addEventListener("FirefoxAccountsCommand", this);
Expand All @@ -194,7 +194,7 @@ var wrapper = {
*
* @param accountData the user's account data and credentials
*/
onLogin: function(accountData) {
onLogin(accountData) {
log("Received: 'login'. Data:" + JSON.stringify(accountData));

if (accountData.customizeSync) {
Expand Down Expand Up @@ -251,16 +251,16 @@ var wrapper = {
);
},

onCanLinkAccount: function(accountData) {
onCanLinkAccount(accountData) {
// We need to confirm a relink - see shouldAllowRelink for more
let ok = shouldAllowRelink(accountData.email);
this.injectData("message", { status: "can_link_account", data: { ok: ok } });
this.injectData("message", { status: "can_link_account", data: { ok } });
},

/**
* onSignOut handler erases the current user's session from the fxaccounts service
*/
onSignOut: function() {
onSignOut() {
log("Received: 'sign_out'.");

fxAccounts.signOut().then(
Expand All @@ -269,7 +269,7 @@ var wrapper = {
);
},

handleRemoteCommand: function(evt) {
handleRemoteCommand(evt) {
log('command: ' + evt.detail.command);
let data = evt.detail.data;

Expand All @@ -289,11 +289,11 @@ var wrapper = {
}
},

injectData: function(type, content) {
injectData(type, content) {
return fxAccounts.promiseAccountsSignUpURI().then(authUrl => {
let data = {
type: type,
content: content
type,
content
};
this.iframe.contentWindow.postMessage(data, authUrl);
})
Expand Down
34 changes: 17 additions & 17 deletions browser/base/content/abouthealthreport/abouthealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ const PREF_UNIFIED = "toolkit.telemetry.unified";
const PREF_REPORTING_URL = "datareporting.healthreport.about.reportUrl";

var healthReportWrapper = {
init: function() {
init() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage, false);
iframe.src = this._getReportURI().spec;
prefs.observe("uploadEnabled", this.updatePrefState, healthReportWrapper);
},

uninit: function() {
uninit() {
prefs.ignore("uploadEnabled", this.updatePrefState, healthReportWrapper);
},

_getReportURI: function() {
_getReportURI() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
return Services.io.newURI(url, null, null);
},

setDataSubmission: function(enabled) {
setDataSubmission(enabled) {
MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
this.updatePrefState();
},

updatePrefState: function() {
updatePrefState() {
try {
let prefsObj = {
enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
Expand All @@ -48,7 +48,7 @@ var healthReportWrapper = {
}
},

sendTelemetryPingList: function() {
sendTelemetryPingList() {
console.log("AboutHealthReport: Collecting Telemetry ping list.");
MozSelfSupport.getTelemetryPingList().then((list) => {
console.log("AboutHealthReport: Sending Telemetry ping list.");
Expand All @@ -58,7 +58,7 @@ var healthReportWrapper = {
});
},

sendTelemetryPingData: function(pingId) {
sendTelemetryPingData(pingId) {
console.log("AboutHealthReport: Collecting Telemetry ping data.");
MozSelfSupport.getTelemetryPing(pingId).then((ping) => {
console.log("AboutHealthReport: Sending Telemetry ping data.");
Expand All @@ -75,7 +75,7 @@ var healthReportWrapper = {
});
},

sendCurrentEnvironment: function() {
sendCurrentEnvironment() {
console.log("AboutHealthReport: Sending Telemetry environment data.");
MozSelfSupport.getCurrentTelemetryEnvironment().then((environment) => {
this.injectData("telemetry-current-environment-data", environment);
Expand All @@ -84,7 +84,7 @@ var healthReportWrapper = {
});
},

sendCurrentPingData: function() {
sendCurrentPingData() {
console.log("AboutHealthReport: Sending current Telemetry ping data.");
MozSelfSupport.getCurrentTelemetrySubsessionPing().then((ping) => {
this.injectData("telemetry-current-ping-data", ping);
Expand All @@ -93,23 +93,23 @@ var healthReportWrapper = {
});
},

injectData: function(type, content) {
injectData(type, content) {
let report = this._getReportURI();

// file URIs can't be used for targetOrigin, so we use "*" for this special case
// in all other cases, pass in the URL to the report so we properly restrict the message dispatch
let reportUrl = report.scheme == "file" ? "*" : report.spec;

let data = {
type: type,
content: content
type,
content
}

let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},

handleRemoteCommand: function(evt) {
handleRemoteCommand(evt) {
// Do an origin check to harden against the frame content being loaded from unexpected locations.
let allowedPrincipal = Services.scriptSecurityManager.getCodebasePrincipal(this._getReportURI());
let targetPrincipal = evt.target.nodePrincipal;
Expand Down Expand Up @@ -147,7 +147,7 @@ var healthReportWrapper = {
}
},

initRemotePage: function() {
initRemotePage() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); },
Expand All @@ -160,18 +160,18 @@ var healthReportWrapper = {
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,

reportFailure: function(error) {
reportFailure(error) {
let details = {
errorType: error,
}
healthReportWrapper.injectData("error", details);
},

handleInitFailure: function() {
handleInitFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},

handlePayloadFailure: function() {
handlePayloadFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
}
Expand Down
6 changes: 3 additions & 3 deletions browser/base/content/abouthome/aboutHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,18 @@ function ensureSnippetsMapThen(aCallback)
// The cache has been filled up, create the snippets map.
gSnippetsMap = Object.freeze({
get: (aKey) => cache.get(aKey),
set: function(aKey, aValue) {
set(aKey, aValue) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).put(aValue, aKey);
return cache.set(aKey, aValue);
},
has: (aKey) => cache.has(aKey),
delete: function(aKey) {
delete(aKey) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
return cache.delete(aKey);
},
clear: function() {
clear() {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).clear();
return cache.clear();
Expand Down
Loading

0 comments on commit 49079dd

Please sign in to comment.