зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1385815 - Enable more ESLint rules for mobile/android. r=sebastian
MozReview-Commit-ID: aC7PX7xDok --HG-- extra : rebase_source : 3f48ac26d442a47988fcf445d5319ecc6a38a7c5
This commit is contained in:
Родитель
9a7db035d4
Коммит
015cd78b6a
|
@ -10,12 +10,7 @@ module.exports = {
|
|||
// re-enable these over time.
|
||||
"brace-style": "off",
|
||||
"consistent-return": "off",
|
||||
"no-else-return": "off",
|
||||
"no-empty": "off",
|
||||
"no-extra-bind": "off",
|
||||
"no-extra-semi": "off",
|
||||
"no-lonely-if": "off",
|
||||
"no-multi-spaces": "off",
|
||||
"no-native-reassign": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new-object": "off",
|
||||
|
@ -23,7 +18,6 @@ module.exports = {
|
|||
"no-redeclare": "off",
|
||||
"no-useless-call": "off",
|
||||
"no-useless-concat": "off",
|
||||
"no-useless-return": "off",
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"object-shorthand": "off",
|
||||
|
|
|
@ -334,7 +334,7 @@ var CastingApps = {
|
|||
break;
|
||||
}
|
||||
},
|
||||
onStopRequest: function(request, context, statusCode) {},
|
||||
onStopRequest: function(request, context, statusCode) {},
|
||||
onDataAvailable: function(request, context, stream, offset, count) {}
|
||||
};
|
||||
|
||||
|
@ -416,14 +416,12 @@ var CastingApps = {
|
|||
if (this.allowableMimeType(aType, aTypes)) {
|
||||
// We found a supported mimetype.
|
||||
aCallback({ element: aElement, source: sourceURI.spec, poster: posterURL, sourceURI: sourceURI, type: aType });
|
||||
} else {
|
||||
} else if (aURIs.length > 0) {
|
||||
// This URI was not a supported mimetype, so let's try the next, if we have more.
|
||||
if (aURIs.length > 0) {
|
||||
_getContentTypeForURIs(aURIs);
|
||||
} else {
|
||||
// We were not able to find a supported mimetype.
|
||||
aCallback(null);
|
||||
}
|
||||
_getContentTypeForURIs(aURIs);
|
||||
} else {
|
||||
// We were not able to find a supported mimetype.
|
||||
aCallback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ Linkifier.prototype = {
|
|||
node.parentNode.tagName != 'APPLET' &&
|
||||
node.parentNode.tagName != 'TEXTAREA')
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
else
|
||||
return NodeFilter.FILTER_REJECT;
|
||||
return NodeFilter.FILTER_REJECT;
|
||||
}
|
||||
|
||||
let nodeWalker = aDoc.createTreeWalker(aDoc.body, NodeFilter.SHOW_TEXT, filterNode, false);
|
||||
|
|
|
@ -156,7 +156,7 @@ var PluginHelper = {
|
|||
return;
|
||||
}
|
||||
|
||||
switch (eventType) {
|
||||
switch (eventType) {
|
||||
case "PluginClickToPlay": {
|
||||
// Check if plugins have already been activated for this page, or if
|
||||
// the user has set a permission to always play plugins on the site
|
||||
|
|
|
@ -297,7 +297,7 @@ var WebrtcUI = {
|
|||
|
||||
let uri = aContentWindow.document.documentURIObject;
|
||||
let host = uri.host;
|
||||
let requestor = BrowserApp.manifest ? "'" + BrowserApp.manifest.name + "'" : host;
|
||||
let requestor = BrowserApp.manifest ? "'" + BrowserApp.manifest.name + "'" : host;
|
||||
let message = Strings.browser.formatStringFromName("getUserMedia.share" + requestType + ".message", [ requestor ], 1);
|
||||
|
||||
let options = { inputs: [] };
|
||||
|
|
|
@ -81,7 +81,7 @@ function deferTransitionToRemoteAfterLoaded() {
|
|||
|
||||
function handleLoadedMessage(message) {
|
||||
loadedDeferred.resolve();
|
||||
};
|
||||
}
|
||||
|
||||
var wrapper = {
|
||||
iframe: null,
|
||||
|
|
|
@ -77,8 +77,8 @@
|
|||
else
|
||||
for (var i = 0; i < node.childNodes.length; i++)
|
||||
replaceWithHost(node.childNodes[i]);
|
||||
};
|
||||
replaceWithHost(intro);
|
||||
}
|
||||
replaceWithHost(intro);
|
||||
|
||||
if (getCSSClass() == "expertBadCert") {
|
||||
toggle('technicalContent');
|
||||
|
|
|
@ -166,7 +166,7 @@ var AboutReaderListener = {
|
|||
} else if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader ||
|
||||
!(content.document instanceof content.HTMLDocument) ||
|
||||
content.document.mozSyntheticDocument) {
|
||||
return;
|
||||
|
||||
} else {
|
||||
this.scheduleReadabilityCheckPostPaint(forceNonArticle);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ ImageBlockingPolicy.prototype = {
|
|||
let network = Cc["@mozilla.org/network/network-link-service;1"].getService(Ci.nsINetworkLinkService);
|
||||
return !(network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN ||
|
||||
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_ETHERNET ||
|
||||
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_USB ||
|
||||
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_USB ||
|
||||
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_WIFI);
|
||||
},
|
||||
|
||||
|
|
|
@ -388,8 +388,7 @@ LoginManagerPrompter.prototype = {
|
|||
if (formatArgs)
|
||||
return this._strBundle.pwmgr.formatStringFromName(
|
||||
key, formatArgs, formatArgs.length);
|
||||
else
|
||||
return this._strBundle.pwmgr.GetStringFromName(key);
|
||||
return this._strBundle.pwmgr.GetStringFromName(key);
|
||||
},
|
||||
|
||||
/*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
"use strict"
|
||||
|
||||
const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
|
||||
const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
|
||||
|
||||
const TOPIC_PRESENTATION_RECEIVER_LAUNCH = "presentation-receiver:launch";
|
||||
const TOPIC_PRESENTATION_RECEIVER_LAUNCH_RESPONSE = "presentation-receiver:launch:response";
|
||||
|
@ -61,7 +61,7 @@ PresentationRequestUIGlue.prototype = {
|
|||
case "error":
|
||||
aReject();
|
||||
break;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Services.obs.addObserver(handleObserve,
|
||||
|
|
|
@ -228,24 +228,21 @@ InternalPrompt.prototype = {
|
|||
// also, the nsIPrompt flavor has 5 args instead of 6.
|
||||
if (typeof arguments[2] == "object")
|
||||
return this.nsIPrompt_prompt.apply(this, arguments);
|
||||
else
|
||||
return this.nsIAuthPrompt_prompt.apply(this, arguments);
|
||||
return this.nsIAuthPrompt_prompt.apply(this, arguments);
|
||||
},
|
||||
|
||||
promptUsernameAndPassword: function promptUsernameAndPassword() {
|
||||
// Both have 6 args, so use types.
|
||||
if (typeof arguments[2] == "object")
|
||||
return this.nsIPrompt_promptUsernameAndPassword.apply(this, arguments);
|
||||
else
|
||||
return this.nsIAuthPrompt_promptUsernameAndPassword.apply(this, arguments);
|
||||
return this.nsIAuthPrompt_promptUsernameAndPassword.apply(this, arguments);
|
||||
},
|
||||
|
||||
promptPassword: function promptPassword() {
|
||||
// Both have 5 args, so use types.
|
||||
if (typeof arguments[2] == "object")
|
||||
return this.nsIPrompt_promptPassword.apply(this, arguments);
|
||||
else
|
||||
return this.nsIAuthPrompt_promptPassword.apply(this, arguments);
|
||||
return this.nsIAuthPrompt_promptPassword.apply(this, arguments);
|
||||
},
|
||||
|
||||
/* ---------- nsIPrompt ---------- */
|
||||
|
|
|
@ -199,7 +199,7 @@ class PageAction {
|
|||
this.tabContext.shutdown();
|
||||
this.hide();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.pageAction = class extends ExtensionAPI {
|
||||
onManifestEntry(entryName) {
|
||||
|
|
|
@ -271,7 +271,7 @@ this.FxAccountsWebChannel.prototype = {
|
|||
UITelemetry.addEvent("action.1", "content", null, "fxaccount-create");
|
||||
return success;
|
||||
});
|
||||
} else {
|
||||
}
|
||||
return Accounts.updateFirefoxAccountFromJSON(data).then(success => {
|
||||
if (!success) {
|
||||
throw new Error("Could not update Firefox Account!");
|
||||
|
@ -279,7 +279,7 @@ this.FxAccountsWebChannel.prototype = {
|
|||
UITelemetry.addEvent("action.1", "content", null, "fxaccount-login");
|
||||
return success;
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
.then(success => {
|
||||
if (!success) {
|
||||
|
|
|
@ -158,11 +158,11 @@ var HelperApps = {
|
|||
throw new Error("Intent:GetHandler did not return data");
|
||||
}
|
||||
return parseData(data);
|
||||
} else {
|
||||
}
|
||||
EventDispatcher.instance.sendRequestForResult(msg).then(function(data) {
|
||||
callback(parseData(data));
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
launchUri: function launchUri(uri) {
|
||||
|
|
|
@ -230,7 +230,7 @@ SharedPreferencesImpl.prototype = Object.freeze({
|
|||
|
||||
if (msg.scope !== this._scope ||
|
||||
((this._scope === Scope.PROFILE) && (msg.profileName !== this._profileName)) ||
|
||||
((this._scope === Scope.GLOBAL) && (msg.branch !== this._branch))) {
|
||||
((this._scope === Scope.GLOBAL) && (msg.branch !== this._branch))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ function promiseLinkVisit(url) {
|
|||
info("Visited URL " + uri.spec + " is desired URL " + url);
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
resolve();
|
||||
};
|
||||
}
|
||||
Services.obs.addObserver(observe, linkVisitedTopic);
|
||||
info("Now waiting for " + linkVisitedTopic + " notification from Gecko with URL " + url);
|
||||
});
|
||||
|
@ -88,5 +88,5 @@ function makeObserver(observerId) {
|
|||
};
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
|||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
};
|
||||
}
|
||||
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
Services.obs.removeObserver(search_observer, "browser-search-engine-modified");
|
||||
});
|
||||
Services.obs.addObserver(search_observer, "browser-search-engine-modified");
|
||||
|
|
|
@ -29,9 +29,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1214366
|
|||
type: "History:GetPrePathLastVisitedTimeMilliseconds",
|
||||
prePath: prePath,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var browser = BrowserApp.addTab("about:blank").browser;
|
||||
var browser = BrowserApp.addTab("about:blank").browser;
|
||||
|
||||
// It's useful to see *all* "link-visited" events in the face of intermittent failures.
|
||||
let observe = function(subject, topic, data) {
|
||||
|
@ -50,15 +50,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1214366
|
|||
function add_history_visit(url) {
|
||||
browser.loadURI(url, null, null);
|
||||
return promiseLinkVisit(url);
|
||||
};
|
||||
}
|
||||
|
||||
// Be aware that some paths under mochi.test and example.org redirect. The
|
||||
// blank robocop pages appear to not. Redirects can impact this test, since
|
||||
// they can write to the history database.
|
||||
// Be aware that some paths under mochi.test and example.org redirect. The
|
||||
// blank robocop pages appear to not. Redirects can impact this test, since
|
||||
// they can write to the history database.
|
||||
|
||||
// The apparent mis-ordering here just uses simpler pages (01 and 03) for the
|
||||
// real test, and a more complex page (02) for a final delay. See comment below.
|
||||
const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
|
||||
// The apparent mis-ordering here just uses simpler pages (01 and 03) for the
|
||||
// real test, and a more complex page (02) for a final delay. See comment below.
|
||||
const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
|
||||
const url2 = "http://example.org/tests/robocop/robocop_blank_03.html";
|
||||
const url3 = "http://example.org/tests/robocop/robocop_blank_02.html";
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
|||
is(service.modelName, "Eureka Dongle");
|
||||
|
||||
SimpleTest.finish();
|
||||
};
|
||||
}
|
||||
|
||||
var testDevice = {
|
||||
var testDevice = {
|
||||
id: "test:dummy",
|
||||
target: "test:service",
|
||||
factory: function(service) { /* dummy */ },
|
||||
factory: function(service) { },
|
||||
types: ["video/mp4"],
|
||||
extensions: ["mp4"]
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
|||
var testDevice = {
|
||||
id: "test:dummy",
|
||||
target: "test:service",
|
||||
factory: function(service) { /* dummy */ },
|
||||
factory: function(service) { },
|
||||
types: ["video/mp4", "video/webm"],
|
||||
extensions: ["mp4", "webm"]
|
||||
};
|
||||
|
|
|
@ -293,14 +293,12 @@ function _do_check_neq(left, right, stack, todo) {
|
|||
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
||||
" : " + stack.lineNumber + "] " + text + "\n");
|
||||
}
|
||||
} else {
|
||||
if (!todo) {
|
||||
} else if (!todo) {
|
||||
_dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
|
||||
stack.lineNumber + "] " + text + "\n");
|
||||
} else {
|
||||
do_throw_todo(text, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function do_check_neq(left, right, stack) {
|
||||
|
@ -325,14 +323,12 @@ function do_report_result(passed, text, stack, todo) {
|
|||
_dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
|
||||
stack.lineNumber + "] " + text + "\n");
|
||||
}
|
||||
} else {
|
||||
if (todo) {
|
||||
} else if (todo) {
|
||||
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
||||
" : " + stack.lineNumber + "] " + text + "\n");
|
||||
} else {
|
||||
do_throw(text, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -537,14 +533,14 @@ function pattern_matcher(pattern) {
|
|||
};
|
||||
} else if (pattern === undefined) {
|
||||
return function(value) { return true; };
|
||||
} else {
|
||||
}
|
||||
return function(value, diagnosis) {
|
||||
if (value !== pattern) {
|
||||
return explain(diagnosis, "pattern " + uneval(pattern) + " not === to value " + uneval(value));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Format an explanation for a pattern match failure, as stored in the
|
||||
|
@ -775,7 +771,7 @@ function JavaBridge(obj) {
|
|||
this._EventDispatcher.registerListener(this, this._EVENT_TYPE);
|
||||
|
||||
this._sendMessage("notify-loaded", []);
|
||||
};
|
||||
}
|
||||
|
||||
JavaBridge.prototype = {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Messaging.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
|
|
@ -59,7 +59,7 @@ function visitObserver(subject, topic, data) {
|
|||
let uri = subject.QueryInterface(Ci.nsIURI);
|
||||
do_print("Observer: " + uri.spec);
|
||||
gVisitURLs.push(uri.spec);
|
||||
};
|
||||
}
|
||||
|
||||
// Track the <browser> where the tests are happening
|
||||
var gBrowser;
|
||||
|
|
Загрузка…
Ссылка в новой задаче