diff options
author | Moonchild <moonchild@palemoon.org> | 2020-06-10 21:33:28 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-06-13 11:51:30 +0200 |
commit | 9e2da53a02356244c5dc0a3e7b7ec916740d3d51 (patch) | |
tree | 098aa27ce9fbcc0371e4f1bb52fac0f5541d7702 /dom/tests/mochitest/fetch | |
parent | 2b41c85019bd5fd7e62556b5d5bf6ace2a6d6963 (diff) | |
download | UXP-9e2da53a02356244c5dc0a3e7b7ec916740d3d51.tar UXP-9e2da53a02356244c5dc0a3e7b7ec916740d3d51.tar.gz UXP-9e2da53a02356244c5dc0a3e7b7ec916740d3d51.tar.lz UXP-9e2da53a02356244c5dc0a3e7b7ec916740d3d51.tar.xz UXP-9e2da53a02356244c5dc0a3e7b7ec916740d3d51.zip |
Issue #1587 - Part 2: Implement controller follow/unfollow
Diffstat (limited to 'dom/tests/mochitest/fetch')
-rw-r--r-- | dom/tests/mochitest/fetch/file_fetch_controller.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/tests/mochitest/fetch/file_fetch_controller.html b/dom/tests/mochitest/fetch/file_fetch_controller.html index 6efa2fe0a..791d21b2b 100644 --- a/dom/tests/mochitest/fetch/file_fetch_controller.html +++ b/dom/tests/mochitest/fetch/file_fetch_controller.html @@ -21,8 +21,76 @@ function testWebIDL() { next(); } +function testUpdateData() { + var fc = new FetchController(); + + is(fc.signal.aborted, false, "By default FetchSignal.aborted is false"); + + fc.abort(); + is(fc.signal.aborted, true, "Signal is aborted"); + + next(); +} + +function testFollowingOurself() { + // Let's follow ourself + var fc = new FetchController(); + fc.follow(fc.signal); + + fc.abort(); + is(fc.signal.aborted, true, "Signal is aborted"); + + next(); +} + +function testFollowingOther() { + // Let's follow another one + var fc1 = new FetchController(); + var fc2 = new FetchController(); + fc1.follow(fc2.signal); + + fc2.abort(); + + is(fc1.signal.aborted, true, "Signal is aborted"); + is(fc2.signal.aborted, true, "Signal is aborted"); + + next(); +} + +function testFollowingLoop() { + // fc1 -> fc2 -> fc3 -> fc1 + var fc1 = new FetchController(); + var fc2 = new FetchController(); + var fc3 = new FetchController(); + fc1.follow(fc2.signal); + fc2.follow(fc3.signal); + fc3.follow(fc1.signal); + + fc3.abort(); + + is(fc1.signal.aborted, true, "Signal is aborted"); + is(fc2.signal.aborted, true, "Signal is aborted"); + is(fc3.signal.aborted, true, "Signal is aborted"); + + next(); +} + +function testAbortEvent() { + var fc = new FetchController(); + fc.signal.onabort = function(e) { + is(e.type, "abort", "Abort received"); + next(); + } + fc.abort(); +} + var steps = [ testWebIDL, + testUpdateData, + testFollowingOurself, + testFollowingOther, + testFollowingLoop, + testAbortEvent, ]; function next() { |