summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js')
-rw-r--r--testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js b/testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js
new file mode 100644
index 0000000000..e6c0213928
--- /dev/null
+++ b/testing/web-platform/tests/service-workers/service-worker/fetch-request-xhr-sync-error.https.window.js
@@ -0,0 +1,19 @@
+// META: script=resources/test-helpers.sub.js
+
+"use strict";
+
+promise_test(async t => {
+ const url = "resources/fetch-request-xhr-sync-error-worker.js";
+ const scope = "resources/fetch-request-xhr-sync-iframe.html";
+
+ const registration = await service_worker_unregister_and_register(t, url, scope);
+ t.add_cleanup(() => registration.unregister());
+
+ await wait_for_state(t, registration.installing, 'activated');
+ const frame = await with_iframe(scope);
+ t.add_cleanup(() => frame.remove());
+
+ assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-1.txt"));
+ assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-2.txt"));
+ assert_throws_dom("NetworkError", frame.contentWindow.DOMException, () => frame.contentWindow.performSyncXHR("non-existent-stream-3.txt"));
+}, "Verify synchronous XMLHttpRequest always throws a NetworkError for ReadableStream errors");