summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webmessaging/with-options
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/webmessaging/with-options
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webmessaging/with-options')
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/broken-origin.html12
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/host-specific-origin.html14
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/message-channel-transferable.html15
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/no-target-origin.html14
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/null-transfer.html10
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/one-arg.html13
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/slash-origin.html14
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/undefined-transferable.html14
-rw-r--r--testing/web-platform/tests/webmessaging/with-options/unknown-parameter.html14
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>