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/webmessaging/with-options | |
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/webmessaging/with-options')
9 files changed, 120 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webmessaging/with-options/broken-origin.html b/testing/web-platform/tests/webmessaging/with-options/broken-origin.html new file mode 100644 index 0000000000..795404b0ec --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/broken-origin.html @@ -0,0 +1,12 @@ +<!doctype html> +<title>resolving broken url</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + assert_throws_dom('SYNTAX_ERR', function() { + postMessage('', {targetOrigin: 'http://foo bar'}); + }, 'should have failed to resolve'); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/host-specific-origin.html b/testing/web-platform/tests/webmessaging/with-options/host-specific-origin.html new file mode 100644 index 0000000000..5003bcc807 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/host-specific-origin.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>resolving url with stuff in host-specific</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + postMessage('', {targetOrigin: location.protocol + '//' + location.host + '//'}); + onmessage = this.step_func(function(e) { + assert_equals(e.origin, location.protocol + '//' + location.host); + this.done(); + }); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/message-channel-transferable.html b/testing/web-platform/tests/webmessaging/with-options/message-channel-transferable.html new file mode 100644 index 0000000000..d42db10695 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/message-channel-transferable.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>message channel as ports</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +async_test(function(t) { + var channel = new MessageChannel(); + postMessage('', {targetOrigin: '*', transfer: [channel.port1, channel.port2]}); + onmessage = t.step_func(function(e) { + assert_equals(e.ports.length, 2); + t.done(); + }); +}, "MessageChannel's ports as MessagePort objects"); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/no-target-origin.html b/testing/web-platform/tests/webmessaging/with-options/no-target-origin.html new file mode 100644 index 0000000000..517466cc4c --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/no-target-origin.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>no targetOrigin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + postMessage('', {}); + onmessage = this.step_func(function(e) { + assert_equals(e.data, ''); + this.done(); + }); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/null-transfer.html b/testing/web-platform/tests/webmessaging/with-options/null-transfer.html new file mode 100644 index 0000000000..2ea09eb7ab --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/null-transfer.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>null transfer</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +test(function(t) { + assert_throws_js(TypeError, () => postMessage('', {transfer: null})); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/one-arg.html b/testing/web-platform/tests/webmessaging/with-options/one-arg.html new file mode 100644 index 0000000000..8246e55f31 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/one-arg.html @@ -0,0 +1,13 @@ +<!doctype html> +<title>just one argument</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(t => { + postMessage(''); + onmessage = t.step_func_done(e => { + assert_equals(e.data, ''); + }); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/slash-origin.html b/testing/web-platform/tests/webmessaging/with-options/slash-origin.html new file mode 100644 index 0000000000..8bfde73774 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/slash-origin.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>special value '/'</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + postMessage('', {targetOrigin: '/'}); + onmessage = this.step_func(function(e) { + assert_equals(e.data, ''); + this.done(); + }); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/undefined-transferable.html b/testing/web-platform/tests/webmessaging/with-options/undefined-transferable.html new file mode 100644 index 0000000000..a123b7d9bd --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/undefined-transferable.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>undefined as transferable</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +async_test(function() { + postMessage('', {transfer: undefined}); + onmessage = this.step_func(function(e) { + assert_array_equals(e.ports, []); + this.done(); + }); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/with-options/unknown-parameter.html b/testing/web-platform/tests/webmessaging/with-options/unknown-parameter.html new file mode 100644 index 0000000000..de050e74f5 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/with-options/unknown-parameter.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>unknown parameter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + postMessage('', {someBogusParameterOnThisDictionary: 'food'}); + onmessage = this.step_func(function(e) { + assert_equals(e.data, ''); + this.done(); + }); +}); +</script> |