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

Commit

Permalink
Bug 1329014 - Enable the no-extra-bind rule and use eslint --fix to a…
Browse files Browse the repository at this point in the history
…utofix the errors. r=standard8

MozReview-Commit-ID: BwK94W2mHXS
  • Loading branch information
msujaws committed Jan 5, 2017
1 parent a026033 commit be2741e
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion browser/base/content/aboutNetError.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
if (getErrorCode() == "weakCryptoUsed" || getErrorCode() == "sslv3Used") {
setupAdvancedButton(getErrorCode() == "weakCryptoUsed");
}
}.bind(this), true, true);
}, true, true);

var event = new CustomEvent("AboutNetErrorLoad", {bubbles:true});
document.dispatchEvent(event);
Expand Down
4 changes: 2 additions & 2 deletions browser/components/migration/ChromeProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ function GetBookmarksResource(aProfileFolder) {
if (gotErrors) {
throw new Error("The migration included errors.");
}
}.bind(this)).then(() => aCallback(true),
() => aCallback(false));
}).then(() => aCallback(true),
() => aCallback(false));
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion browser/components/migration/SafariProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ SearchStrings.prototype = {
FormHistory.update(changes);
}
}
}.bind(this), aCallback));
}, aCallback));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ function nextChangeNotificationPromise(aNewURL, testMessage) {
return TestUtils.topicObserved("newtab-url-changed", function observer(aSubject, aData) { // jshint unused:false
Assert.equal(aData, aNewURL, testMessage);
return true;
}.bind(this));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ add_task(function* webchannel_broadcast() {
NewTabWebChannel.off("foo", test_message);
resolve(msg.target);
}
}.bind(this));
});
});

let countingReplyPromise = new Promise(resolve => {
Expand All @@ -102,7 +102,7 @@ add_task(function* webchannel_broadcast() {
NewTabWebChannel.off("reply", test_message);
resolve(msg.target);
}
}.bind(this));
});
});

let countingUnloadPromise = new Promise(resolve => {
Expand Down Expand Up @@ -147,7 +147,7 @@ add_task(function* webchannel_switch() {
return new Promise(resolve => {
NewTabWebChannel.once("foo", function(name, msg) {
resolve(msg.target);
}.bind(this));
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ function nextChangeNotificationPromise(aNewURL, testMessage) {
return TestUtils.topicObserved("newtab-url-changed", function observer(aSubject, aData) { // jshint unused:false
Assert.equal(aData, aNewURL, testMessage);
return true;
}.bind(this));
});
}
2 changes: 1 addition & 1 deletion browser/components/nsBrowserGlue.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ BrowserGlue.prototype = {
if (willPrompt) {
Services.tm.mainThread.dispatch(function() {
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
}, Ci.nsIThread.DISPATCH_NORMAL);
}
}

Expand Down
2 changes: 1 addition & 1 deletion browser/components/uitour/UITour.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ this.UITour = {
["score", rating],
["flowid", aOptions.flowId]
]));
}.bind(this));
});

// Add it to the container.
ratingContainer.appendChild(ratingElement);
Expand Down
2 changes: 1 addition & 1 deletion browser/modules/SocialService.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ this.SocialService = {
getProvider: function getProvider(origin, onDone) {
schedule((function() {
onDone(SocialServiceInternal.providers[origin] || null);
}).bind(this));
}));
},

// Returns an unordered array of installed providers
Expand Down
3 changes: 3 additions & 0 deletions toolkit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ module.exports = {
// No duplicate cases in switch statements
"no-duplicate-case": "error",

// Disallow unnecessary calls to .bind()
"no-extra-bind": "error",

// No labels
"no-labels": "error",

Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/crashes/CrashManager.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ this.CrashManager.prototype = Object.freeze({
entries.sort((a, b) => { return a.date - b.date; });

return entries;
}.bind(this));
});
},

_getStore() {
Expand Down
8 changes: 4 additions & 4 deletions toolkit/components/jsdownloads/src/DownloadCore.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ this.DownloadCopySaver.prototype = {
}
}.bind(copySaver),

onStopRequest: function(aRequest, aContext, aStatusCode) {
onStopRequest(aRequest, aContext, aStatusCode) {
try {
backgroundFileSaver.onStopRequest(aRequest, aContext,
aStatusCode);
Expand All @@ -2109,14 +2109,14 @@ this.DownloadCopySaver.prototype = {
backgroundFileSaver.finish(Cr.NS_OK);
}
}
}.bind(copySaver),
},

onDataAvailable: function(aRequest, aContext, aInputStream,
onDataAvailable(aRequest, aContext, aInputStream,
aOffset, aCount) {
backgroundFileSaver.onDataAvailable(aRequest, aContext,
aInputStream, aOffset,
aCount);
}.bind(copySaver),
},
});

// We should check if we have been canceled in the meantime, after
Expand Down
4 changes: 2 additions & 2 deletions toolkit/components/jsdownloads/test/unit/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function promiseStartLegacyDownload(aSourceUrl, aOptions) {
// Start the actual download process.
persist.savePrivacyAwareURI(sourceURI, null, null, 0, null, null, targetFile,
isPrivate);
}.bind(this)).then(null, do_report_unexpected_exception);
}).then(null, do_report_unexpected_exception);

return deferred.promise;
}
Expand Down Expand Up @@ -429,7 +429,7 @@ function promiseStartExternalHelperAppServiceDownload(aSourceUrl) {
aOffset, aCount);
},
});
}.bind(this)).then(null, do_report_unexpected_exception);
}).then(null, do_report_unexpected_exception);

return deferred.promise;
}
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/places/Bookmarks.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ function reorderChildren(parent, orderedChildrenGuids, options) {
{ orphanAnno: PlacesSyncUtils.bookmarks.SYNC_PARENT_ANNO });

return children;
}.bind(this))
})
);
}

Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/places/PlacesTransactions.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ var TransactionsManager = {
TransactionsHistory.clearRedoEntries();
else
throw new Error("either aUndoEntries or aRedoEntries should be true");
}.bind(this));
});

this._transactEnqueuer.alsoWaitFor(promise);
return promise;
Expand Down
6 changes: 3 additions & 3 deletions toolkit/components/places/PlacesUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ this.PlacesUtils = {
break;
}
return item;
}.bind(this);
};

const QUERY_STR =
`/* do not warn (bug no): cannot use an index */
Expand Down Expand Up @@ -2273,7 +2273,7 @@ var Keywords = {

// In any case, notify about the new keyword.
yield notifyKeywordChange(url.href, keyword, source);
}.bind(this))
})
);
},

Expand Down Expand Up @@ -2311,7 +2311,7 @@ var Keywords = {

// Notify bookmarks about the removal.
yield notifyKeywordChange(url.href, "", source);
}.bind(this))) ;
}));
}
};

Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/places/UnifiedComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ UnifiedComplete.prototype = {
yield SwitchToTabStorage.initDatabase(conn);

return conn;
}.bind(this)).then(null, ex => {
}).then(null, ex => {
dump("Couldn't get database handle: " + ex + "\n");
Cu.reportError(ex);
});
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/reader/AboutReader.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ AboutReader.prototype = {

item.classList.add("selected");
callback(option.value);
}.bind(this), true);
}, true);

if (option.value === initialValue)
item.classList.add("selected");
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/telemetry/TelemetrySession.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ var Impl = {
// TODO: We are keeping this behaviour for now but it will be removed as soon as
// bug 1127907 lands.
Services.obs.notifyObservers(null, "gather-telemetry", null);
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
}), Ci.nsIThread.DISPATCH_NORMAL);
break;

case "application-background":
Expand Down
2 changes: 1 addition & 1 deletion toolkit/identity/IdentityProvider.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ IdentityProviderService.prototype = {
// sandbox.
log("genKeyPair: generated keypair for provisioning flow with id:", aProvId);
provFlow.caller.doGenKeyPairCallback(provFlow.kp.serializedPublicKey);
}.bind(this));
});
},

/**
Expand Down
2 changes: 1 addition & 1 deletion toolkit/modules/ProfileAge.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ this.ProfileAge.prototype = {
return this.computeAndPersistCreated(times)
.then(function onSuccess(created) {
return created;
}.bind(this));
});
}

return this.getTimes()
Expand Down
10 changes: 5 additions & 5 deletions toolkit/modules/secondscreen/RokuApp.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ RokuApp.prototype = {
if (callback) {
callback({ state: "unknown" });
}
}).bind(this), false);
}), false);

xhr.send(null);
},
Expand Down Expand Up @@ -91,13 +91,13 @@ RokuApp.prototype = {
if (callback) {
callback(xhr.status === 200);
}
}).bind(this), false);
}), false);

xhr.addEventListener("error", (function() {
if (callback) {
callback(false);
}
}).bind(this), false);
}), false);

xhr.send(null);
},
Expand All @@ -114,13 +114,13 @@ RokuApp.prototype = {
if (callback) {
callback(xhr.status === 200);
}
}).bind(this), false);
}), false);

xhr.addEventListener("error", (function() {
if (callback) {
callback(false);
}
}).bind(this), false);
}), false);

xhr.send(null);
},
Expand Down
2 changes: 1 addition & 1 deletion toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var SimpleServiceDiscovery = {
} else if (name.startsWith("ST")) {
service.target = row.substr(4).trim();
}
}.bind(this));
});

if (service.location && service.target) {
service.location = this._forceTrailingSlash(service.location);
Expand Down
2 changes: 1 addition & 1 deletion toolkit/mozapps/extensions/content/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3491,7 +3491,7 @@ var gDetailView = {

if (aCallback)
aCallback();
}).bind(this);
});
xhr.onerror = function(aEvent) {
Cu.reportError("Error " + aEvent.target.status +
" occurred while receiving " + this._addon.optionsURL);
Expand Down

0 comments on commit be2741e

Please sign in to comment.