Bug 1786104 - Enable all ESLint rules on dom production files. r=smaug

This changes the block of disabled rules for dom to only reference test directories,
and then fixes the few failures in the two production files (rules: mozilla/use-services,
no-else-return, consistent-return).

Differential Revision: https://phabricator.services.mozilla.com/D155130
This commit is contained in:
Mark Banner 2022-08-21 18:19:44 +00:00
Родитель c80542b1a8
Коммит da48e321ec
3 изменённых файлов: 38 добавлений и 52 удалений

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

@ -278,29 +278,29 @@ module.exports = {
},
{
files: [
"dom/animation/**",
"dom/animation/test/**",
"dom/base/test/*.*",
"dom/base/test/unit/test_serializers_entities*.js",
"dom/base/test/unit_ipc/**",
"dom/base/test/jsmodules/**",
"dom/base/*.*",
"dom/canvas/**",
"dom/encoding/**",
"dom/events/**",
"dom/fetch/**",
"dom/file/**",
"dom/html/**",
"dom/jsurl/**",
"dom/canvas/test/**",
"dom/encoding/test/**",
"dom/events/test/**",
"dom/fetch/tests/**",
"dom/file/ipc/tests/**",
"dom/file/tests/**",
"dom/html/test/**",
"dom/jsurl/test/**",
"dom/media/tests/**",
"dom/media/webaudio/**",
"dom/media/webaudio/test/**",
"dom/media/webrtc/tests/**",
"dom/media/webspeech/**",
"dom/messagechannel/**",
"dom/midi/**",
"dom/network/**",
"dom/payments/**",
"dom/performance/**",
"dom/permission/**",
"dom/media/webspeech/recognition/test/**",
"dom/media/webspeech/synth/test/**",
"dom/messagechannel/tests/**",
"dom/midi/tests/**",
"dom/network/tests/**",
"dom/payments/test/**",
"dom/performance/tests/**",
"dom/quota/test/browser/**",
"dom/quota/test/common/**",
"dom/quota/test/mochitest/**",
@ -308,19 +308,19 @@ module.exports = {
"dom/security/test/cors/**",
"dom/security/test/csp/**",
"dom/security/test/mixedcontentblocker/**",
"dom/serviceworkers/**",
"dom/smil/**",
"dom/serviceworkers/test/**",
"dom/smil/test/**",
"dom/tests/mochitest/**",
"dom/u2f/**",
"dom/vr/**",
"dom/webauthn/**",
"dom/webgpu/**",
"dom/websocket/**",
"dom/workers/**",
"dom/worklet/**",
"dom/xml/**",
"dom/xslt/**",
"dom/xul/**",
"dom/u2f/tests/**",
"dom/vr/test/**",
"dom/webauthn/tests/**",
"dom/webgpu/mochitest/**",
"dom/websocket/tests/**",
"dom/workers/test/**",
"dom/worklet/tests/**",
"dom/xml/test/**",
"dom/xslt/tests/**",
"dom/xul/test/**",
"dom/ipc/test.xhtml",
],
rules: {

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

@ -142,9 +142,7 @@ ContentAreaDropListener.prototype = {
}
let uri = info.fixedURI;
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
Ci.nsIScriptSecurityManager
);
let secMan = Services.scriptSecurityManager;
let flags = secMan.STANDARD;
if (disallowInherit) {
flags |= secMan.DISALLOW_INHERIT_PRINCIPAL;
@ -190,22 +188,13 @@ ContentAreaDropListener.prototype = {
// TODO: Investigate and describe the difference between them,
// or use only one principal. (Bug 1367038)
if (fallbackToSystemPrincipal) {
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
Ci.nsIScriptSecurityManager
);
return secMan.getSystemPrincipal();
} else {
principalURISpec = "file:///";
return Services.scriptSecurityManager.getSystemPrincipal();
}
principalURISpec = "file:///";
}
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(
Ci.nsIIOService
);
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
Ci.nsIScriptSecurityManager
);
return secMan.createContentPrincipal(
ioService.newURI(principalURISpec),
return Services.scriptSecurityManager.createContentPrincipal(
Services.io.newURI(principalURISpec),
{}
);
},

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

@ -79,9 +79,8 @@ DOMRequestIpcHelper.prototype = {
if (!!aMsg.weakRef == this._listeners[name].weakRef) {
this._listeners[name].count++;
return;
} else {
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
throw Components.Exception("", Cr.NS_ERROR_FAILURE);
}
aMsg.weakRef
@ -228,6 +227,7 @@ DOMRequestIpcHelper.prototype = {
if (this._requests && this._requests[aId]) {
return this._requests[aId];
}
return undefined;
},
getPromiseResolver(aId) {
@ -264,10 +264,7 @@ DOMRequestIpcHelper.prototype = {
},
_getRandomId() {
return Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator)
.generateUUID()
.toString();
return Services.uuid.generateUUID().toString();
},
createRequest() {