Bug 1325464 - Enable object-shorthand rule and run 'mach eslint --fix' with the rule enabled. r=MattN

MozReview-Commit-ID: 8WoGr8i6oCR
This commit is contained in:
Jared Wein
2016-12-29 15:20:47 -05:00
parent f64a7da705
commit 34e228f767
824 changed files with 7774 additions and 7790 deletions

View File

@@ -262,7 +262,7 @@ this.CrashManager.prototype = Object.freeze({
*
* @return Promise<Array>
*/
pendingDumps: function() {
pendingDumps() {
return this._getDirectoryEntries(this._pendingDumpsDir, this.DUMP_REGEX);
},
@@ -286,7 +286,7 @@ this.CrashManager.prototype = Object.freeze({
*
* @return Promise<Array>
*/
submittedDumps: function() {
submittedDumps() {
return this._getDirectoryEntries(this._submittedDumpsDir,
this.SUBMITTED_REGEX);
},
@@ -306,7 +306,7 @@ this.CrashManager.prototype = Object.freeze({
*
* @return promise<int> The number of event files that were examined.
*/
aggregateEventsFiles: function() {
aggregateEventsFiles() {
if (this._aggregatePromise) {
return this._aggregatePromise;
}
@@ -389,7 +389,7 @@ this.CrashManager.prototype = Object.freeze({
* (Date) The cutoff point for pruning. Crashes without data newer
* than this will be pruned.
*/
pruneOldCrashes: function(date) {
pruneOldCrashes(date) {
return Task.spawn(function* () {
let store = yield this._getStore();
store.pruneOldCrashes(date);
@@ -400,7 +400,7 @@ this.CrashManager.prototype = Object.freeze({
/**
* Run tasks that should be periodically performed.
*/
runMaintenanceTasks: function() {
runMaintenanceTasks() {
return Task.spawn(function* () {
yield this.aggregateEventsFiles();
@@ -415,7 +415,7 @@ this.CrashManager.prototype = Object.freeze({
* @param delay
* (integer) Delay in milliseconds when maintenance should occur.
*/
scheduleMaintenance: function(delay) {
scheduleMaintenance(delay) {
let deferred = PromiseUtils.defer();
setTimeout(() => {
@@ -439,7 +439,7 @@ this.CrashManager.prototype = Object.freeze({
*
* @return promise<null> Resolved when the store has been saved.
*/
addCrash: function(processType, crashType, id, date, metadata) {
addCrash(processType, crashType, id, date, metadata) {
let promise = Task.spawn(function* () {
let store = yield this._getStore();
if (store.addCrash(processType, crashType, id, date, metadata)) {
@@ -561,7 +561,7 @@ this.CrashManager.prototype = Object.freeze({
*
* The promise-resolved array is sorted by file mtime, oldest to newest.
*/
_getUnprocessedEventsFiles: function() {
_getUnprocessedEventsFiles() {
return Task.spawn(function* () {
let entries = [];
@@ -578,7 +578,7 @@ this.CrashManager.prototype = Object.freeze({
},
// See docs/crash-events.rst for the file format specification.
_processEventFile: function(entry) {
_processEventFile(entry) {
return Task.spawn(function* () {
let data = yield OS.File.read(entry.path);
let store = yield this._getStore();
@@ -617,7 +617,7 @@ this.CrashManager.prototype = Object.freeze({
}.bind(this));
},
_filterAnnotations: function(annotations) {
_filterAnnotations(annotations) {
let filteredAnnotations = {};
for (let line in annotations) {
@@ -629,7 +629,7 @@ this.CrashManager.prototype = Object.freeze({
return filteredAnnotations;
},
_sendCrashPing: function(crashId, type, date, metadata = {}) {
_sendCrashPing(crashId, type, date, metadata = {}) {
// If we have a saved environment, use it. Otherwise report
// the current environment.
let reportMeta = Cu.cloneInto(metadata, myScope);
@@ -646,10 +646,10 @@ this.CrashManager.prototype = Object.freeze({
{
version: 1,
crashDate: date.toISOString().slice(0, 10), // YYYY-MM-DD
sessionId: sessionId,
crashId: crashId,
sessionId,
crashId,
processType: type,
stackTraces: stackTraces,
stackTraces,
metadata: reportMeta,
hasCrashEnvironment: (crashEnvironment !== null),
},
@@ -662,7 +662,7 @@ this.CrashManager.prototype = Object.freeze({
);
},
_handleEventFilePayload: function(store, entry, type, date, payload) {
_handleEventFilePayload(store, entry, type, date, payload) {
// The payload types and formats are documented in docs/crash-events.rst.
// Do not change the format of an existing type. Instead, invent a new
// type.
@@ -720,7 +720,7 @@ this.CrashManager.prototype = Object.freeze({
* id -- regexp.match()[1] (likely the crash ID)
* date -- Date mtime of the file
*/
_getDirectoryEntries: function(path, re) {
_getDirectoryEntries(path, re) {
return Task.spawn(function* () {
try {
yield OS.File.stat(path);
@@ -763,7 +763,7 @@ this.CrashManager.prototype = Object.freeze({
}.bind(this));
},
_getStore: function() {
_getStore() {
if (this._getStoreTask) {
return this._getStoreTask;
}
@@ -823,7 +823,7 @@ this.CrashManager.prototype = Object.freeze({
*
* Returns an array of CrashRecord instances. Instances are read-only.
*/
getCrashes: function() {
getCrashes() {
return Task.spawn(function* () {
let store = yield this._getStore();
@@ -831,7 +831,7 @@ this.CrashManager.prototype = Object.freeze({
}.bind(this));
},
getCrashCountsByDay: function() {
getCrashCountsByDay() {
return Task.spawn(function* () {
let store = yield this._getStore();
@@ -908,7 +908,7 @@ CrashStore.prototype = Object.freeze({
*
* @return Promise
*/
load: function() {
load() {
return Task.spawn(function* () {
// Loading replaces data.
this.reset();
@@ -1008,7 +1008,7 @@ CrashStore.prototype = Object.freeze({
*
* @return Promise<null>
*/
save: function() {
save() {
return Task.spawn(function* () {
if (!this._data) {
return;
@@ -1078,7 +1078,7 @@ CrashStore.prototype = Object.freeze({
* We convert these to milliseconds since epoch on output and back to
* Date on input.
*/
_normalize: function(o) {
_normalize(o) {
let normalized = {};
for (let k in o) {
@@ -1096,7 +1096,7 @@ CrashStore.prototype = Object.freeze({
/**
* Convert a serialized object back to its native form.
*/
_denormalize: function(o) {
_denormalize(o) {
let n = {};
for (let k in o) {
@@ -1122,7 +1122,7 @@ CrashStore.prototype = Object.freeze({
* (Date) The cutoff at which data will be pruned. If an entry
* doesn't have data newer than this, it will be pruned.
*/
pruneOldCrashes: function(date) {
pruneOldCrashes(date) {
for (let crash of this.crashes) {
let newest = crash.newestDate;
if (!newest || newest.getTime() < date.getTime()) {
@@ -1167,7 +1167,7 @@ CrashStore.prototype = Object.freeze({
* A CrashRecord will be returned if the crash exists. null will be returned
* if the crash is unknown.
*/
getCrash: function(id) {
getCrash(id) {
for (let crash of this.crashes) {
if (crash.id == id) {
return crash;
@@ -1177,7 +1177,7 @@ CrashStore.prototype = Object.freeze({
return null;
},
_ensureCountsForDay: function(day) {
_ensureCountsForDay(day) {
if (!this._countsByDay.has(day)) {
this._countsByDay.set(day, new Map());
}
@@ -1202,7 +1202,7 @@ CrashStore.prototype = Object.freeze({
*
* @return null | object crash record
*/
_ensureCrashRecord: function(processType, crashType, id, date, metadata) {
_ensureCrashRecord(processType, crashType, id, date, metadata) {
if (!id) {
// Crashes are keyed on ID, so it's not really helpful to store crashes
// without IDs.
@@ -1232,13 +1232,13 @@ CrashStore.prototype = Object.freeze({
}
this._data.crashes.set(id, {
id: id,
id,
remoteID: null,
type: type,
type,
crashDate: date,
submissions: new Map(),
classifications: [],
metadata: metadata,
metadata,
});
}
@@ -1260,14 +1260,14 @@ CrashStore.prototype = Object.freeze({
*
* @return boolean True if the crash was recorded and false if not.
*/
addCrash: function(processType, crashType, id, date, metadata) {
addCrash(processType, crashType, id, date, metadata) {
return !!this._ensureCrashRecord(processType, crashType, id, date, metadata);
},
/**
* @return boolean True if the remote ID was recorded and false if not.
*/
setRemoteCrashID: function(crashID, remoteID) {
setRemoteCrashID(crashID, remoteID) {
let crash = this._data.crashes.get(crashID);
if (!crash || !remoteID) {
return false;
@@ -1277,7 +1277,7 @@ CrashStore.prototype = Object.freeze({
return true;
},
getCrashesOfType: function(processType, crashType) {
getCrashesOfType(processType, crashType) {
let crashes = [];
for (let crash of this.crashes) {
if (crash.isOfType(processType, crashType)) {
@@ -1292,7 +1292,7 @@ CrashStore.prototype = Object.freeze({
* Ensure the submission record is present in storage.
* @returns [submission, crash]
*/
_ensureSubmissionRecord: function(crashID, submissionID) {
_ensureSubmissionRecord(crashID, submissionID) {
let crash = this._data.crashes.get(crashID);
if (!crash || !submissionID) {
return null;
@@ -1312,7 +1312,7 @@ CrashStore.prototype = Object.freeze({
/**
* @return boolean True if the attempt was recorded.
*/
addSubmissionAttempt: function(crashID, submissionID, date) {
addSubmissionAttempt(crashID, submissionID, date) {
let [submission, crash] =
this._ensureSubmissionRecord(crashID, submissionID);
if (!submission) {
@@ -1328,7 +1328,7 @@ CrashStore.prototype = Object.freeze({
/**
* @return boolean True if the response was recorded.
*/
addSubmissionResult: function(crashID, submissionID, date, result) {
addSubmissionResult(crashID, submissionID, date, result) {
let crash = this._data.crashes.get(crashID);
if (!crash || !submissionID) {
return false;
@@ -1348,7 +1348,7 @@ CrashStore.prototype = Object.freeze({
/**
* @return boolean True if the classifications were set.
*/
setCrashClassifications: function(crashID, classifications) {
setCrashClassifications(crashID, classifications) {
let crash = this._data.crashes.get(crashID);
if (!crash) {
return false;
@@ -1407,7 +1407,7 @@ CrashRecord.prototype = Object.freeze({
return this._o.type;
},
isOfType: function(processType, crashType) {
isOfType(processType, crashType) {
return processType + "-" + crashType == this.type;
},

View File

@@ -57,7 +57,7 @@ this.TestingCrashManager = function(options) {
this.TestingCrashManager.prototype = {
__proto__: CrashManager.prototype,
createDummyDump: function(submitted = false, date = new Date(), hr = false) {
createDummyDump(submitted = false, date = new Date(), hr = false) {
let uuid = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator)
.generateUUID()
@@ -89,7 +89,7 @@ this.TestingCrashManager.prototype = {
});
},
createIgnoredDumpFile: function(filename, submitted = false) {
createIgnoredDumpFile(filename, submitted = false) {
let path;
if (submitted) {
path = OS.Path.join(this._submittedDumpsDir, filename);
@@ -104,7 +104,7 @@ this.TestingCrashManager.prototype = {
});
},
createEventsFile: function(filename, type, date, content, index = 0) {
createEventsFile(filename, type, date, content, index = 0) {
let path = OS.Path.join(this._eventsDirs[index], filename);
let data = type + "\n" +
@@ -124,7 +124,7 @@ this.TestingCrashManager.prototype = {
*
* We can probably delete this once we have actual events defined.
*/
_handleEventFilePayload: function(store, entry, type, date, payload) {
_handleEventFilePayload(store, entry, type, date, payload) {
if (type == "test.1") {
if (payload == "malformed") {
return this.EVENT_FILE_ERROR_MALFORMED;

View File

@@ -57,7 +57,7 @@ CrashService.prototype = Object.freeze({
Ci.nsIObserver,
]),
addCrash: function(processType, crashType, id) {
addCrash(processType, crashType, id) {
switch (processType) {
case Ci.nsICrashService.PROCESS_TYPE_MAIN:
processType = Services.crashmanager.PROCESS_TYPE_MAIN;
@@ -98,7 +98,7 @@ CrashService.prototype = Object.freeze({
);
},
observe: function(subject, topic, data) {
observe(subject, topic, data) {
switch (topic) {
case "profile-after-change":
// Side-effect is the singleton is instantiated.