From 059c1179f137a6666f6194e4e0c9fef42b87e32d Mon Sep 17 00:00:00 2001 From: Shashank Kaushik Date: Sun, 15 Sep 2019 13:07:10 +0000 Subject: [PATCH] Bug 1532933 - Enable ESLint for dom/xhr (manual changes). r=Standard8,baku Depends on D45680 Differential Revision: https://phabricator.services.mozilla.com/D45683 --HG-- extra : moz-landing-system : lando --- .eslintignore | 1 - dom/xhr/tests/browser_blobFromFile.js | 9 ++---- dom/xhr/tests/browser_temporaryFile.js | 6 ++-- dom/xhr/tests/browser_xhr_onchange_leak.js | 3 +- dom/xhr/tests/common_temporaryFileBlob.js | 2 ++ ...e_sync_xhr_document_write_with_iframe.html | 1 + dom/xhr/tests/relativeLoad_worker.js | 14 +++++---- dom/xhr/tests/relativeLoad_worker2.js | 2 ++ .../tests/subdir/relativeLoad_sub_worker.js | 8 +++-- .../tests/subdir/relativeLoad_sub_worker2.js | 2 ++ dom/xhr/tests/terminateSyncXHR_worker.js | 2 +- dom/xhr/tests/test_XHR.html | 16 +++++----- dom/xhr/tests/test_XHRDocURI.html | 2 +- dom/xhr/tests/test_XHRSendData.html | 22 +++++++------- dom/xhr/tests/test_XHR_parameters.html | 2 +- dom/xhr/tests/test_event_listener_leaks.html | 1 + dom/xhr/tests/test_relativeLoad.html | 4 +-- dom/xhr/tests/test_worker_xhr.html | 12 +++++--- dom/xhr/tests/test_worker_xhr_parameters.html | 6 ++-- dom/xhr/tests/test_worker_xhr_parameters.js | 2 +- dom/xhr/tests/test_worker_xhr_system.html | 6 ++-- dom/xhr/tests/test_xhr_forbidden_headers.html | 8 ++--- dom/xhr/tests/test_xhr_progressevents.html | 8 ++--- dom/xhr/tests/test_xhr_send.html | 4 +-- dom/xhr/tests/test_xhr_withCredentials.html | 2 +- dom/xhr/tests/window_worker_xhr_3rdparty.html | 12 +++++--- dom/xhr/tests/worker_temporaryFileBlob.js | 1 + dom/xhr/tests/xhr2_worker.js | 6 ++-- dom/xhr/tests/xhrAbort_worker.js | 2 ++ dom/xhr/tests/xhr_worker.js | 30 +++++++++++-------- 30 files changed, 112 insertions(+), 84 deletions(-) diff --git a/.eslintignore b/.eslintignore index 923923d4e725..c779e7a76d41 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,7 +14,6 @@ obj*/ # dom/ exclusions which should be removed (aka ESLint enabled) dom/media/test/ !dom/media/test/marionette/yttest/*.js -dom/xhr/ # build/ third-party code build/pgo/js-input/ diff --git a/dom/xhr/tests/browser_blobFromFile.js b/dom/xhr/tests/browser_blobFromFile.js index 19a0a8eb87bd..f00e1d9c16f9 100644 --- a/dom/xhr/tests/browser_blobFromFile.js +++ b/dom/xhr/tests/browser_blobFromFile.js @@ -8,10 +8,7 @@ add_task(async function test() { fileData += "hello world!"; } - let file = Cc["@mozilla.org/file/directory_service;1"] - .getService(Ci.nsIDirectoryService) - .QueryInterface(Ci.nsIProperties) - .get("ProfD", Ci.nsIFile); + let file = Services.dirsvc.get("ProfD", Ci.nsIFile); file.append("file.txt"); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600); @@ -21,14 +18,14 @@ add_task(async function test() { outStream.init( file, 0x02 | 0x08 | 0x20, // write, create, truncate + // eslint-disable-next-line no-octal 0666, 0 ); outStream.write(fileData, fileData.length); outStream.close(); - let fileHandler = Cc["@mozilla.org/network/io-service;1"] - .getService(Ci.nsIIOService) + let fileHandler = Services.io .getProtocolHandler("file") .QueryInterface(Ci.nsIFileProtocolHandler); diff --git a/dom/xhr/tests/browser_temporaryFile.js b/dom/xhr/tests/browser_temporaryFile.js index b66426dbeaab..eaa3f46dd951 100644 --- a/dom/xhr/tests/browser_temporaryFile.js +++ b/dom/xhr/tests/browser_temporaryFile.js @@ -7,7 +7,7 @@ add_task(async _ => { ); xhr.responseType = "blob"; xhr.send(""); - xhr.onloadend = _ => { + xhr.onloadend = __ => { is(xhr.response.blobImplType, "EmptyBlobImpl", "We want a EmptyBlobImpl"); resolve(); }; @@ -29,7 +29,7 @@ add_task(async _ => { return data; }, }); - xhr.onloadend = _ => { + xhr.onloadend = __ => { is( xhr.response.blobImplType, "MemoryBlobImpl", @@ -59,7 +59,7 @@ add_task(async _ => { return data; }, }); - xhr.onloadend = _ => { + xhr.onloadend = __ => { is( xhr.response.blobImplType, "StreamBlobImpl[TemporaryBlobImpl]", diff --git a/dom/xhr/tests/browser_xhr_onchange_leak.js b/dom/xhr/tests/browser_xhr_onchange_leak.js index 7d6fba2b558c..26884cc4df0a 100644 --- a/dom/xhr/tests/browser_xhr_onchange_leak.js +++ b/dom/xhr/tests/browser_xhr_onchange_leak.js @@ -12,8 +12,7 @@ add_task(async function test() { "http://mochi.test:8888/browser/dom/xhr/tests/browser_xhr_onchange_leak.html"; let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url); let browser = gBrowser.selectedBrowser; - let done = await ContentTask.spawn(browser, {}, async function(browser) { - let doc = content.document; + let done = await ContentTask.spawn(browser, {}, async function() { let promise = ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true); content.location = "http://example.org/"; await promise; diff --git a/dom/xhr/tests/common_temporaryFileBlob.js b/dom/xhr/tests/common_temporaryFileBlob.js index 0863bd31a571..9bcbe04f08f2 100644 --- a/dom/xhr/tests/common_temporaryFileBlob.js +++ b/dom/xhr/tests/common_temporaryFileBlob.js @@ -1,3 +1,5 @@ +// This file expects next() to be defined in the scope it is imported into. +/* global next */ var data = new Array(256).join("1234567890ABCDEF"); function createXHR() { diff --git a/dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html b/dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html index 060389427940..2135011d9c68 100644 --- a/dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html +++ b/dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html @@ -13,6 +13,7 @@ addEventListener('load', evt => { document.write( '' + '' + + // eslint-disable-next-line no-useless-concat ' + Mozilla Bug 308484