summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/XMLHttpRequest/status-error.htm
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/XMLHttpRequest/status-error.htm
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/XMLHttpRequest/status-error.htm')
-rw-r--r--testing/web-platform/tests/XMLHttpRequest/status-error.htm60
1 files changed, 60 insertions, 0 deletions
diff --git a/testing/web-platform/tests/XMLHttpRequest/status-error.htm b/testing/web-platform/tests/XMLHttpRequest/status-error.htm
new file mode 100644
index 000000000..fbcb7fd75
--- /dev/null
+++ b/testing/web-platform/tests/XMLHttpRequest/status-error.htm
@@ -0,0 +1,60 @@
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: status error handling</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onerror" data-tested-assertations="../.." />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="/following::ol/li[3]" />
+ </head>
+ <body>
+ <p>This shouldn't be tested inside a tunnel.</p>
+ <div id="log"></div>
+ <script>
+ function noError(method, code) {
+ var test = async_test(document.title + " " + method + " " + code)
+
+ test.step(function() {
+ var client = new XMLHttpRequest()
+ client.open(method, "resources/status.py?code=" + code, true)
+
+ client.onreadystatechange = test.step_func(function() {
+ assert_equals(client.response, "", "response data")
+ assert_equals(client.status, code, "response status")
+
+ if (client.readyState == client.DONE)
+ /* Give extra time for a bogus error event to pop up */
+ setTimeout(test.step_func(function() { test.done() } ), 100)
+ })
+ client.onerror = test.step_func(function() {
+ assert_unreached("HTTP error should not throw error event")
+ })
+ client.send()
+ })
+ }
+
+ noError('GET', 200)
+ noError('GET', 400)
+ noError('GET', 401)
+ noError('GET', 404)
+ noError('GET', 410)
+ noError('GET', 500)
+ noError('GET', 699)
+
+ noError('HEAD', 200)
+ noError('HEAD', 404)
+ noError('HEAD', 500)
+ noError('HEAD', 699)
+
+ noError('POST', 200)
+ noError('POST', 404)
+ noError('POST', 500)
+ noError('POST', 699)
+
+ noError('PUT', 200)
+ noError('PUT', 404)
+ noError('PUT', 500)
+ noError('PUT', 699)
+ </script>
+ </body>
+</html>