Bug 1433175 - enable the use-cc-etc eslint rule, r=Standard8.

This commit is contained in:
Florian Quèze 2018-02-28 18:51:35 +01:00
Родитель f3ee8dd20b
Коммит 8922be9c58
15 изменённых файлов: 28 добавлений и 52 удалений

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

@ -64,26 +64,6 @@ module.exports = {
"varsIgnorePattern": "^EXPORTED_SYMBOLS$"
}]
}
}, {
// XXX Bug 1433175. These directories are still being fixed, so turn off
// mozilla/use-cc-etc for now.
"files": [
"accessible/**",
"browser/**",
"devtools/**",
"dom/**",
"extensions/pref/**",
"mobile/android/**",
"security/manager/**",
"services/**",
"storage/test/**",
"testing/**",
"toolkit/**",
"xpcom/**",
],
"rules": {
"mozilla/use-cc-etc": "off",
}
}, {
// XXX Bug 1436303. These directories are still being fixed, so turn off
// mozilla/no-cc-etc for now.

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

@ -4,8 +4,6 @@
"use strict";
/* globals InspectorUtils */
/*
* This is an xpcshell script that runs to generate a static list of CSS properties
* as known by the platform. It is run from ./mach_commands.py by running
@ -13,8 +11,7 @@
*/
var {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
var {generateCssProperties} = require("devtools/server/actors/css-properties");
Components.utils.importGlobalProperties(["InspectorUtils"]);
const InspectorUtils = require("InspectorUtils");
// xpcshell can output extra information, so place some delimiter text between
// the output of the css properties database.

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

@ -22,8 +22,7 @@
const {PSEUDO_ELEMENTS, CSS_PROPERTIES, PREFERENCES} = require("devtools/shared/css/generated/properties-db");
const {generateCssProperties} = require("devtools/server/actors/css-properties");
const {Preferences} = require("resource://gre/modules/Preferences.jsm");
Components.utils.importGlobalProperties(["InspectorUtils"]);
const InspectorUtils = require("InspectorUtils");
function run_test() {
const propertiesErrorMessage = "If this assertion fails, then the client side CSS " +

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

@ -109,6 +109,7 @@ function verifyBuffers(buffer1, buffer2)
function verifyBlob(blob1, blob2, fileId, blobReadHandler)
{
// eslint-disable-next-line mozilla/use-cc-etc
is(blob1 instanceof Components.interfaces.nsIDOMBlob, true,
"Instance of nsIDOMBlob");
is(blob1 instanceof File, blob2 instanceof File,

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

@ -24,6 +24,7 @@
* for more information.
*/
/* eslint-disable mozilla/use-cc-etc */
/* eslint-disable mozilla/use-chromeutils-import */
var _quit = false;

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

@ -8,7 +8,7 @@
/* eslint "mozilla/use-chromeutils-import": ["error", {allowCu: true}] */
// eslint-disable-next-line mozilla/no-define-cc-etc
const Cu = Components.utils;
const Cu = Components.utils; // eslint-disable-line mozilla/use-cc-etc
const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});

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

@ -1924,6 +1924,7 @@ function run_FunctionType_tests() {
Assert.equal(t4_t.name, "char*(*(**[][8])(int32_t, g_t(*)()))[]");
// Not available in a Worker
// eslint-disable-next-line mozilla/use-cc-etc
if ("@mozilla.org/systemprincipal;1" in Components.classes) {
var sp = Cc["@mozilla.org/systemprincipal;1"].
createInstance(Ci.nsIPrincipal);

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

@ -42,8 +42,8 @@
// capability, so using |overflow: hidden| is not an option.
// Instead, we are inserting a user agent stylesheet that is
// capable of selecting scrollbars, and do |display: none|.
var domWinUtls = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var domWinUtls = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
// Create a DatePicker instance and prepare to be
// initialized by the "DatePickerInit" event from datetimepopup.xml

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

@ -26,8 +26,8 @@
// capability, so using |overflow: hidden| is not an option.
// Instead, we are inserting a user agent stylesheet that is
// capable of selecting scrollbars, and do |display: none|.
var domWinUtls = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var domWinUtls = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
// Create a TimePicker instance and prepare to be
// initialized by the "TimePickerInit" event from timepicker.xml

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

@ -604,8 +604,7 @@
</property>
<field name="mPrefs" readonly="true">
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
</field>
<field name="_mStrBundle">null</field>

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

@ -1605,55 +1605,55 @@
<method name="setFieldValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="clearInputFields">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="setFieldsFromInputValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="setInputValueFromFields">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="setFieldsFromPicker">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="handleKeypress">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="handleKeyboardNav">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="getCurrentValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="isAnyFieldAvailable">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>

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

@ -459,7 +459,7 @@
<handler event="focus" phase="capturing">
var btn = this.getButton(this.defaultButton);
if (btn)
btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Components.interfaces.nsIDOMXULButtonElement));
btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Ci.nsIDOMXULButtonElement));
</handler>
#endif
</handlers>

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

@ -33,7 +33,7 @@
<property name="parentContainer" readonly="true">
<getter>
for (var parent = this.parentNode; parent; parent = parent.parentNode) {
if (parent instanceof Components.interfaces.nsIDOMXULContainerElement)
if (parent instanceof Ci.nsIDOMXULContainerElement)
return parent;
}
return null;

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

@ -205,18 +205,14 @@
case "window": this._eventNode = window; break;
case "document": this._eventNode = document; break;
}
const nsIEventListenerService =
Components.interfaces.nsIEventListenerService;
let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
.getService(nsIEventListenerService);
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
els.addSystemEventListener(this._eventNode, "keydown", this, false);
</constructor>
<destructor>
const nsIEventListenerService =
Components.interfaces.nsIEventListenerService;
let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
.getService(nsIEventListenerService);
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
els.removeSystemEventListener(this._eventNode, "keydown", this, false);
</destructor>
</implementation>

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

@ -45,9 +45,11 @@
/* global setImmediate:false */
/* eslint-disable mozilla/no-define-cc-etc */
/* eslint-disable mozilla/use-cc-etc */
var Cu = this.require ? require("chrome").Cu : Components.utils;
var Cc = this.require ? require("chrome").Cc : Components.classes;
var Ci = this.require ? require("chrome").Ci : Components.interfaces;
/* eslint-enable mozilla/use-cc-etc */
/* eslint-enable mozilla/no-define-cc-etc */
// If we can access Components, then we use it to capture an async
// parent stack trace; see scheduleWalkerLoop. However, as it might