diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/xhr/send-timeout-events.htm | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/xhr/send-timeout-events.htm')
-rw-r--r-- | testing/web-platform/tests/xhr/send-timeout-events.htm | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/send-timeout-events.htm b/testing/web-platform/tests/xhr/send-timeout-events.htm new file mode 100644 index 0000000000..eae2568107 --- /dev/null +++ b/testing/web-platform/tests/xhr/send-timeout-events.htm @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <title>XMLHttpRequest: The send() method: timeout is not 0 </title> +</head> + +<body> + <div id="log"></div> + + <script type="text/javascript"> + async_test(t => { + const xhr = new XMLHttpRequest(), + expect = [4, "", "upload.timeout", "upload.loadend", "timeout", "loadend"]; + let actual = []; + + xhr.onreadystatechange = t.step_func(() => { + if (xhr.readyState == 4) { + actual.push(xhr.readyState, xhr.response); + } + }); + + xhr.onloadend = t.step_func_done(e => { + assert_equals(e.loaded, 0); + assert_equals(e.total, 0); + actual.push(e.type); + assert_array_equals(actual, expect); + }); + + xhr.ontimeout = t.step_func(e => { + assert_equals(e.loaded, 0); + assert_equals(e.total, 0); + actual.push(e.type); + }); + + + xhr.upload.onloadend = t.step_func(e => { + assert_equals(e.loaded, 0); + assert_equals(e.total, 0); + actual.push("upload." + e.type); + }); + + xhr.upload.ontimeout = t.step_func(e => { + assert_equals(e.loaded, 0); + assert_equals(e.total, 0); + actual.push("upload." + e.type); + }); + + + let content = ""; + for (var i = 0; i < 121026; i++) { + content += "[" + i + "]"; + } + + xhr.open("POST", "./resources/trickle.py", true); + xhr.timeout = 1; + xhr.send(content); + }); + </script> +</body> +</html> |