diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/workers/shared-worker-options-mismatch.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/workers/shared-worker-options-mismatch.html')
-rw-r--r-- | testing/web-platform/tests/workers/shared-worker-options-mismatch.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/shared-worker-options-mismatch.html b/testing/web-platform/tests/workers/shared-worker-options-mismatch.html new file mode 100644 index 0000000000..604f69a436 --- /dev/null +++ b/testing/web-platform/tests/workers/shared-worker-options-mismatch.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<title>SharedWorker: type or credentials mismatch failure</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +const mismatch_test = (testName, firstOptions, secondOptions) => { + promise_test(async () => { + firstOptions.name = testName; + secondOptions.name = testName; + const scriptURL = 'support/empty-worker.js'; + const firstWorker = new SharedWorker(scriptURL, firstOptions); + const secondWorker = new SharedWorker(scriptURL, secondOptions); + return new Promise(resolve => secondWorker.onerror = resolve); + }, 'Connecting to shared worker with different options should be blocked: ' + + testName); +}; + +// Tests different type. +mismatch_test('default to module', {}, { type: 'module' }); +mismatch_test('module to default', { type: 'module' }, {}); +mismatch_test('classic to module', { type: 'classic' }, { type: 'module' }); +mismatch_test('module to classic', { type: 'module' }, { type: 'classic' }); + +// Tests different credentials in classic and module. +['classic', 'module'].forEach(type => { + mismatch_test('default to omit in ' + type, + { type }, + { type, credentials: 'omit' }); + mismatch_test('default to include in ' + type, + { type }, + { type, credentials: 'include' }); + mismatch_test('omit to default in ' + type, + { type, credentials: 'omit' }, + { type }); + mismatch_test('omit to same-origin in ' + type, + { type, credentials: 'omit' }, + { type, credentials: 'same-origin' }); + mismatch_test('omit to include in ' + type, + { type, credentials: 'omit' }, + { type, credentials: 'include' }); + mismatch_test('same-origin to omit in ' + type, + { type, credentials: 'same-origin'}, + { type, credentials: 'omit' }); + mismatch_test('same-origin to include in ' + type, + { type, credentials: 'same-origin'}, + { type, credentials: 'include' }); + mismatch_test('include to default in ' + type, + { type, credentials: 'include' }, + { type }); + mismatch_test('include to omit in ' + type, + { type, credentials: 'include' }, + { type, credentials: 'omit' }); + mismatch_test('include to same-origin in ' + type, + { type, credentials: 'include' }, + { type, credentials: 'same-origin' }); +}); + +</script> |