summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js')
-rw-r--r--testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js b/testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js
new file mode 100644
index 0000000000..1e37f43f37
--- /dev/null
+++ b/testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method-async.any.js
@@ -0,0 +1,17 @@
+// META: title=Tests cross-origin async request with non-CORS-safelisted method
+// META: script=/common/get-host-info.sub.js
+
+ async_test((test) => {
+ const xhr = new XMLHttpRequest;
+
+ xhr.onload = test.step_func_done(() => {
+ assert_equals(xhr.responseText, "PASS: Cross-domain access allowed.\nPASS: PUT data received");
+ });
+
+ xhr.onerror = test.unreached_func("Unexpected error.");
+
+ xhr.open("PUT", get_host_info().HTTP_REMOTE_ORIGIN +
+ "/xhr/resources/access-control-basic-put-allow.py");
+ xhr.setRequestHeader("Content-Type", "text/plain; charset=UTF-8");
+ xhr.send("PASS: PUT data received");
+ }, "Allow async PUT request");