Bug 1316882: Turn on func-call-spacing eslint rule. r=bgrins

MozReview-Commit-ID: GIkQnRX9woD

--HG--
extra : rebase_source : ed6e9af9b102aaf92965d089d8022b9d94e3f440
This commit is contained in:
Dave Townsend 2016-11-10 15:05:32 -08:00
Родитель 0a2c8f9b78
Коммит 4ac0e05ec7
27 изменённых файлов: 76 добавлений и 76 удалений

Просмотреть файл

@ -35,7 +35,7 @@ add_task(function*() {
let output = yield ContentTask.spawn(browser, { }, function* (arg) {
return content.document.getElementById("output").textContent;
});
is (output, "Passed", "Paste file");
is(output, "Passed", "Paste file");
textbox.focus();

Просмотреть файл

@ -25,56 +25,56 @@ registerCleanupFunction(() => {
add_task(function* startTests() {
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
info ("Setting the current theme to null");
info("Setting the current theme to null");
LightweightThemeManager.currentTheme = null;
ok (!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
ok(!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
info ("Adding a lightweight theme.");
info("Adding a lightweight theme.");
LightweightThemeManager.currentTheme = dummyLightweightTheme("preview0");
ok (!DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been removed when a lightweight theme is applied.");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been removed when a lightweight theme is applied.");
info ("Applying the devedition lightweight theme.");
info("Applying the devedition lightweight theme.");
let onAttributeAdded = waitForBrightTitlebarAttribute();
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
yield onAttributeAdded;
is (document.documentElement.getAttribute("brighttitlebarforeground"), "true",
is(document.documentElement.getAttribute("brighttitlebarforeground"), "true",
"The brighttitlebarforeground attribute is set on the window.");
info ("Unapplying all themes.");
info("Unapplying all themes.");
LightweightThemeManager.currentTheme = null;
ok (!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
ok(!DevEdition.isStyleSheetEnabled, "There is no devedition style sheet when no lw theme is applied.");
info ("Applying the devedition lightweight theme.");
info("Applying the devedition lightweight theme.");
onAttributeAdded = waitForBrightTitlebarAttribute();
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet has been added when the devedition lightweight theme is applied");
yield onAttributeAdded;
ok (document.documentElement.hasAttribute("brighttitlebarforeground"),
ok(document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is set on the window with dark devtools theme.");
});
add_task(function* testDevtoolsTheme() {
info ("Checking stylesheet and :root attributes based on devtools theme.");
info("Checking stylesheet and :root attributes based on devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "light");
is (document.documentElement.getAttribute("devtoolstheme"), "light",
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has an attribute based on devtools theme.");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the light devtools theme.");
ok (!document.documentElement.hasAttribute("brighttitlebarforeground"),
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the light devtools theme.");
ok(!document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is not set on the window with light devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
is (document.documentElement.getAttribute("devtoolstheme"), "dark",
is(document.documentElement.getAttribute("devtoolstheme"), "dark",
"The documentElement has an attribute based on devtools theme.");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the dark devtools theme.");
is (document.documentElement.getAttribute("brighttitlebarforeground"), "true",
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the dark devtools theme.");
is(document.documentElement.getAttribute("brighttitlebarforeground"), "true",
"The brighttitlebarforeground attribute is set on the window with dark devtools theme.");
Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "foobar");
is (document.documentElement.getAttribute("devtoolstheme"), "light",
is(document.documentElement.getAttribute("devtoolstheme"), "light",
"The documentElement has 'light' as a default for the devtoolstheme attribute");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the foobar devtools theme.");
ok (!document.documentElement.hasAttribute("brighttitlebarforeground"),
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is still there with the foobar devtools theme.");
ok(!document.documentElement.hasAttribute("brighttitlebarforeground"),
"The brighttitlebarforeground attribute is not set on the window with light devtools theme.");
});
@ -90,25 +90,25 @@ function dummyLightweightTheme(id) {
}
add_task(function* testLightweightThemePreview() {
info ("Setting devedition to current and the previewing others");
info("Setting devedition to current and the previewing others");
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org");
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview0"));
ok (!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a lightweight theme preview.");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a lightweight theme preview.");
LightweightThemeManager.resetPreview();
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview1"));
ok (!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a second lightweight theme preview.");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is not enabled after a second lightweight theme preview.");
LightweightThemeManager.resetPreview();
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled again after resetting the preview.");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled again after resetting the preview.");
LightweightThemeManager.currentTheme = null;
ok (!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is gone after removing the current theme.");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is gone after removing the current theme.");
info ("Previewing the devedition theme");
info("Previewing the devedition theme");
LightweightThemeManager.previewTheme(LightweightThemeManager.getUsedTheme("firefox-devedition@mozilla.org"));
ok (DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
ok(DevEdition.isStyleSheetEnabled, "The devedition stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("preview2"));
LightweightThemeManager.resetPreview();
ok (!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is now disabled after resetting the preview.");
ok(!DevEdition.isStyleSheetEnabled, "The devedition stylesheet is now disabled after resetting the preview.");
});
// Use a mutation observer to wait for the brighttitlebarforeground

Просмотреть файл

@ -5,7 +5,7 @@ add_task(function* test_keyword_bookmarklet() {
title: "bookmarklet",
url: "javascript:'1';" });
let tab = gBrowser.selectedTab = gBrowser.addTab();
registerCleanupFunction (function* () {
registerCleanupFunction(function* () {
gBrowser.removeTab(tab);
yield PlacesUtils.bookmarks.remove(bm);
});

Просмотреть файл

@ -39,7 +39,7 @@ function triggerSave(aWindow, aCallback) {
info("showCallback");
fileName = fp.defaultString;
info("fileName: " + fileName);
destFile.append (fileName);
destFile.append(fileName);
MockFilePicker.returnFiles = [destFile];
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
info("done showCallback");

Просмотреть файл

@ -43,7 +43,7 @@ function triggerSave(aWindow, aCallback) {
info("showCallback");
fileName = fp.defaultString;
info("fileName: " + fileName);
destFile.append (fileName);
destFile.append(fileName);
MockFilePicker.returnFiles = [destFile];
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
info("done showCallback");

Просмотреть файл

@ -60,7 +60,7 @@ function promiseImageDownloaded() {
MockFilePicker.displayDirectory = destDir;
MockFilePicker.showCallback = function(fp) {
fileName = fp.defaultString;
destFile.append (fileName);
destFile.append(fileName);
MockFilePicker.returnFiles = [destFile];
MockFilePicker.filterIndex = 1; // kSaveAsType_URL
};

Просмотреть файл

@ -30,7 +30,7 @@ function waitForSecurityChange(numChanges = 1) {
let listener = {
onSecurityChange: function() {
n = n + 1;
info ("Received onSecurityChange event " + n + " of " + numChanges);
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {
tabbrowser.removeProgressListener(listener);
resolve();

Просмотреть файл

@ -6,7 +6,7 @@ function waitForSecurityChange(numChanges = 1) {
let listener = {
onSecurityChange: function() {
n = n + 1;
info ("Received onSecurityChange event " + n + " of " + numChanges);
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {
gBrowser.removeProgressListener(listener);
resolve();

Просмотреть файл

@ -30,7 +30,7 @@ function promiseMigration(migrator, resourceType, aProfile = null) {
let availableSources = migrator.getMigrateData(aProfile, false);
Assert.ok((availableSources & resourceType) > 0, "Resource supported by migrator");
return new Promise (resolve => {
return new Promise(resolve => {
Services.obs.addObserver(function onMigrationEnded() {
Services.obs.removeObserver(onMigrationEnded, "Migration:Ended");
resolve();

Просмотреть файл

@ -590,7 +590,7 @@ this.PlacesUIUtils = {
if ("itemGuid" in aData) {
if (!this.PLACES_FLAVORS.includes(aData.type))
throw new Error (`itemGuid unexpectedly set on ${aData.type} data`);
throw new Error(`itemGuid unexpectedly set on ${aData.type} data`);
let info = { guid: aData.itemGuid
, newParentGuid: aNewParentGuid

Просмотреть файл

@ -68,7 +68,7 @@ var selectBookmarksIn = Task.async(function* (organizer, bookmarks, aLeftPaneQue
let ids = [];
for (let {guid} of bookmarks) {
let bookmark = yield PlacesUtils.bookmarks.fetch(guid);
is (bookmark.parentGuid, PlacesOrganizer._places.selectedNode.targetFolderGuid,
is(bookmark.parentGuid, PlacesOrganizer._places.selectedNode.targetFolderGuid,
"Bookmark has the right parent");
ids.push(yield PlacesUtils.promiseItemId(bookmark.guid));
}

Просмотреть файл

@ -34,7 +34,7 @@ function run_test() {
runner.appendIterator(testGetProviderList(manifests, next));
runner.appendIterator(testAddRemoveProvider(manifests, next));
runner.appendIterator(testIsSameOrigin(manifests, next));
runner.appendIterator(testResolveUri (manifests, next));
runner.appendIterator(testResolveUri(manifests, next));
runner.appendIterator(testOrderedProviders(manifests, next));
runner.appendIterator(testRemoveProviders(manifests, next));
runner.next();

Просмотреть файл

@ -36,6 +36,9 @@ module.exports = {
// Always require a trailing EOL
"eol-last": "error",
// No spaces between function name and parentheses
"func-call-spacing": "error",
// Require function* name()
// "generator-star-spacing": ["error", {"before": false, "after": true}],
@ -138,9 +141,6 @@ module.exports = {
// No declaring variables that hide things like arguments
"no-shadow-restricted-names": "error",
// No spaces between function name and parentheses
// "no-spaced-func": "error",
// No trailing whitespace
"no-trailing-spaces": "error",

Просмотреть файл

@ -100,7 +100,7 @@ this.TestingCrashManager.prototype = {
return Task.spawn(function* () {
let mode = OS.Constants.libc.S_IRUSR | OS.Constants.libc.S_IWUSR;
yield OS.File.open(path, {create: true}, {unixMode: mode});
dump ("Create ignored dump file: " + path + "\n");
dump("Create ignored dump file: " + path + "\n");
});
},

Просмотреть файл

@ -20,7 +20,7 @@ function run_test() {
let infos = [];
aLog.forEach(function (aMsg) {
print (aMsg);
print(aMsg);
switch (aMsg.substr(0, 1)) {
case "+":
positives.push(aMsg);

Просмотреть файл

@ -18,7 +18,7 @@ function run_test() {
let infos = [];
aLog.forEach(function (aMsg) {
print (aMsg);
print(aMsg);
switch (aMsg.substr(0, 1)) {
case "+":
positives.push(aMsg);

Просмотреть файл

@ -1,7 +1,7 @@
<head></head><body><p>Original content</p>
<script>
window.opener.postMessage("", "*");
confirm ("Message");
document.write ("Extra content");
confirm("Message");
document.write("Extra content");
window.opener.postMessage(document.documentElement.innerHTML, "*");
</script></body>

Просмотреть файл

@ -1729,7 +1729,7 @@ var Impl = {
addEnvironment: true,
};
p.push(TelemetryController.submitExternalPing(getPingType(payload), payload, options)
.catch (e => this._log.error("saveShutdownPings - failed to submit saved-session ping", e)));
.catch(e => this._log.error("saveShutdownPings - failed to submit saved-session ping", e)));
}
// Wait on pings to be saved.

Просмотреть файл

@ -23,12 +23,12 @@ function check(aBrowser, aElementName, aBarred, aType) {
}
e.setAttribute('title', '');
ok (!tttp.getNodeText(e, {}, {}),
ok(!tttp.getNodeText(e, {}, {}),
"No tooltip should be shown if the title attribute is set");
e.removeAttribute('title');
contentElement.setAttribute('novalidate', '');
ok (!tttp.getNodeText(e, {}, {}),
ok(!tttp.getNodeText(e, {}, {}),
"No tooltip should be shown if the novalidate attribute is set on the form owner");
contentElement.removeAttribute('novalidate');

Просмотреть файл

@ -1221,7 +1221,7 @@ WidgetStack.prototype = {
this._widgetState[wid] = state;
log ("(New widget: " + wid + (state.viewport ? " [viewport]" : "") + " at: " + state.rect + ")");
log("(New widget: " + wid + (state.viewport ? " [viewport]" : "") + " at: " + state.rect + ")");
},
_removeWidget: function (w) {

Просмотреть файл

@ -230,7 +230,7 @@
event.initEvent(aEventName, true, true);
var cancel = !aTarget.dispatchEvent(event);
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function ("event", aTarget.getAttribute("on" + aEventName));
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (rv == false)
cancel = true;
@ -486,7 +486,7 @@
event.initEvent(aEventName, true, true);
var cancel = !aTarget.dispatchEvent(event);
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function ("event", aTarget.getAttribute("on" + aEventName));
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (rv == false)
cancel = true;

Просмотреть файл

@ -437,8 +437,8 @@
try {
var event = document.createEvent("Events");
event.initEvent("syncfrompreference", true, true);
var f = new Function ("event",
aElement.getAttribute("onsyncfrompreference"));
var f = new Function("event",
aElement.getAttribute("onsyncfrompreference"));
rv = f.call(aElement, event);
}
catch (e) {
@ -492,8 +492,8 @@
try {
var event = document.createEvent("Events");
event.initEvent("synctopreference", true, true);
var f = new Function ("event",
aElement.getAttribute("onsynctopreference"));
var f = new Function("event",
aElement.getAttribute("onsynctopreference"));
var rv = f.call(aElement, event);
if (rv !== undefined)
return rv;
@ -644,7 +644,7 @@
acceptButton.disabled = true;
} else {
// morph the Cancel button into the Close button
cancelButton.setAttribute ("icon", "close");
cancelButton.setAttribute("icon", "close");
cancelButton.label = docElt.getAttribute("closebuttonlabel");
cancelButton.accesskey = docElt.getAttribute("closebuttonaccesskey");
}
@ -797,7 +797,7 @@
event.initEvent(aEventName, true, true);
var cancel = !aTarget.dispatchEvent(event);
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function ("event", aTarget.getAttribute("on" + aEventName));
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (rv == false)
cancel = true;

Просмотреть файл

@ -325,7 +325,7 @@ function GMPAddon(addon) {
for (let name of Object.keys(addon)) {
this[name] = addon[name];
}
log.info ("Created new addon: " + this.toString());
log.info("Created new addon: " + this.toString());
}
GMPAddon.prototype = {

Просмотреть файл

@ -129,7 +129,7 @@ Sntp.prototype = {
_retry: function _retry() {
this._retryCount++;
if (this._retryCount > this._maxRetryCount) {
debug ("stop retrying SNTP");
debug("stop retrying SNTP");
// Clear so we can start with clean status next time we have network.
this._retryCount = 0;
this._retryPeriodInMS = 0;
@ -176,7 +176,7 @@ Sntp.prototype = {
onStopRequest: function onStopRequest(request, context, status) {
if (!Components.isSuccessCode(status)) {
debug ("Connection failed");
debug("Connection failed");
this._requesting = false;
this._retry();
}
@ -191,7 +191,7 @@ Sntp.prototype = {
((s - OFFSET_1900_TO_1970) * 1000) + ((f * 1000) / 0x100000000)
);
}
debug ("Data available: " + count + " bytes");
debug("Data available: " + count + " bytes");
try {
let binaryInputStream = Cc["@mozilla.org/binaryinputstream;1"]
@ -213,7 +213,7 @@ Sntp.prototype = {
transmitTimeInMS, respondTimeInMS);
this._requesting = false;
} catch (e) {
debug ("SNTPListener Error: " + e.message);
debug("SNTPListener Error: " + e.message);
this._requesting = false;
this._retry();
}
@ -227,10 +227,10 @@ Sntp.prototype = {
try {
let data = GetRequest();
let bytes_write = stream.write(data, data.length);
debug ("SNTP: sent " + bytes_write + " bytes");
debug("SNTP: sent " + bytes_write + " bytes");
stream.close();
} catch (e) {
debug ("SNTPRequester Error: " + e.message);
debug("SNTPRequester Error: " + e.message);
this._requesting = false;
this._retry();
}
@ -252,7 +252,7 @@ Sntp.prototype = {
this._updateTimer.cancel();
}
debug ("Making request");
debug("Making request");
this._requesting = true;
let currentThread = Cc["@mozilla.org/thread-manager;1"]

Просмотреть файл

@ -4191,7 +4191,7 @@ this.XPIProvider = {
* A callback to pass the Addon to
*/
getAddonByID: function(aId, aCallback) {
XPIDatabase.getVisibleAddonForID (aId, function(aAddon) {
XPIDatabase.getVisibleAddonForID(aId, function(aAddon) {
aCallback(aAddon ? aAddon.wrapper : null);
});
},

Просмотреть файл

@ -278,7 +278,7 @@ add_task(function* cancel_during_repopulate() {
let getInstalls = Promise.defer();
AddonManager.getAllInstalls(getInstalls.resolve);
let installs = yield getInstalls.promise;
is (installs.length, 0, "There should be no active installs after background installs are done");
is(installs.length, 0, "There should be no active installs after background installs are done");
// addon8 should have updated in the background,
// addon9 was listed as previously disabled so it should not have updated
@ -347,7 +347,7 @@ add_task(function* cancel_during_findUpdates() {
let getInstalls = Promise.defer();
AddonManager.getAllInstalls(getInstalls.resolve);
let installs = yield getInstalls.promise;
is (installs.length, 0, "There should be no active installs after the dialog is cancelled 2");
is(installs.length, 0, "There should be no active installs after the dialog is cancelled 2");
info("findUpdates done");
yield promise_uninstall_test_addons();

Просмотреть файл

@ -172,19 +172,19 @@ function setPasswordStrength()
// use of numbers in the password
var numnumeric = pw.replace (/[0-9]/g, "");
var numnumeric = pw.replace(/[0-9]/g, "");
var numeric = (pw.length - numnumeric.length);
if (numeric > 3)
numeric = 3;
// use of symbols in the password
var symbols = pw.replace (/\W/g, "");
var symbols = pw.replace(/\W/g, "");
var numsymbols = (pw.length - symbols.length);
if (numsymbols > 3)
numsymbols = 3;
// use of uppercase in the password
var numupper = pw.replace (/[A-Z]/g, "");
var numupper = pw.replace(/[A-Z]/g, "");
var upper = (pw.length - numupper.length);
if (upper > 3)
upper = 3;