Bug 1857866 - Enable ESLint rule mozilla/reject-importGlobalProperties on all of dom/. r=dom-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D190434
This commit is contained in:
Mark Banner 2023-10-12 16:49:47 +00:00
parent 9fe5c005d6
commit 3ad8e86d7c
18 changed files with 14 additions and 14 deletions

View File

@ -434,7 +434,6 @@ module.exports = {
"mozilla/avoid-removeChild": "off",
"mozilla/consistent-if-bracing": "off",
"mozilla/no-compare-against-boolean-literals": "off",
"mozilla/reject-importGlobalProperties": "off",
"mozilla/use-includes-instead-of-indexOf": "off",
"mozilla/use-ownerGlobal": "off",
"mozilla/use-services": "off",

View File

@ -1,7 +1,5 @@
/* eslint-env mozilla/chrome-script */
Cu.importGlobalProperties(["File"]);
var testFile = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIDirectoryService)
.QueryInterface(Ci.nsIProperties)

View File

@ -1,6 +1,7 @@
/* eslint-env mozilla/chrome-script */
var file;
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.create", function (message) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
function createFileWithData(message) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
var tmpFile;

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.open", function () {

View File

@ -10,7 +10,6 @@ add_task(async function test_CtoPtoC_big() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
let blob = new Blob([new Array(1024 * 1024).join("123456789ABCDEF")]);
return blob;
});
@ -47,7 +46,6 @@ add_task(async function test_CtoPtoC_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
let blob = new Blob(["hello world!"]);
return blob;
});
@ -80,7 +78,6 @@ add_task(async function test_CtoPtoC_bc_big() {
let browser1 = gBrowser.getBrowserForTab(tab1);
await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
var bc = new content.BroadcastChannel("test");
bc.onmessage = function () {
bc.postMessage(
@ -119,7 +116,6 @@ add_task(async function test_CtoPtoC_bc_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
var bc = new content.BroadcastChannel("test");
bc.onmessage = function () {
bc.postMessage(new Blob(["hello world!"]));
@ -156,7 +152,6 @@ add_task(async function test_CtoPtoC_bc_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blobURL = await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
return content.URL.createObjectURL(new content.Blob(["hello world!"]));
});
@ -191,7 +186,6 @@ add_task(async function test_CtoPtoC_multipart() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await SpecialPowers.spawn(browser1, [], function () {
Cu.importGlobalProperties(["Blob"]);
return new Blob(["!"]);
});
@ -204,7 +198,6 @@ add_task(async function test_CtoPtoC_multipart() {
let browser2 = gBrowser.getBrowserForTab(tab2);
let status = await SpecialPowers.spawn(browser2, [newBlob], function (blob) {
Cu.importGlobalProperties(["Blob"]);
return new Promise(resolve => {
let fr = new content.FileReader();
fr.readAsText(new Blob(["hello ", blob]));
@ -226,8 +219,6 @@ add_task(async function test_CtoPsize_multipart() {
let browser = gBrowser.getBrowserForTab(tab);
let blob = await SpecialPowers.spawn(browser, [], function () {
Cu.importGlobalProperties(["Blob"]);
let data = new Array(1024 * 512).join("A");
let blob1 = new Blob([data]);
let blob2 = new Blob([data]);

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.open", function (e) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("create-file-objects", function (message) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
function createFileWithData(fileData) {

View File

@ -43,6 +43,7 @@ async function runTest(doNewTab) {
fileBrowser,
[TEST_HTTP_POST, filePaths, doNewTab],
(actionUri, filePaths, doNewTab) => {
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
let doc = content.document;

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("files.open", function (message) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.open", function (e) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
var file;

View File

@ -43,8 +43,6 @@ if (!this.runTest) {
enableStorageTesting();
enableTesting();
Cu.importGlobalProperties(["indexedDB", "File", "Blob", "FileReader"]);
// In order to support converting tests to using async functions from using
// generator functions, we detect async functions by checking the name of
// function's constructor.

View File

@ -4,6 +4,7 @@ const { NetUtil } = ChromeUtils.importESModule(
"resource://gre/modules/NetUtil.sys.mjs"
);
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["TextDecoder"]);
const reportURI = "http://mochi.test:8888/foo.sjs";

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.open", function (e) {

View File

@ -1,5 +1,6 @@
/* eslint-env mozilla/chrome-script */
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File"]);
addMessageListener("file.open", function (e) {