diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/webmessaging/message-channels | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/webmessaging/message-channels')
6 files changed, 90 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webmessaging/message-channels/001.html b/testing/web-platform/tests/webmessaging/message-channels/001.html new file mode 100644 index 000000000..12fac8229 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/001.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>basic messagechannel test</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(); + channel.port1.postMessage(1); + channel.port2.onmessage = t.step_func( + function(e) { + assert_equals(e.data, 1); + t.done(); + }); + channel.port2.start(); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/message-channels/002.html b/testing/web-platform/tests/webmessaging/message-channels/002.html new file mode 100644 index 000000000..8b7126718 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/002.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>without start()</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(); + channel.port1.postMessage(1); + var i = 0; + channel.port2.addEventListener('message', function() { i++; }, false); + setTimeout(t.step_func(function() { assert_equals(i, 0); t.done();}), 50); +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/message-channels/003.html b/testing/web-platform/tests/webmessaging/message-channels/003.html new file mode 100644 index 000000000..7addaeb0f --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/003.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>onmessage implied start()</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(); + channel.port1.postMessage(1); + channel.port2.onmessage = function() { + setTimeout(t.step_func(function() { + t.done(); + }), 50); + channel.port2.onmessage = t.step_func(function() { + assert_unreached(); + }); + }; // implies start() +}); +</script> diff --git a/testing/web-platform/tests/webmessaging/message-channels/004-1.html b/testing/web-platform/tests/webmessaging/message-channels/004-1.html new file mode 100644 index 000000000..b5dd282cd --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/004-1.html @@ -0,0 +1,8 @@ +<!doctype html> +<title>004-1</title> +<script> +onmessage = function(e) { + var port = e.ports[0]; + port.postMessage(e.data); +} +</script>
\ No newline at end of file diff --git a/testing/web-platform/tests/webmessaging/message-channels/004-2.html b/testing/web-platform/tests/webmessaging/message-channels/004-2.html new file mode 100644 index 000000000..1b8ef0a7a --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/004-2.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>004-2</title> +<script> +onmessage = function(e) { + var port = e.ports[0]; + port.onmessage = function(e) { // implied start() + parent.postMessage(e.data, '*'); + } +} +</script>
\ No newline at end of file diff --git a/testing/web-platform/tests/webmessaging/message-channels/004.html b/testing/web-platform/tests/webmessaging/message-channels/004.html new file mode 100644 index 000000000..19921fef8 --- /dev/null +++ b/testing/web-platform/tests/webmessaging/message-channels/004.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>cross-document channel</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<iframe src=004-1.html></iframe><iframe src=004-2.html></iframe> +<div id="log"></div> +<script> +var t = async_test(); +onload = t.step_func( + function() { + var channel = new MessageChannel(); + window[0].postMessage(1, '*', [channel.port1]); + window[1].postMessage(2, '*', [channel.port2]); + channel = null; + window.onmessage = t.step_func( + function(e) { + assert_equals(e.data, 1); + t.done(); + }); + } +); +</script> |