From 25cdcbf331da3e2b3e08b3398d7731b47c789ff5 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Tue, 29 Aug 2017 11:31:07 +0200 Subject: [PATCH] Bug 1378342 - AbortSignal/AbortController - part 12 - eslint for dom/abort tests, r=me --- dom/abort/tests/.eslintrc.js | 20 +++++++++++++++++++ dom/abort/tests/file_abort_controller.html | 10 +++++----- .../tests/file_abort_controller_fetch.html | 12 +++++------ dom/abort/tests/test_abort_controller.html | 4 ++-- .../tests/test_abort_controller_fetch.html | 4 ++-- .../tests/worker_abort_controller_fetch.js | 6 +++--- 6 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 dom/abort/tests/.eslintrc.js diff --git a/dom/abort/tests/.eslintrc.js b/dom/abort/tests/.eslintrc.js new file mode 100644 index 000000000000..6ca30d5819fa --- /dev/null +++ b/dom/abort/tests/.eslintrc.js @@ -0,0 +1,20 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/browser-test", + "plugin:mozilla/chrome-test", + "plugin:mozilla/mochitest-test", + ], + "plugins": [ + "mozilla" + ], + "rules": { + "brace-style": "off", + "no-shadow": "off", + }, + "globals": { + "AbortController": true, + "AbortSignal": true + } +}; diff --git a/dom/abort/tests/file_abort_controller.html b/dom/abort/tests/file_abort_controller.html index 1f5a7f878e0b..a06fa3926597 100644 --- a/dom/abort/tests/file_abort_controller.html +++ b/dom/abort/tests/file_abort_controller.html @@ -23,15 +23,15 @@ function testWebIDL() { function testUpdateData() { var ac = new AbortController(); - + is(ac.signal.aborted, false, "By default AbortSignal.aborted is false"); - + ac.abort(); is(ac.signal.aborted, true, "Signal is aborted"); - + next(); } - + function testAbortEvent() { var ac = new AbortController(); ac.signal.onabort = function(e) { @@ -40,7 +40,7 @@ function testAbortEvent() { } ac.abort(); } - + var steps = [ // Simple stuff testWebIDL, diff --git a/dom/abort/tests/file_abort_controller_fetch.html b/dom/abort/tests/file_abort_controller_fetch.html index 208d442682c1..ea959fdca83b 100644 --- a/dom/abort/tests/file_abort_controller_fetch.html +++ b/dom/abort/tests/file_abort_controller_fetch.html @@ -11,7 +11,7 @@ function testAbortedFetch() { var ac = new AbortController(); ac.abort(); - fetch('slow.sjs', { signal: ac.signal }).then(() => { + fetch("slow.sjs", { signal: ac.signal }).then(() => { ok(false, "Fetch should not return a resolved promise"); }, e => { is(e.name, "AbortError", "We have an abort error"); @@ -21,7 +21,7 @@ function testAbortedFetch() { function testFetchAndAbort() { var ac = new AbortController(); - var p = fetch('slow.sjs', { signal: ac.signal }); + var p = fetch("slow.sjs", { signal: ac.signal }); ac.abort(); p.then(() => { @@ -32,21 +32,21 @@ function testFetchAndAbort() { } function testWorkerAbortedFetch() { - var w = new Worker('worker_abort_controller_fetch.js'); + var w = new Worker("worker_abort_controller_fetch.js"); w.onmessage = function(e) { ok(e.data, "Abort + Fetch works in workers"); next(); } - w.postMessage('testWorkerAbortedFetch'); + w.postMessage("testWorkerAbortedFetch"); } function testWorkerFetchAndAbort() { - var w = new Worker('worker_abort_controller_fetch.js'); + var w = new Worker("worker_abort_controller_fetch.js"); w.onmessage = function(e) { ok(e.data, "Abort + Fetch works in workers"); next(); } - w.postMessage('testWorkerFetchAndAbort'); + w.postMessage("testWorkerFetchAndAbort"); } var steps = [ diff --git a/dom/abort/tests/test_abort_controller.html b/dom/abort/tests/test_abort_controller.html index 6d2df1dcba65..2230dced357b 100644 --- a/dom/abort/tests/test_abort_controller.html +++ b/dom/abort/tests/test_abort_controller.html @@ -13,11 +13,11 @@