WebKit Bugzilla
Attachment 343534 Details for
Bug 187001
: Import WPT tests for webmessaging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187001-20180625223529.patch (text/plain), 221.01 KB, created by
Frédéric Wang (:fredw)
on 2018-06-25 13:35:33 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2018-06-25 13:35:33 PDT
Size:
221.01 KB
patch
obsolete
>Subversion Revision: 233144 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9d67f5c3f7366efc2084b74d4f421086966c220a..49c9975b446bc0058ab70b7d08748a95f84bf7d2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-06-25 Frederic Wang <fwang@igalia.com> >+ >+ Import WPT tests for webmessaging >+ https://bugs.webkit.org/show_bug.cgi?id=187001 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Skip some webmessaging tests timing out. >+ >+ * TestExpectations: >+ > 2018-06-25 Antoine Quint <graouts@apple.com> > > [Web Animations] Make imported/mozilla/css-animations/test_animation-pausing.html pass reliably >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index b89b82b4fe2ca509fe5435769ef463d3594af696..1bec579e6c1e481dad7014110f088feed332f12f 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,206 @@ >+2018-06-25 Frederic Wang <fwang@igalia.com> >+ >+ Import WPT tests for webmessaging >+ https://bugs.webkit.org/show_bug.cgi?id=187001 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * resources/import-expectations.json: >+ * resources/resource-files.json: >+ * web-platform-tests/webmessaging/Channel_postMessage_Blob-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_Blob.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_clone_port-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_clone_port.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_clone_port_error-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_clone_port_error.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_event_properties-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_event_properties.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array.htm: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_target_source-expected.txt: Added. >+ * web-platform-tests/webmessaging/Channel_postMessage_target_source.htm: Added. >+ * web-platform-tests/webmessaging/META.yml: Added. >+ * web-platform-tests/webmessaging/MessageEvent-expected.txt: Added. >+ * web-platform-tests/webmessaging/MessageEvent-trusted-expected.txt: Added. >+ * web-platform-tests/webmessaging/MessageEvent-trusted-worker.js: Added. >+ * web-platform-tests/webmessaging/MessageEvent-trusted.html: Added. >+ * web-platform-tests/webmessaging/MessageEvent.html: Added. >+ * web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop-expected.txt: Added. >+ * web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html: Added. >+ * web-platform-tests/webmessaging/MessageEvent_properties.htm: Added. >+ * web-platform-tests/webmessaging/MessagePort_initial_disabled-expected.txt: Added. >+ * web-platform-tests/webmessaging/MessagePort_initial_disabled.htm: Added. >+ * web-platform-tests/webmessaging/MessagePort_onmessage_start-expected.txt: Added. >+ * web-platform-tests/webmessaging/MessagePort_onmessage_start.htm: Added. >+ * web-platform-tests/webmessaging/README.md: Added. >+ * web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/basics-expected.txt: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/basics.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/blobs-expected.txt: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/blobs.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/interface-expected.txt: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/interface.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/origin.window.js: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/resources/origin.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/resources/sandboxed.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/resources/w3c-import.log: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/resources/worker.js: Added. >+ (handler): >+ * web-platform-tests/webmessaging/broadcastchannel/sandbox-expected.txt: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/sandbox.html: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/w3c-import.log: Added. >+ * web-platform-tests/webmessaging/broadcastchannel/workers.html: Added. >+ * web-platform-tests/webmessaging/event.data.sub.htm: Added. >+ * web-platform-tests/webmessaging/event.origin.sub.htm: Added. >+ * web-platform-tests/webmessaging/event.ports.sub.htm: Added. >+ * web-platform-tests/webmessaging/event.source.htm: Added. >+ * web-platform-tests/webmessaging/event.source.xorigin.sub.htm: Added. >+ * web-platform-tests/webmessaging/message-channels/001-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/001.html: Added. >+ * web-platform-tests/webmessaging/message-channels/002-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/002.html: Added. >+ * web-platform-tests/webmessaging/message-channels/003-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/003.html: Added. >+ * web-platform-tests/webmessaging/message-channels/004-1.html: Added. >+ * web-platform-tests/webmessaging/message-channels/004-2.html: Added. >+ * web-platform-tests/webmessaging/message-channels/004-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/004.html: Added. >+ * web-platform-tests/webmessaging/message-channels/close-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/close.html: Added. >+ * web-platform-tests/webmessaging/message-channels/w3c-import.log: Added. >+ * web-platform-tests/webmessaging/message-channels/worker-expected.txt: Added. >+ * web-platform-tests/webmessaging/message-channels/worker.html: Added. >+ * web-platform-tests/webmessaging/messageerror-expected.txt: Added. >+ * web-platform-tests/webmessaging/messageerror.html: Added. >+ * web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_Date.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_Document-expected.txt: Added. >+ * web-platform-tests/webmessaging/postMessage_Document.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_Function-expected.txt: Added. >+ * web-platform-tests/webmessaging/postMessage_Function.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_arrays.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_dup_transfer_objects-expected.txt: Added. >+ * web-platform-tests/webmessaging/postMessage_dup_transfer_objects.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_invalid_targetOrigin-expected.txt: Added. >+ * web-platform-tests/webmessaging/postMessage_invalid_targetOrigin.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_objects.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm: Added. >+ * web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm: Added. >+ * web-platform-tests/webmessaging/w3c-import.log: Added. >+ * web-platform-tests/webmessaging/with-ports/001-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/001.html: Added. >+ * web-platform-tests/webmessaging/with-ports/002-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/002.html: Added. >+ * web-platform-tests/webmessaging/with-ports/003-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/003.html: Added. >+ * web-platform-tests/webmessaging/with-ports/004-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/004.html: Added. >+ * web-platform-tests/webmessaging/with-ports/005-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/005.html: Added. >+ * web-platform-tests/webmessaging/with-ports/006-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/006.html: Added. >+ * web-platform-tests/webmessaging/with-ports/007-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/007.html: Added. >+ * web-platform-tests/webmessaging/with-ports/010-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/010.html: Added. >+ * web-platform-tests/webmessaging/with-ports/011-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/011.html: Added. >+ * web-platform-tests/webmessaging/with-ports/012-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/012.html: Added. >+ * web-platform-tests/webmessaging/with-ports/013-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/013.html: Added. >+ * web-platform-tests/webmessaging/with-ports/014-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/014.html: Added. >+ * web-platform-tests/webmessaging/with-ports/015-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/015.html: Added. >+ * web-platform-tests/webmessaging/with-ports/016-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/016.html: Added. >+ * web-platform-tests/webmessaging/with-ports/017-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/017.html: Added. >+ * web-platform-tests/webmessaging/with-ports/018-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/018.html: Added. >+ * web-platform-tests/webmessaging/with-ports/019-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/019.html: Added. >+ * web-platform-tests/webmessaging/with-ports/020.html: Added. >+ * web-platform-tests/webmessaging/with-ports/021.html: Added. >+ * web-platform-tests/webmessaging/with-ports/023-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/023.html: Added. >+ * web-platform-tests/webmessaging/with-ports/024-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/024.html: Added. >+ * web-platform-tests/webmessaging/with-ports/025-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/025.html: Added. >+ * web-platform-tests/webmessaging/with-ports/026-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/026.html: Added. >+ * web-platform-tests/webmessaging/with-ports/027-expected.txt: Added. >+ * web-platform-tests/webmessaging/with-ports/027.html: Added. >+ * web-platform-tests/webmessaging/with-ports/w3c-import.log: Added. >+ * web-platform-tests/webmessaging/without-ports/001-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/001.html: Added. >+ * web-platform-tests/webmessaging/without-ports/002-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/002.html: Added. >+ * web-platform-tests/webmessaging/without-ports/003-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/003.html: Added. >+ * web-platform-tests/webmessaging/without-ports/004-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/004.html: Added. >+ * web-platform-tests/webmessaging/without-ports/005-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/005.html: Added. >+ * web-platform-tests/webmessaging/without-ports/006-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/006.html: Added. >+ * web-platform-tests/webmessaging/without-ports/007-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/007.html: Added. >+ * web-platform-tests/webmessaging/without-ports/008-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/008.html: Added. >+ * web-platform-tests/webmessaging/without-ports/009-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/009.html: Added. >+ * web-platform-tests/webmessaging/without-ports/010-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/010.html: Added. >+ * web-platform-tests/webmessaging/without-ports/011-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/011.html: Added. >+ * web-platform-tests/webmessaging/without-ports/012-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/012.html: Added. >+ * web-platform-tests/webmessaging/without-ports/013-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/013.html: Added. >+ * web-platform-tests/webmessaging/without-ports/014-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/014.html: Added. >+ * web-platform-tests/webmessaging/without-ports/015-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/015.html: Added. >+ * web-platform-tests/webmessaging/without-ports/016-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/016.html: Added. >+ * web-platform-tests/webmessaging/without-ports/017-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/017.html: Added. >+ * web-platform-tests/webmessaging/without-ports/018-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/018.html: Added. >+ * web-platform-tests/webmessaging/without-ports/019-1.html: Added. >+ * web-platform-tests/webmessaging/without-ports/019-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/019.html: Added. >+ * web-platform-tests/webmessaging/without-ports/020-1.html: Added. >+ * web-platform-tests/webmessaging/without-ports/020.html: Added. >+ * web-platform-tests/webmessaging/without-ports/021.html: Added. >+ * web-platform-tests/webmessaging/without-ports/023-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/023.html: Added. >+ * web-platform-tests/webmessaging/without-ports/024-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/024.html: Added. >+ * web-platform-tests/webmessaging/without-ports/025-1.js: Added. >+ (test): >+ * web-platform-tests/webmessaging/without-ports/025-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/025.html: Added. >+ * web-platform-tests/webmessaging/without-ports/026-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/026.html: Added. >+ * web-platform-tests/webmessaging/without-ports/027-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/027.html: Added. >+ * web-platform-tests/webmessaging/without-ports/028-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/028.html: Added. >+ * web-platform-tests/webmessaging/without-ports/029-expected.txt: Added. >+ * web-platform-tests/webmessaging/without-ports/029.html: Added. >+ * web-platform-tests/webmessaging/without-ports/w3c-import.log: Added. >+ > 2018-06-19 Youenn Fablet <youenn@apple.com> > > RTCRtpSender.replaceTrack(null) ends current track >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 4c2cc1873b64053353cf9db6d6514466d2223f46..eeec155bbbb9d77c701194c7245fc677ece96c25 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -641,6 +641,31 @@ webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling > webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-2.html [ ImageOnlyFailure ] > webkit.org/b/180013 imported/w3c/web-platform-tests/mathml/relations/css-styling/lengths-3.html [ Failure ] > >+# These webmessaging WPT tests time out. >+imported/w3c/web-platform-tests/webmessaging/MessageEvent_properties.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/event.data.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/event.origin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/event.ports.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/event.source.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/event.source.xorigin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_Date.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_arrays.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_objects.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/with-ports/020.html [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/with-ports/021.html [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/without-ports/020.html [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/without-ports/021.html [ Skip ] >+imported/w3c/web-platform-tests/webmessaging/broadcastchannel/workers.html [ Skip ] >+ > # XMLHttpRequest tests requiring DTR/WTR to allow other URLs than localhost to not be blocked and be reachable (www2.localhost) > imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-bogus.htm [ Skip ] > imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-cors.htm [ Skip ] >diff --git a/LayoutTests/imported/w3c/resources/import-expectations.json b/LayoutTests/imported/w3c/resources/import-expectations.json >index d771685db5321a560cc78f9b39a6bf2dd1ba6e44..42656d43ee63f969faeeea97a82926fea350b1be 100644 >--- a/LayoutTests/imported/w3c/resources/import-expectations.json >+++ b/LayoutTests/imported/w3c/resources/import-expectations.json >@@ -336,6 +336,7 @@ > "web-platform-tests/webdriver": "skip", > "web-platform-tests/webgl": "skip", > "web-platform-tests/webmessaging": "skip", >+ "web-platform-tests/webmessaging/": "import", > "web-platform-tests/webrtc": "import", > "web-platform-tests/websockets": "skip", > "web-platform-tests/webstorage": "skip", >diff --git a/LayoutTests/imported/w3c/resources/resource-files.json b/LayoutTests/imported/w3c/resources/resource-files.json >index ce605d91b2dcdd640c4558d36aaeb0c46de3701b..dfcceab150f7074db522b6f77447f3574efd115a 100644 >--- a/LayoutTests/imported/w3c/resources/resource-files.json >+++ b/LayoutTests/imported/w3c/resources/resource-files.json >@@ -1109,6 +1109,10 @@ > "web-platform-tests/service-workers/service-worker/multi-globals/relevant/relevant.https.html", > "web-platform-tests/test_keys_wdspec.html", > "web-platform-tests/upgrade-insecure-requests/support/post-origin-to-parent.html", >+ "web-platform-tests/webmessaging/message-channels/004-1.html", >+ "web-platform-tests/webmessaging/message-channels/004-2.html", >+ "web-platform-tests/webmessaging/without-ports/019-1.html", >+ "web-platform-tests/webmessaging/without-ports/020-1.html", > "web-platform-tests/workers/data-url-shared-window.html", > "web-platform-tests/workers/non-automated/application-cache-dedicated.html", > "web-platform-tests/workers/non-automated/infinite-nested.html", >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b63d6d3682a9855261527ee9d6f7ed5a918ea1c5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: Messages can contain Blobs. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..c8c247ef59dc7b513c54459fc83fd1aa6fcec8dd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob.htm >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage() with a Blob </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ var TARGET = null; >+ var SOURCE = null; >+ var description = "Messages can contain Blobs."; >+ >+ var t = async_test("Test Description: " + description); >+ >+ var channel = new MessageChannel(); >+ SOURCE = channel.port1; >+ TARGET = channel.port2; >+ TARGET.start(); >+ TARGET.addEventListener("message", t.step_func(TestMessageEvent), true); >+ >+ (function() { >+ SOURCE.postMessage({blob: new Blob(['foo', 'bar'])}); >+ })(); >+ // TODO(https://github.com/web-platform-tests/wpt/issues/7899): Change to >+ // some sort of cross-browser GC trigger. >+ if (self.gc) self.gc(); >+ >+ function TestMessageEvent(evt) >+ { >+ assert_true('blob' in evt.data); >+ assert_true(evt.data.blob instanceof Blob); >+ assert_equals(evt.data.blob.size, 6); >+ const reader = new FileReader(); >+ reader.onerror = t.unreached_func('Reading blob failed'); >+ reader.onload = t.step_func(() => { >+ assert_equals(reader.result, 'foobar'); >+ t.done(); >+ }); >+ reader.readAsText(evt.data.blob); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8cfbd46f2cca0a10deac0cb352f54fdddb8e7a15 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Throw a DataCloneError when a host object (e.g. a DOM node) is used with postMessage. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..9f4cd6b9be711e90c435140bab5183aa10e18e31 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr.htm >@@ -0,0 +1,26 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage() with a host object raises DataCloneError </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ >+ var description = "Throw a DataCloneError when a host object (e.g. a DOM node) is used with postMessage."; >+ >+ test(function() >+ { >+ var channel = new MessageChannel(); >+ channel.port1.start(); >+ >+ assert_throws("DATA_CLONE_ERR", function() >+ { >+ channel.port1.postMessage(navigator); >+ }); >+ }, description); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..419f818d636f6cb102d6ed9c9cda0894a77b4302 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS Test Description: Test Description: When the user agent is to clone a port original port, with the clone being owned by owner, it must return a new MessagePort object >+PASS Data sent through remote port is received by the new cloned port >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..0e2e2fcd14199224d93bb360320484de732353f9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port.htm >@@ -0,0 +1,42 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage(): clone a port </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ var OriginalPort = null; >+ var ClonedPort = null; >+ var description = "Test Description: When the user agent is to clone a port original port, with " >+ + "the clone being owned by owner, it must return a new MessagePort object"; >+ >+ var t = async_test("Test Description: " + description); >+ >+ var ChannelA = new MessageChannel(); >+ var ChannelB = new MessageChannel(); >+ OriginalPort = ChannelB.port2; >+ >+ ChannelA.port2.onmessage = t.step_func(function(evt) >+ { >+ if(evt.data == "ports") >+ { >+ ClonedPort = evt.ports[0]; >+ >+ assert_not_equals(ClonedPort, OriginalPort, "new cloned port object should not equal to the original port!"); >+ >+ ClonedPort.onmessage = function(e) >+ { >+ test(function(){ assert_equals(e.data, "ping"); }, "Data sent through remote port is received by the new cloned port"); >+ t.done(); >+ } >+ } >+ }); >+ >+ ChannelA.port1.postMessage("ports", [OriginalPort]); >+ ChannelB.port1.postMessage("ping"); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2c3774d5ab93ec582ce41bafa0859880c6c30fa9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: Throw a DataCloneError if transfer array in postMessage contains source port. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..c33feaa5f0947a275e1cb39d920be7a2658cb97e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error.htm >@@ -0,0 +1,26 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage() DataCloneError: cloning source port </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ >+ var description = "Test Description: Throw a DataCloneError if transfer array in postMessage contains source port."; >+ >+ test(function() >+ { >+ var channel = new MessageChannel(); >+ channel.port1.start(); >+ >+ assert_throws("DATA_CLONE_ERR", function() >+ { >+ channel.port1.postMessage("ports", [channel.port1]); >+ }); >+ }, description); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5282f24f9cb3061b09388f52c33ec2dc10e7d3bd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: The postMessage() method - Create an event that uses the MessageEvent interface, with the name message, which does not bubble and is not cancelable. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..4be7203fce8421051acc3115b20d768a3190d003 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties.htm >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage(): MessageEvent properties </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ >+ var TargetPort = null; >+ var description = "The postMessage() method - Create an event that uses the MessageEvent interface, " >+ + "with the name message, which does not bubble and is not cancelable."; >+ >+ var t = async_test("Test Description: " + description); >+ >+ var channel = new MessageChannel(); >+ >+ TargetPort = channel.port2; >+ TargetPort.start(); >+ TargetPort.addEventListener("message", t.step_func(TestMessageEvent), true); >+ >+ channel.port1.postMessage("ping"); >+ >+ function TestMessageEvent(evt) >+ { >+ ExpectedResult = [true, "message", false, false]; >+ ActualResult = [(evt instanceof MessageEvent), evt.type, evt.bubbles, evt.cancelable]; >+ >+ assert_array_equals(ActualResult, ExpectedResult); >+ t.done(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2682c9bc64be97918bd33ad50d5df948c044a803 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: The postMessage() method - Make new ports into a read only array. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..4ccf3ac4f3535676fb45ee591ed6ee75fc32f289 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array.htm >@@ -0,0 +1,39 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage(): read-only ports array </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ "use strict"; >+ >+ var TargetPort = null; >+ var description = "The postMessage() method - Make new ports into a read only array."; >+ >+ var t = async_test("Test Description: " + description); >+ >+ var channel = new MessageChannel(); >+ >+ TargetPort = channel.port2; >+ TargetPort.start(); >+ TargetPort.addEventListener("message", t.step_func(TestMessageEvent), true); >+ >+ var channel2 = new MessageChannel(); >+ >+ channel.port1.postMessage("ports", [channel2.port1]); >+ >+ function TestMessageEvent(evt) >+ { >+ var channel3 = new MessageChannel(); >+ assert_throws(new TypeError(), () => { >+ evt.ports.push(channel3.port1); >+ }, "ports is a frozen object"); >+ assert_equals(evt.ports.length, 1, "ports is a read only array with length == 1."); >+ t.done(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..fc6d3412a695439085927dcac417cfb093511adc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: The postMessage() method - Let target port be the port with which source port is entangled, if any. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..4b00e68d49ef9fc85e92a5526ff76bd92259d4d9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source.htm >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage(): target port and source port </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+<script> >+ >+ var TARGET = null; >+ var SOURCE = null; >+ var description = "The postMessage() method - Let target port be the port with which source " >+ + "port is entangled, if any."; >+ >+ var t = async_test("Test Description: " + description); >+ >+ var channel = new MessageChannel(); >+ SOURCE = channel.port1; >+ TARGET = channel.port2; >+ TARGET.start(); >+ TARGET.addEventListener("message", t.step_func(TestMessageEvent), true); >+ >+ SOURCE.postMessage("ping"); >+ >+ function TestMessageEvent(evt) >+ { >+ assert_equals(evt.target, TARGET); >+ assert_not_equals(evt.target, SOURCE); >+ t.done(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/META.yml b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/META.yml >new file mode 100644 >index 0000000000000000000000000000000000000000..8831129e2fdb0c3b0f8d08a7d3486326ed8fb6a0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/META.yml >@@ -0,0 +1,6 @@ >+suggested_reviewers: >+ - zqzhang >+ - aogilvie >+ - jdm >+ - mkruisselbrink >+ - annevk >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..77b50583b7e608c48a9d4d1d282dcc27791d8d2c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-expected.txt >@@ -0,0 +1,11 @@ >+ >+PASS mozInitMessageEvent on the prototype >+PASS mozInitMessageEvent on the instance >+PASS msInitMessageEvent on the prototype >+PASS msInitMessageEvent on the instance >+PASS oInitMessageEvent on the prototype >+PASS oInitMessageEvent on the instance >+PASS webkitInitMessageEvent on the prototype >+PASS webkitInitMessageEvent on the instance >+PASS initMessageEvent with no arguments >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b0a38f76495475d5ce9601fa7c76fe85f7cf6057 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-expected.txt >@@ -0,0 +1,5 @@ >+ >+PASS With a MessageChannel and its MessagePorts >+FAIL With a BroadcastChannel assert_true: The browser must support BroadcastChannel expected true got false >+PASS With window >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-worker.js b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..6e8c3a781bfbaceee72b2daa521c99c68e94724a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-worker.js >@@ -0,0 +1,4 @@ >+"use strict"; >+ >+const channel = new BroadcastChannel("channel name"); >+channel.postMessage("ping"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8cde663339dc51421b727f3bdf12c8b173374afc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<title>MessagePort message events are trusted</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<link rel="help" href="https://html.spec.whatwg.org/multipage/comms.html#dom-messageport-postmessage"> >+<!-- See also: >+- https://github.com/whatwg/html/issues/1602 >+- https://github.com/whatwg/html/pull/1935 >+--> >+ >+<script> >+"use strict"; >+ >+async_test(t => { >+ assert_true("MessageChannel" in self, "The browser must support MessageChannel"); >+ >+ const channel = new MessageChannel(); >+ >+ channel.port2.onmessage = t.step_func_done(e => { >+ assert_equals(e.isTrusted, true); >+ }); >+ >+ channel.port1.postMessage("ping"); >+}, "With a MessageChannel and its MessagePorts"); >+ >+async_test(t => { >+ assert_true("BroadcastChannel" in self, "The browser must support BroadcastChannel"); >+ >+ const channel = new BroadcastChannel("channel name"); >+ >+ channel.onmessage = t.step_func_done(e => { >+ assert_equals(e.isTrusted, true); >+ }); >+ >+ new Worker("MessageEvent-trusted-worker.js"); >+}, "With a BroadcastChannel"); >+ >+async_test(t => { >+ window.onmessage = t.step_func_done(e => { >+ assert_equals(e.isTrusted, true); >+ }); >+ >+ window.postMessage("ping", "*"); >+}, "With window"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4fb68b5999ba4f829febc83ca9d305ba6327aad0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent.html >@@ -0,0 +1,28 @@ >+<!doctype html> >+<meta charset=utf-8> >+<title>MessageEvent</title> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<div id=log></div> >+<script> >+var prefixes = ['moz', 'ms', 'o', 'webkit']; >+prefixes.forEach(function(prefix) { >+ var name = prefix + "InitMessageEvent"; >+ >+ test(function() { >+ assert_false(name in MessageEvent.prototype); >+ }, name + " on the prototype"); >+ >+ test(function() { >+ var event = new MessageEvent("message"); >+ assert_false(name in event); >+ }, name + " on the instance"); >+}); >+ >+test(function() { >+ var event = new MessageEvent("message"); >+ assert_throws(new TypeError(), function() { >+ event.initMessageEvent(); >+ }, "Not enough arguments to initMessageEvent"); >+}, "initMessageEvent with no arguments"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a9341426116ccc259634acb55faaf7477f55e017 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS onmessage calling source postMessage >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html >new file mode 100644 >index 0000000000000000000000000000000000000000..179bc0cc4a1253618e30ffd674fec139c3c0d52a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title>MessageEvent: onmessage infinite loop</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<script> >+'use strict'; >+ >+// The test passes if the onmessage / postMessage loop does not prevent the >+// step_timeout task from ever being run. In particular there should be no >+// infinite loop or stack overflow. >+async_test(function(t) { >+ var channel = new MessageChannel(); >+ var count = 0; >+ channel.port1.addEventListener("message", t.step_func(function() { >+ count++; >+ assert_less_than(count, 1000, "There were many message events without " + >+ "t.step_timeout ever being called."); >+ })); >+ channel.port1.addEventListener("message", t.step_func(function() { >+ channel.port2.postMessage(0); >+ })); >+ channel.port1.start(); >+ channel.port2.postMessage(0); >+ >+ t.step_timeout(function() { t.done(); }, 0); >+}, "onmessage calling source postMessage"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_properties.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_properties.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..389add98d1f4c40deea0adcc96960862a2aff6b2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_properties.htm >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> MessageEvent interface and properties </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="do_test()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+async_test(function() { >+ window.do_test = this.step_func(function() { >+ document.querySelector("iframe").contentWindow.postMessage("foo", "*"); >+ }) >+ >+ window.addEventListener("message", this.step_func_done(function(e) { >+ e.preventDefault(); >+ assert_true(e instanceof MessageEvent, "Should be MessageEvent"); >+ assert_equals(e.type, "message"); >+ assert_false(e.bubbles, "bubbles"); >+ assert_false(e.cancelable, "cancelable"); >+ assert_false(e.defaultPrevented, "defaultPrevented"); >+ }), false); >+}); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b7aa358eb6ac18e14e5c2d86bfed8f0fb82fe052 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS MessageChannel: port message queue is initially disabled >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..58447dc2d6ebbc827f9abbd5d4fe094d060bce3a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled.htm >@@ -0,0 +1,13 @@ >+<!DOCTYPE html> >+<title>MessageChannel: port message queue is initially disabled</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.port2.addEventListener("message", t.unreached_func(), true); >+ channel.port1.postMessage("ping"); >+ setTimeout(t.step_func_done(), 100); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2b3b2df6b123c9c24b0ab1d94c1108735ff8d490 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS MessageChannel: port.onmessage enables message queue >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..dc4dc1e54b5e3f05a428e8a8c19acfc9f7bbf127 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start.htm >@@ -0,0 +1,13 @@ >+<!DOCTYPE html> >+<title>MessageChannel: port.onmessage enables message queue</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.port2.onmessage = t.step_func_done(); >+ channel.port1.postMessage("ping"); >+ setTimeout(t.unreached_func(), 100); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/README.md b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/README.md >new file mode 100644 >index 0000000000000000000000000000000000000000..0b81aa0658cb4d69ff5b958ba27b79e32ebdb461 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/README.md >@@ -0,0 +1,2 @@ >+These are the cross-document messaging (`postMessage()`) tests for the >+[cross-document messaging chapter of the HTML Standard](https://html.spec.whatwg.org/multipage/comms.html#web-messaging). >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..55c3dbdba18a686011f893be82f5c220b1e7ce74 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm >@@ -0,0 +1,60 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Transferred objects are no longer usable on the sending side </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "Objects listed in transfer are transferred, not just cloned, meaning that they are " + >+ "no longer usable on the sending side."; >+ >+ var t = async_test(description); >+ >+ var DATA = {test: "e.ports[0].postMessage('TRANSFERRED')"}; >+ var TARGET = document.querySelector("iframe"); >+ var ExpectedResult = ["PING", "TRANSFERRED"]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_own_property(window, "MessageChannel", "window"); >+ >+ var channel = new MessageChannel(); >+ >+ channel.port2.onmessage = t.step_func(VerifyResult); >+ >+ channel.port1.postMessage("PING"); >+ >+ TARGET.contentWindow.postMessage(DATA, "*", [channel.port1]); >+ >+ channel.port1.postMessage("PONG"); >+ >+ }, "MessageChannel is supported."); >+ } >+ >+ function VerifyResult(e) >+ { >+ ActualResult.push(e.data) >+ >+ if (ActualResult.length >= ExpectedResult.length) >+ { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b390f46481a4cf5bba0dcddd7b1a2572a4171215 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics-expected.txt >@@ -0,0 +1,7 @@ >+ >+FAIL postMessage results in correct event Can't find variable: BroadcastChannel >+FAIL messages are delivered in port creation order Can't find variable: BroadcastChannel >+FAIL messages aren't delivered to a closed port Can't find variable: BroadcastChannel >+FAIL closing and creating channels during message delivery works correctly Can't find variable: BroadcastChannel >+FAIL Closing a channel in onmessage doesn't cancel already queued events Can't find variable: BroadcastChannel >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ed16e32f5437dc430b5cc11b967e6538ef6cf393 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics.html >@@ -0,0 +1,120 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('eventType'); >+ let c2 = new BroadcastChannel('eventType'); >+ >+ c2.onmessage = t.step_func(e => { >+ assert_true(e instanceof MessageEvent); >+ assert_equals(e.target, c2); >+ assert_equals(e.type, 'message'); >+ assert_equals(e.origin, location.origin, 'origin'); >+ assert_equals(e.data, 'hello world'); >+ assert_equals(e.source, null, 'source'); >+ t.done(); >+ }); >+ c1.postMessage('hello world'); >+ }, 'postMessage results in correct event'); >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('order'); >+ let c2 = new BroadcastChannel('order'); >+ let c3 = new BroadcastChannel('order'); >+ >+ let events = []; >+ let doneCount = 0; >+ let handler = t.step_func(e => { >+ events.push(e); >+ if (e.data == 'done') { >+ doneCount++; >+ if (doneCount == 2) { >+ assert_equals(events.length, 6); >+ assert_equals(events[0].target, c2, 'target for event 0'); >+ assert_equals(events[0].data, 'from c1'); >+ assert_equals(events[1].target, c3, 'target for event 1'); >+ assert_equals(events[1].data, 'from c1'); >+ assert_equals(events[2].target, c1, 'target for event 2'); >+ assert_equals(events[2].data, 'from c3'); >+ assert_equals(events[3].target, c2, 'target for event 3'); >+ assert_equals(events[3].data, 'from c3'); >+ assert_equals(events[4].target, c1, 'target for event 4'); >+ assert_equals(events[4].data, 'done'); >+ assert_equals(events[5].target, c3, 'target for event 5'); >+ assert_equals(events[5].data, 'done'); >+ t.done(); >+ } >+ } >+ }); >+ c1.onmessage = handler; >+ c2.onmessage = handler; >+ c3.onmessage = handler; >+ >+ c1.postMessage('from c1'); >+ c3.postMessage('from c3'); >+ c2.postMessage('done'); >+ }, 'messages are delivered in port creation order'); >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('closed'); >+ let c2 = new BroadcastChannel('closed'); >+ let c3 = new BroadcastChannel('closed'); >+ >+ c2.onmessage = t.unreached_func(); >+ c2.close(); >+ c3.onmessage = t.step_func(() => t.done()); >+ c1.postMessage('test'); >+ }, 'messages aren\'t delivered to a closed port'); >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('create-in-onmessage'); >+ let c2 = new BroadcastChannel('create-in-onmessage'); >+ >+ c2.onmessage = t.step_func(e => { >+ assert_equals(e.data, 'first'); >+ c2.close(); >+ let c3 = new BroadcastChannel('create-in-onmessage'); >+ c3.onmessage = t.step_func(event => { >+ assert_equals(event.data, 'done'); >+ t.done(); >+ }); >+ c1.postMessage('done'); >+ }); >+ c1.postMessage('first'); >+ c2.postMessage('second'); >+ }, 'closing and creating channels during message delivery works correctly'); >+ >+// TODO(mek): Depending on https://github.com/whatwg/html/issues/1371 adjust >+// this test to match the correct behavior. >+async_test(t => { >+ let c1 = new BroadcastChannel('close-in-onmessage'); >+ let c2 = new BroadcastChannel('close-in-onmessage'); >+ let c3 = new BroadcastChannel('close-in-onmessage'); >+ let events = []; >+ c1.onmessage = e => events.push('c1: ' + e.data); >+ c2.onmessage = e => events.push('c2: ' + e.data); >+ c3.onmessage = e => events.push('c3: ' + e.data); >+ >+ // c2 closes itself when it receives the first message >+ c2.addEventListener('message', e => { >+ c2.close(); >+ }); >+ >+ c3.addEventListener('message', t.step_func(e => { >+ if (e.data == 'done') { >+ assert_array_equals(events, [ >+ 'c2: first', >+ 'c3: first', >+ 'c2: done', >+ 'c3: done']); >+ t.done(); >+ } >+ })); >+ c1.postMessage('first'); >+ c1.postMessage('done'); >+ }, 'Closing a channel in onmessage doesn\'t cancel already queued events'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7080be7db860ba1fc668023582664354e2281490 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs-expected.txt >@@ -0,0 +1,4 @@ >+ >+FAIL Blobs work on BroadcastChannel Can't find variable: BroadcastChannel >+FAIL Blobs work with workers on BroadcastChannel Can't find variable: BroadcastChannel >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1f0e2f1f1d6050136910c17e460a70ed15874aa5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html >@@ -0,0 +1,83 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+async_test(t => { >+ const c1 = new BroadcastChannel('blob'); >+ const c2 = new BroadcastChannel('blob'); >+ const c3 = new BroadcastChannel('blob'); >+ >+ let readCount = 0; >+ c2.onmessage = t.step_func(e => { >+ // check blob >+ assert_true('blob' in e.data); >+ assert_true(e.data.blob instanceof Blob); >+ assert_equals(e.data.blob.size, 6); >+ const reader = new FileReader(); >+ reader.onerror = t.unreached_func(); >+ reader.onload = t.step_func(() => { >+ assert_equals(reader.result, 'foobar'); >+ if (++readCount == 2) >+ t.done(); >+ }); >+ reader.readAsText(e.data.blob); >+ }); >+ c3.onmessage = c2.onmessage; >+ (() => { >+ c1.postMessage({blob: new Blob(['foo', 'bar'])}); >+ })(); >+ // TODO(https://github.com/web-platform-tests/wpt/issues/7899): Change to >+ // some sort of cross-browser GC trigger. >+ if (self.gc) self.gc(); >+ }, 'Blobs work on BroadcastChannel'); >+ >+async_test(t => { >+ const c1 = new BroadcastChannel('blobworker'); >+ const c2 = new BroadcastChannel('blobworker'); >+ const events = []; >+ >+ const verifyEvents = function() { >+ assert_equals(events.length, 5); >+ assert_equals(events[0], 'from worker'); >+ assert_equals(events[1], 'from worker'); >+ assert_true(events[2].blob instanceof Blob); >+ assert_equals(events[2].blob.size, 11); >+ assert_true(events[3].blob instanceof Blob); >+ assert_equals(events[3].blob.size, 11); >+ assert_equals(events[4], 'done'); >+ const reader = new FileReader(); >+ reader.onerror = t.unreached_func(); >+ reader.onload = t.step_func(() => { >+ assert_equals(reader.result, 'hello-world'); >+ t.done(); >+ }); >+ reader.readAsText(events[3].blob); >+ }; >+ >+ let receivedDone = false; >+ let receivedWorkerDone = false; >+ >+ c1.onmessage = e => events.push(e.data); >+ c2.onmessage = e => events.push(e.data); >+ c2.addEventListener('message', t.step_func(e => { >+ if (e.data.blob) >+ c1.postMessage('done'); >+ if (e.data === 'done') >+ receivedDone = true; >+ if (receivedDone && receivedWorkerDone) >+ verifyEvents(); >+ })); >+ >+ const worker = new Worker('resources/worker.js'); >+ worker.onmessage = t.step_func(e => { >+ receivedWorkerDone = true; >+ if (receivedDone && receivedWorkerDone) >+ verifyEvents(); >+ }); >+ worker.postMessage({channel: 'blobworker'}); >+ worker.postMessage({blob: ['hello-world']}); >+ >+ }, 'Blobs work with workers on BroadcastChannel'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8f87b0db40f81a5020f63de08dfb9a5dbe51e1dd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface-expected.txt >@@ -0,0 +1,15 @@ >+ >+FAIL Should throw if no name is provided assert_throws: function "() => new BroadcastChannel()" threw object "ReferenceError: Can't find variable: BroadcastChannel" ("ReferenceError") expected object "TypeError" ("TypeError") >+FAIL Null name should not throw Can't find variable: BroadcastChannel >+FAIL Undefined name should not throw Can't find variable: BroadcastChannel >+FAIL Non-empty name should not throw Can't find variable: BroadcastChannel >+FAIL Non-string name should not throw Can't find variable: BroadcastChannel >+FAIL postMessage without parameters should throw Can't find variable: BroadcastChannel >+FAIL postMessage with null should not throw Can't find variable: BroadcastChannel >+FAIL close should not throw Can't find variable: BroadcastChannel >+FAIL close should not throw when called multiple times Can't find variable: BroadcastChannel >+FAIL postMessage after close should throw Can't find variable: BroadcastChannel >+FAIL BroadcastChannel should have an onmessage event Can't find variable: BroadcastChannel >+FAIL postMessage should throw with uncloneable data Can't find variable: BroadcastChannel >+FAIL postMessage should throw InvalidStateError after close, even with uncloneable data Can't find variable: BroadcastChannel >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a552563ed66b9168c717a3bc3f41c6a6f7f7f8b1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface.html >@@ -0,0 +1,73 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ >+test(() => assert_throws(new TypeError(), () => new BroadcastChannel()), >+ 'Should throw if no name is provided'); >+ >+test(() => { >+ let c = new BroadcastChannel(null); >+ assert_equals(c.name, 'null'); >+ }, 'Null name should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(undefined); >+ assert_equals(c.name, 'undefined'); >+ }, 'Undefined name should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel('fooBar'); >+ assert_equals(c.name, 'fooBar'); >+ }, 'Non-empty name should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(123); >+ assert_equals(c.name, '123'); >+ }, 'Non-string name should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ assert_throws(new TypeError(), () => c.postMessage()); >+ }, 'postMessage without parameters should throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ c.postMessage(null); >+ }, 'postMessage with null should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ c.close(); >+ }, 'close should not throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ c.close(); >+ c.close(); >+ }, 'close should not throw when called multiple times'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ c.close(); >+ assert_throws('InvalidStateError', () => c.postMessage('')); >+ }, 'postMessage after close should throw'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ assert_not_equals(c.onmessage, undefined); >+ }, 'BroadcastChannel should have an onmessage event'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ assert_throws('DataCloneError', () => c.postMessage(Symbol())); >+ }, 'postMessage should throw with uncloneable data'); >+ >+test(() => { >+ let c = new BroadcastChannel(''); >+ c.close(); >+ assert_throws('InvalidStateError', () => c.postMessage(Symbol())); >+ }, 'postMessage should throw InvalidStateError after close, even with uncloneable data'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/origin.window.js b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/origin.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..7e9d602af194b7929f9c4c9cb8e4d3f972a0ea26 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/origin.window.js >@@ -0,0 +1,10 @@ >+async_test(t => { >+ const crossOriginURL = new URL("resources/origin.html", self.location.href).href.replace("://", "://天æ°ã®è¯ãæ¥."), >+ frame = document.createElement("iframe"); >+ frame.src = crossOriginURL; >+ document.body.appendChild(frame); >+ t.add_cleanup(() => frame.remove()); >+ self.onmessage = t.step_func_done(e => { >+ assert_equals(e.data, self.origin.replace("://", "://xn--n8j6ds53lwwkrqhv28a.")); >+ }); >+}, "Serialization of BroadcastChannel origin"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/origin.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/origin.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f57d582bbb878ceb7ebd8d962d5d4293b736b4c4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/origin.html >@@ -0,0 +1,8 @@ >+<script> >+const bc1 = new BroadcastChannel("ladila"), >+ bc2 = new BroadcastChannel("ladila"); >+bc2.onmessage = e => { >+ parent.postMessage(e.origin, "*"); >+} >+bc1.postMessage("does not matter"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/sandboxed.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/sandboxed.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e32962cdfd4456942c9af24541fb34e93d9c5a6d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/sandboxed.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<script> >+try { >+ let c = new BroadcastChannel('foo'); >+ parent.postMessage('Created', '*'); >+} catch (e) { >+ parent.postMessage('Exception: ' + e.name, '*'); >+} >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..0b9826b1a46ed11dd116195ead29d087d14fcc64 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/w3c-import.log >@@ -0,0 +1,19 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/origin.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/sandboxed.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/worker.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/worker.js b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9364c602756385cd4e0f8ece267b447620591c94 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/resources/worker.js >@@ -0,0 +1,31 @@ >+var c; >+ >+function handler(e, reply) { >+ if (e.data.ping) { >+ c.postMessage(e.data.ping); >+ return; >+ } >+ if (e.data.blob) { >+ (() => { >+ c.postMessage({blob: new Blob(e.data.blob)}); >+ })(); >+ // TODO(https://github.com/web-platform-tests/wpt/issues/7899): Change to >+ // some sort of cross-browser GC trigger. >+ if (self.gc) self.gc(); >+ } >+ c = new BroadcastChannel(e.data.channel); >+ let messages = []; >+ c.onmessage = e => { >+ messages.push(e.data); >+ if (e.data == 'done') >+ reply(messages); >+ }; >+ c.postMessage('from worker'); >+} >+ >+onmessage = e => handler(e, postMessage); >+ >+onconnect = e => { >+ let port = e.ports[0]; >+ port.onmessage = e => handler(e, msg => port.postMessage(msg)); >+}; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1231fb09deb62081f66a095b6c55c77f57b35c55 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+FAIL Creating BroadcastChannel in an opaque origin assert_equals: expected "Created" but got "Exception: ReferenceError" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox.html >new file mode 100644 >index 0000000000000000000000000000000000000000..aedf3c0d6fe64dca2b3a6058d69d7f3a7f70cc28 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox.html >@@ -0,0 +1,16 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<title>Creating BroadcastChannel in an opaque origin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<body> >+<script> >+async_test(t => { >+ self.onmessage = t.step_func(e => { >+ assert_equals(e.data, 'Created'); >+ t.done(); >+ }); >+ }); >+</script> >+<iframe sandbox="allow-scripts" src="resources/sandboxed.html"></iframe> >+</body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..38d9552282b53f443feabcf6cb6d0a28ec3438b4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/w3c-import.log >@@ -0,0 +1,22 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/basics.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/interface.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/origin.window.js >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/sandbox.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/workers.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/workers.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/workers.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1d05feb7edbf0e9fc148d2136bb5a5a1ffeb56a6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/workers.html >@@ -0,0 +1,141 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('worker'); >+ let c2 = new BroadcastChannel('worker'); >+ let events = []; >+ >+ c1.onmessage = e => events.push(e); >+ c2.onmessage = e => events.push(e); >+ >+ let doneCount = 0; >+ c2.addEventListener('message', t.step_func(e => { >+ if (e.data == 'from worker') { >+ c2.postMessage('from c2'); >+ c1.postMessage('done'); >+ } else if (e.data == 'done') { >+ assert_equals(events.length, 4); >+ assert_equals(events[0].data, 'from worker'); >+ assert_equals(events[0].target, c1); >+ assert_equals(events[1].data, 'from worker'); >+ assert_equals(events[1].target, c2); >+ assert_equals(events[2].data, 'from c2'); >+ assert_equals(events[3].data, 'done'); >+ if (++doneCount == 2) t.done(); >+ } >+ })); >+ >+ let worker = new Worker('resources/worker.js'); >+ worker.onmessage = t.step_func(e => { >+ assert_array_equals(e.data, ['from c2', 'done']); >+ if (++doneCount == 2) t.done(); >+ }); >+ worker.postMessage({channel: 'worker'}); >+ >+ }, 'BroadcastChannel works in workers'); >+ >+async_test(t => { >+ let c1 = new BroadcastChannel('shared worker'); >+ let c2 = new BroadcastChannel('shared worker'); >+ let events = []; >+ >+ c1.onmessage = e => events.push(e); >+ c2.onmessage = e => events.push(e); >+ >+ let doneCount = 0; >+ c2.addEventListener('message', t.step_func(e => { >+ if (e.data == 'from worker') { >+ c2.postMessage('from c2'); >+ c1.postMessage('done'); >+ } else if (e.data == 'done') { >+ assert_equals(events.length, 4); >+ assert_equals(events[0].data, 'from worker'); >+ assert_equals(events[0].target, c1); >+ assert_equals(events[1].data, 'from worker'); >+ assert_equals(events[1].target, c2); >+ assert_equals(events[2].data, 'from c2'); >+ assert_equals(events[3].data, 'done'); >+ if (++doneCount == 2) t.done(); >+ } >+ })); >+ >+ let worker = new SharedWorker('resources/worker.js'); >+ worker.port.onmessage = t.step_func(e => { >+ assert_array_equals(e.data, ['from c2', 'done']); >+ if (++doneCount == 2) t.done(); >+ }); >+ worker.port.postMessage({channel: 'shared worker'}); >+ >+ }, 'BroadcastChannel works in shared workers'); >+ >+async_test(t => { >+ let c = new BroadcastChannel('worker-close'); >+ let events = []; >+ >+ c.onmessage = e => events.push('c1: ' + e.data); >+ >+ let worker = new Worker('resources/worker.js'); >+ worker.onmessage = t.step_func(e => { >+ assert_array_equals(events, ['c1: from worker', 'c2: echo'], >+ 'messages in document'); >+ assert_array_equals(e.data, ['done'], 'messages in worker'); >+ t.done(); >+ }); >+ >+ c.addEventListener('message', e => { >+ if (e.data == 'from worker') { >+ c.close(); >+ if (self.gc) self.gc(); >+ window.setTimeout(() => { >+ let c2 = new BroadcastChannel('worker-close'); >+ c2.onmessage = e => { >+ events.push('c2: ' + e.data); >+ c2.postMessage('done'); >+ }; >+ worker.postMessage({ping: 'echo'}); >+ }, 1); >+ } >+ }); >+ >+ worker.postMessage({channel: 'worker-close'}); >+ >+ }, 'Closing and re-opening a channel works.'); >+ >+async_test(t => { >+ function workerCode() { >+ close(); >+ var bc = new BroadcastChannel('worker-test'); >+ postMessage(true); >+ } >+ >+ var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], {type:"application/javascript"}); >+ >+ var w = new Worker(URL.createObjectURL(workerBlob)); >+ w.onmessage = function(e) { >+ assert_true(e.data, "BroadcastChannel created on worker shutdown."); >+ t.done(); >+ } >+}, 'BroadcastChannel created after a worker self.close()'); >+ >+async_test(t => { >+ function workerCode() { >+ close(); >+ var bc = new BroadcastChannel('worker-test-after-close'); >+ bc.postMessage(true); >+ } >+ >+ var bc = new BroadcastChannel('worker-test-after-close'); >+ bc.onmessage = function(e) { >+ assert_true(e.data, "BroadcastChannel created on worker shutdown."); >+ t.done(); >+ } >+ >+ var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], {type:"application/javascript"}); >+ new Worker(URL.createObjectURL(workerBlob)); >+}, 'BroadcastChannel used after a worker self.close()'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.data.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.data.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..97584c4a390222fe6e1bf3656decc36914ed635d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.data.sub.htm >@@ -0,0 +1,58 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> event.data returns the data of the message </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: event.data returns the data of the message."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var DATA = "STRING"; >+ var TYPE = "string"; >+ var TARGET1 = document.querySelectorAll("iframe")[0]; >+ var TARGET2 = document.querySelectorAll("iframe")[1]; >+ var XORIGIN = "{{location[scheme]}}://{{domains[www]}}" + PORT; >+ var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT; >+ var ExpectedResult = [DATA, TYPE, DATA, TYPE]; >+ var ActualResult = []; >+ var loaded = 0; >+ >+ function PostMessageTest() >+ { >+ loaded++; >+ >+ if (loaded == 2) >+ { >+ TARGET1.contentWindow.postMessage(DATA, XORIGIN); >+ TARGET2.contentWindow.postMessage(DATA, SORIGIN); >+ } >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ if (e.data.toString() === "STRING") { >+ ActualResult.push(e.data, typeof(e.data)); >+ >+ if (ActualResult.length >= ExpectedResult.length) { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ } >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.origin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.origin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..5b1ab3e3c37fe08f8db2f2617b79b534ef816485 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.origin.sub.htm >@@ -0,0 +1,66 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> event.origin returns the origin of the message </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[天æ°ã®è¯ãæ¥]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: event.origin returns the origin of the message."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var TARGET1 = document.querySelectorAll("iframe")[0]; >+ var TARGET2 = document.querySelectorAll("iframe")[1]; >+ var XORIGIN = "{{location[scheme]}}://{{domains[天æ°ã®è¯ãæ¥]}}" + PORT; >+ var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT; >+ var ExpectedResult = ["#1", XORIGIN, "#2", SORIGIN]; >+ var ActualResult = []; >+ var loaded = 0; >+ >+ function PostMessageTest() >+ { >+ loaded++; >+ >+ if (loaded == 2) >+ { >+ TARGET1.contentWindow.postMessage("#1", XORIGIN); >+ TARGET2.contentWindow.postMessage("#2", SORIGIN); >+ } >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ // Messages from TARGET1 and TARGET2 can come in any order >+ // (since one of them is cross-origin and can run in parallel). >+ // To make the tests immune to message reordering, always >+ // put the response from TARGET1 at the start of the list. >+ if (e.data.toString() === "#1") >+ { >+ ActualResult = [e.data, e.origin].concat(ActualResult); >+ } >+ else if (e.data.toString() === "#2") >+ { >+ ActualResult = ActualResult.concat([e.data, e.origin]); >+ } >+ >+ if (ActualResult.length >= ExpectedResult.length) >+ { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.ports.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.ports.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..a4ca24b15ee4328c539198e156e9e1e065ac3067 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.ports.sub.htm >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> event.ports returns the MessagePort array sent with the message </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: event.ports returns the MessagePort array sent with the message."; >+ >+ var t = async_test(description); >+ >+ var DATA = {test: "e.source.postMessage(e.ports.toString(), '*', e.ports)"}; >+ var TARGET = document.querySelector("iframe"); >+ var ExpectedResult = ""; >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_own_property(window, "MessageChannel", "window"); >+ >+ var channel = new MessageChannel(); >+ var ports = [channel.port1, channel.port2]; >+ ExpectedResult = ports.toString(); >+ TARGET.contentWindow.postMessage(DATA, "*", ports); >+ >+ }, "MessageChannel is supported."); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(e.data, ExpectedResult, "e.data"); >+ assert_true(e.ports[0] instanceof MessagePort, e.ports[0] + " instanceof MessageChannel"); >+ assert_true(e.ports[1] instanceof MessagePort, e.ports[1] + " instanceof MessageChannel"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..e270d7def04680c30a41c91ae1b0e2284b24a104 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.htm >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Same-origin: event.source returns the WindowProxy of the source window </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: Same-origin: event.source returns the WindowProxy of the source window."; >+ >+ var t = async_test(description); >+ >+ var DATA = "foo"; >+ var TARGET = document.querySelector("iframe"); >+ var SORIGIN = location.protocol + "//" + location.host; >+ var ExpectedResult = [SORIGIN, "AccessCookieAllowed"]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, SORIGIN); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ try >+ { >+ var sdomainCookie = e.source.document.cookie; >+ ActualResult.push(e.origin, "AccessCookieAllowed"); >+ } >+ catch(ex) >+ { >+ ActualResult.push(e.origin, "AccessCookieDenied"); >+ } >+ >+ assert_true(e.source === TARGET.contentWindow); >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.xorigin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.xorigin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..6190c9624e7c2e95a553efe87eef80b0d2a3816a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.xorigin.sub.htm >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Corss-origin: event.source returns the WindowProxy of the source window </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ var description = "Test Description: Cross-origin: event.source returns the WindowProxy of the source window."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var DATA = "foo"; >+ var TARGET = document.querySelector("iframe"); >+ var XORIGIN = "{{location[scheme]}}://{{domains[www1]}}" + PORT; >+ var ExpectedResult = [XORIGIN, "AccessCookieDenied"]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, XORIGIN); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ try >+ { >+ var sdomainCookie = e.source.document.cookie; >+ ActualResult.push(e.origin, "AccessCookieAllowed"); >+ } >+ catch(ex) >+ { >+ ActualResult.push(e.origin, "AccessCookieDenied"); >+ } >+ >+ assert_true(e.source.parent === window); >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e1dc80749bc2a6327fb48495b08d2fe7d9a381f9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS basic messagechannel test >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001.html >new file mode 100644 >index 0000000000000000000000000000000000000000..12fac8229c6dd4b73fbdca5c0bbb3b6c29082cdf >--- /dev/null >+++ b/LayoutTests/imported/w3c/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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..bf31534a2b7ffd7fdd2b7e10c8f92ed19d9518f3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS without start() >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8b7126718931819d8ac4c4624dc59734adcffb86 >--- /dev/null >+++ b/LayoutTests/imported/w3c/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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9fb61dec411fd80bad154894ab66c95a24beee13 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS onmessage implied start() >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7addaeb0faf55c20e3c5ec896f0cd6660d3ef61b >--- /dev/null >+++ b/LayoutTests/imported/w3c/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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-1.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-1.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b5dd282cdca13b9c20d63bdf19b95b8a0a80824c >--- /dev/null >+++ b/LayoutTests/imported/w3c/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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-2.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-2.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1b8ef0a7a0f020f402f081d05588d5b5751191b6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c05bb4034d120cb264ee6e7cafda0b00dc53699b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS cross-document channel >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004.html >new file mode 100644 >index 0000000000000000000000000000000000000000..19921fef85baf316121d36a00c2f2abc5c5ffb5f >--- /dev/null >+++ b/LayoutTests/imported/w3c/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> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c3e60ba9c0d98aae91a0defd82df2195d634c93c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS Message sent to closed port should not arrive. >+PASS Message sent from closed port should not arrive. >+PASS Message sent to closed port from transferred port should not arrive. >+PASS Inflight messages should be delivered even when sending port is closed afterwards. >+PASS Close in onmessage should not cancel inflight messages. >+FAIL close() detaches a MessagePort (but not the one its entangled with) assert_throws: function "() => self.postMessage(null, "*", [c.port1])" did not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d975ea728327d95def65af0e5875a16dfdfa0289 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.html >@@ -0,0 +1,68 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<link rel="help" href="https://html.spec.whatwg.org/multipage/comms.html#dom-messageport-close"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+// How long (in ms) these tests should wait before deciding no further messages >+// will be received. >+const time_to_wait_for_messages = 100; >+ >+async_test(t => { >+ const c = new MessageChannel(); >+ c.port1.onmessage = t.unreached_func('Should not have delivered message'); >+ c.port1.close(); >+ c.port2.postMessage('TEST'); >+ setTimeout(t.step_func_done(), time_to_wait_for_messages); >+ }, 'Message sent to closed port should not arrive.'); >+ >+async_test(t => { >+ const c = new MessageChannel(); >+ c.port1.onmessage = t.unreached_func('Should not have delivered message'); >+ c.port2.close(); >+ c.port2.postMessage('TEST'); >+ setTimeout(t.step_func_done(), time_to_wait_for_messages); >+ }, 'Message sent from closed port should not arrive.'); >+ >+async_test(t => { >+ const c = new MessageChannel(); >+ c.port1.onmessage = t.unreached_func('Should not have delivered message'); >+ c.port1.close(); >+ const c2 = new MessageChannel(); >+ c2.port1.onmessage = t.step_func(e => { >+ e.ports[0].postMessage('TESTMSG'); >+ setTimeout(t.step_func_done(), time_to_wait_for_messages); >+ }); >+ c2.port2.postMessage('TEST', [c.port2]); >+ }, 'Message sent to closed port from transferred port should not arrive.'); >+ >+async_test(t => { >+ const c = new MessageChannel(); >+ let isClosed = false; >+ c.port1.onmessage = t.step_func_done(e => { >+ assert_true(isClosed); >+ assert_equals(e.data, 'TEST'); >+ }); >+ c.port2.postMessage('TEST'); >+ c.port2.close(); >+ isClosed = true; >+ }, 'Inflight messages should be delivered even when sending port is closed afterwards.'); >+ >+async_test(t => { >+ const c = new MessageChannel(); >+ c.port1.onmessage = t.step_func_done(e => { >+ if (e.data == 'DONE') t.done(); >+ assert_equals(e.data, 'TEST'); >+ c.port1.close(); >+ }); >+ c.port2.postMessage('TEST'); >+ c.port2.postMessage('DONE'); >+ }, 'Close in onmessage should not cancel inflight messages.'); >+ >+test(() => { >+ const c = new MessageChannel(); >+ c.port1.close(); >+ assert_throws("DataCloneError", () => self.postMessage(null, "*", [c.port1])); >+ self.postMessage(null, "*", [c.port2]); >+}, "close() detaches a MessagePort (but not the one its entangled with)"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..a2ae7126420431cc530cd661fabcb34dc2b9f5f0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/w3c-import.log >@@ -0,0 +1,24 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/001.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/002.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/003.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-1.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004-2.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/004.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/close.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5f25d5cf22bea0afcadeb989e31065d1cd6f452d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS MessageChannel/MessagePort created and used after a worker self.close() >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0502021fff138a29b5bd815c589d0f556922db9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/message-channels/worker.html >@@ -0,0 +1,26 @@ >+<!DOCTYPE html> >+<meta charset=utf-8> >+<link rel="help" href="https://html.spec.whatwg.org/multipage/comms.html#messageevent"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+ >+async_test(t => { >+ function workerCode() { >+ close(); >+ var mc = new MessageChannel(); >+ mc.port1.postMessage(42); >+ mc.port2.postMessage(42); >+ postMessage(true); >+ } >+ >+ var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], {type:"application/javascript"}); >+ >+ var w = new Worker(URL.createObjectURL(workerBlob)); >+ w.onmessage = function(e) { >+ assert_true(e.data, "MessageChannel created on worker shutdown."); >+ t.done(); >+ } >+}, 'MessageChannel/MessagePort created and used after a worker self.close()'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e0698475a804246c502e9a66f07be53260317d6a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL The default value of onmessageerror is null assert_equals: body expected (object) null but got (undefined) undefined >+FAIL The onmessageerror content attribute must be compiled into the onmessageerror property assert_equals: The onmessageerror property must be a function expected "function" but got "undefined" >+FAIL The onmessageerror content attribute must execute when an event is dispatched on the window assert_true: Dispatching the event must run the code expected true got false >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2cb51ee3c06c366529f66815587cef455e267666 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror.html >@@ -0,0 +1,44 @@ >+<!DOCTYPE html> >+<title>onmessageerror content attribute</title> >+<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> >+<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-onmessageerror"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+ >+<body> >+ >+<script> >+"use strict"; >+window.messageErrorHappened = false; >+ >+function cleanup() { >+ window.messageErrorHappened = false; >+ document.body.removeAttribute("onmessageerror"); >+} >+ >+test(() => { >+ assert_equals(document.body.onmessageerror, null, "body"); >+ assert_equals(window.onmessageerror, null, "window"); >+}, "The default value of onmessageerror is null"); >+ >+test(t => { >+ t.add_cleanup(cleanup); >+ >+ document.body.setAttribute("onmessageerror", "window.messageErrorHappened = true;") >+ const compiledHandler = document.body.onmessageerror; >+ >+ assert_equals(typeof compiledHandler, "function", "The onmessageerror property must be a function"); >+ compiledHandler(); >+ assert_true(window.messageErrorHappened, "Calling the handler must run the code"); >+}, "The onmessageerror content attribute must be compiled into the onmessageerror property"); >+ >+test(t => { >+ t.add_cleanup(cleanup); >+ >+ document.body.setAttribute("onmessageerror", "window.messageErrorHappened = true;") >+ >+ window.dispatchEvent(new Event("messageerror")); >+ >+ assert_true(window.messageErrorHappened, "Dispatching the event must run the code"); >+}, "The onmessageerror content attribute must execute when an event is dispatched on the window"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..457cf94fa56dcb60b92aaded544d3cd251b99f3a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm >@@ -0,0 +1,44 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with ArrayBuffer object </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: postMessage with ArrayBuffer object."; >+ >+ var t = async_test(description); >+ >+ var DATA; >+ var TYPE = "object"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ DATA = new ArrayBuffer(32); >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ }, "ArrayBuffer is supported."); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(typeof(e.data), TYPE); >+ assert_equals(e.data.toString(), DATA.toString()); >+ assert_equals(e.data.byteLength, 32); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Date.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Date.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..0f89738f3add51ddd3fd9f911705d52059b3fa3f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Date.sub.htm >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with Date object </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: Messages can contain JavaScript values (e.g., Dates)."; >+ >+ var t = async_test(description); >+ >+ var DATA = new Date(); >+ var TYPE = "object"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(typeof(e.data), TYPE); >+ assert_equals(e.data.valueOf(), DATA.valueOf()); >+ assert_not_equals(e.data, DATA, "Object is cloned"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..843319164b6f6bc11bd70d34db0d4d8f8759ccf2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: postMessage with Document object: Throw a DataCloneError if message could not be cloned. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..97765fae818751354a38ddc6068c58aaf2605025 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document.htm >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with Document object </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "postMessage with Document object: Throw a DataCloneError if message could not be cloned."; >+ >+ var DATA = document; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_throws("DATA_CLONE_ERR", function() >+ { >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ }); >+ }, description); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..808081a3da82d0eb108f05b5999ad39a3e382a3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: postMessage with Function object: Throw a DataCloneError if message could not be cloned. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..c53e8fcc3cd24cf8f3acafae1f320ebbf443411d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function.htm >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with Function object </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "postMessage with Function object: Throw a DataCloneError if message could not be cloned."; >+ >+ var DATA = new Function(); >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_throws("DATA_CLONE_ERR", function() >+ { >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ }); >+ }, description); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..6526e972c482999800fc5328899fdca1dd6f6a04 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm >@@ -0,0 +1,76 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage to same-origin iframe with MessagePort array [100 ports] </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: postMessage to same-origin iframe with MessagePort array containing 100 ports."; >+ >+ var t = async_test(description); >+ >+ var TOTALPORTS = 100; >+ var LocalPorts = []; >+ var RemotePorts = []; >+ var PassedResult = 0; >+ var sum = 0; >+ var TARGET = document.querySelector("iframe").contentWindow; >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_own_property(window, "MessageChannel", "window"); >+ >+ var channels = []; >+ >+ for (var i=0; i<TOTALPORTS; i++) >+ { >+ channels[i] = new MessageChannel(); >+ LocalPorts[i] = channels[i].port1; >+ LocalPorts[i].foo = i; >+ RemotePorts[i] = channels[i].port2; >+ >+ LocalPorts[i].onmessage = t.step_func(function(e) >+ { >+ assert_equals(e.target.foo, e.data); >+ >+ PassedResult++; >+ sum += e.data; >+ >+ if (PassedResult == TOTALPORTS) >+ { >+ assert_equals(sum, 4950); >+ t.done(); >+ } >+ }); >+ } >+ >+ TARGET.postMessage("ports", "*", RemotePorts); >+ >+ }, "MessageChannel is supported."); >+ } >+ >+ window.onmessage = function(e) >+ { >+ if (e.data === "ports") >+ { >+ for (var i=0; i<TOTALPORTS; i++) >+ { >+ LocalPorts[i].postMessage(LocalPorts[i].foo); >+ } >+ } >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..cf2b8eb4c11b0b824a47677079c2d1b8837b3802 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm >@@ -0,0 +1,76 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage to cross-origin iframe with MessagePort array [100 ports] </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: postMessage to cross-origin iframe with MessagePort array containing 100 ports."; >+ >+ var t = async_test(description); >+ >+ var TOTALPORTS = 100; >+ var LocalPorts = []; >+ var RemotePorts = []; >+ var PassedResult = 0; >+ var sum = 0; >+ var TARGET = document.querySelector("iframe").contentWindow; >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_own_property(window, "MessageChannel", "window"); >+ >+ var channels = []; >+ >+ for (var i=0; i<TOTALPORTS; i++) >+ { >+ channels[i] = new MessageChannel(); >+ LocalPorts[i] = channels[i].port1; >+ LocalPorts[i].foo = i; >+ RemotePorts[i] = channels[i].port2; >+ >+ LocalPorts[i].onmessage = t.step_func(function(e) >+ { >+ assert_equals(e.target.foo, e.data); >+ >+ PassedResult++; >+ sum += e.data; >+ >+ if (PassedResult == TOTALPORTS) >+ { >+ assert_equals(sum, 4950); >+ t.done(); >+ } >+ }); >+ } >+ >+ TARGET.postMessage("ports", "*", RemotePorts); >+ >+ }, "MessageChannel is supported."); >+ } >+ >+ window.onmessage = function(e) >+ { >+ if (e.data === "ports") >+ { >+ for (var i=0; i<TOTALPORTS; i++) >+ { >+ LocalPorts[i].postMessage(LocalPorts[i].foo); >+ } >+ } >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_arrays.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_arrays.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..41e4a75eda616196ab3546943a0913785cbe69be >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_arrays.sub.htm >@@ -0,0 +1,39 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with arrays </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: Messages can be structured objects, e.g., arrays."; >+ >+ var t = async_test(description); >+ >+ var DATA = [1,2,3,4,5,6,7,8]; >+ var TYPE = "object"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(typeof(e.data), TYPE); >+ assert_array_equals(e.data, DATA); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..532f28251cb36159946ef3d0e99ce9b4ccbe92e2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm >@@ -0,0 +1,66 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Cross-origin postMessage with targetOrigin == "*" </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: To send the message to the target regardless of origin, set the target origin to '*'."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var TARGET1 = document.querySelectorAll("iframe")[0]; >+ var TARGET2 = document.querySelectorAll("iframe")[1]; >+ var XORIGIN = "{{location[scheme]}}://{{domains[www]}}" + PORT; >+ var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT; >+ var ExpectedResult = ["#1", XORIGIN, "#2", SORIGIN]; >+ var ActualResult = []; >+ var loaded = 0; >+ >+ function PostMessageTest() >+ { >+ loaded++; >+ >+ if (loaded == 2) >+ { >+ TARGET1.contentWindow.postMessage("#1", "*"); >+ TARGET2.contentWindow.postMessage("#2", "*"); >+ } >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ // Messages from TARGET1 and TARGET2 can come in any order >+ // (since one of them is cross-origin and can run in parallel). >+ // To make the tests immune to message reordering, always >+ // put the response from TARGET1 at the start of the list. >+ if (e.data.toString() === "#1") >+ { >+ ActualResult = [e.data, e.origin].concat(ActualResult); >+ } >+ else if (e.data.toString() === "#2") >+ { >+ ActualResult = ActualResult.concat([e.data, e.origin]); >+ } >+ >+ if (ActualResult.length >= ExpectedResult.length) >+ { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..40deb1e891d33d65a86b8e0ad65511e39311c738 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: postMessage with duplicate transfer objects raises DataCloneError exception. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..a28c9640067d505bf5aaff328bfa0b5c8b7dd9f8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects.htm >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with duplicate transfer objects raises DataCloneError exception </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "postMessage with duplicate transfer objects raises DataCloneError exception."; >+ >+ var DATA = "ports"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_throws("DATA_CLONE_ERR", function() >+ { >+ assert_own_property(window, "MessageChannel", "window"); >+ var channel = new MessageChannel(); >+ TARGET.contentWindow.postMessage(DATA, "*", [channel.port1, channel.port1]); >+ }); >+ }, description); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1186985fefead8e1307480f672ac1771c8aec4df >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Test Description: If the value of the targetOrigin argument is neither a single U+002A ASTERISK character (*), a single U+002F SOLIDUS character (/), nor an absolute URL, then throw a SyntaxError exception and abort the overall set of steps. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..d6e16460f192f37a84b5f173350992b168ba7a6e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin.htm >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with invalid targetOrigin raises SyntaxError exception </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "If the value of the targetOrigin argument is neither a single U+002A ASTERISK character (*), " + >+ "a single U+002F SOLIDUS character (/), nor an absolute URL, then throw a SyntaxError exception " + >+ "and abort the overall set of steps."; >+ >+ var DATA = "InvalidOrigin"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ test(function() >+ { >+ assert_throws("SYNTAX_ERR", function() >+ { >+ TARGET.contentWindow.postMessage(DATA, DATA); >+ }); >+ }, description); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_objects.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_objects.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..dab207188afbb48601c1ae12cec18cd2b080fd96 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_objects.sub.htm >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> postMessage with nested objects </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: Messages can be structured objects, e.g., nested objects."; >+ >+ var t = async_test(description); >+ >+ var DATA = {foo: {bar: "wow"}}; >+ var TYPE = "object"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(typeof(e.data), TYPE); >+ assert_equals(typeof(e.data.foo), TYPE); >+ assert_object_equals(e.data, DATA); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..6c8ac8353a77224d14b2107779b3e69148bfb831 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Same-origin: Origin of the target window doesn't match the given origin </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "Same-origin: If the origin of the target window doesn't match the given origin, " + >+ "the message is discarded."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var TARGET = document.querySelector("iframe"); >+ var XORIGIN = "{{location[scheme]}}://{{domains[www1]}}" + PORT; >+ var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT; >+ var ExpectedResult = ["#0", SORIGIN, "#3", SORIGIN]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage("#0", SORIGIN); >+ TARGET.contentWindow.postMessage("#1", "http://www.invalid-domain.com"); >+ TARGET.contentWindow.postMessage("#2", XORIGIN); >+ TARGET.contentWindow.postMessage("#3", "*"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ ActualResult.push(e.data, e.origin); >+ >+ if (ActualResult.length >= ExpectedResult.length) >+ { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..d8e38e2919fb539cd25da785815c45e55db1eecd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Cross-origin: Origin of the target window doesn't match the given origin </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "Cross-origin: If the origin of the target window doesn't match the given origin, " + >+ "the message is discarded."; >+ >+ var t = async_test(description); >+ >+ var PORT = location.port !== "" ? ":" + location.port : ""; >+ var TARGET = document.querySelector("iframe"); >+ var XORIGIN = "{{location[scheme]}}://{{domains[www1]}}" + PORT; >+ var SORIGIN = "{{location[scheme]}}://{{host}}" + PORT; >+ var ExpectedResult = ["#0", XORIGIN, "#3", XORIGIN]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage("#0", XORIGIN); >+ TARGET.contentWindow.postMessage("#1", "http://www.invalid-domain.com"); >+ TARGET.contentWindow.postMessage("#2", SORIGIN); >+ TARGET.contentWindow.postMessage("#3", "*"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ ActualResult.push(e.data, e.origin); >+ >+ if (ActualResult.length >= ExpectedResult.length) >+ { >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ } >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..92f5afb7985731ea35215b2acd3d76b90274fa6a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Same-origin postMessage with targetOrigin == "/" </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "To restrict the message to same-origin targets only, without needing to explicitly " + >+ "state the origin, set the target origin to '/'."; >+ >+ var t = async_test(description); >+ >+ var DATA = "/"; >+ var TARGET = document.querySelector("iframe"); >+ var SORIGIN = location.protocol + "//" + location.host; >+ var ExpectedResult = [DATA, SORIGIN]; >+ var ActualResult = []; >+ >+ function PostMessageTest() >+ { >+ TARGET.contentWindow.postMessage(DATA, "/"); >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ ActualResult.push(e.data, e.origin); >+ assert_array_equals(ActualResult, ExpectedResult, "ActualResult"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..eebc85432fe4d6d8136326492fc8442c7939d454 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<title> Cross-origin postMessage with targetOrigin == "/" </title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+</head> >+<body> >+<div id=log></div> >+ >+<div style="display:none"> >+ <iframe width="70%" onload="PostMessageTest()" src="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe> >+</div> >+ >+<script> >+ >+ >+ var description = "Test Description: " + >+ "If the targetOrigin argument is a single literal U+002F SOLIDUS character (/), and " + >+ "the Document of the Window object on which the method was invoked does not have the " + >+ "same origin as the entry script's document, then abort these steps silently."; >+ >+ var t = async_test(description); >+ >+ var DATA = "NoExceptionRaised"; >+ var TARGET = document.querySelector("iframe"); >+ >+ function PostMessageTest() >+ { >+ try >+ { >+ TARGET.contentWindow.postMessage("/", "/"); >+ TARGET.contentWindow.postMessage(DATA, "*"); >+ } >+ catch(ex) >+ { >+ TARGET.contentWindow.postMessage("ExceptionRaised", "*"); >+ } >+ } >+ >+ window.onmessage = t.step_func(function(e) >+ { >+ assert_equals(e.data, DATA, "e.data"); >+ t.done(); >+ }); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..9b0f8f1c3708602176783c8b2521c9c66e110777 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/w3c-import.log >@@ -0,0 +1,54 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_Blob.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_DataCloneErr.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_clone_port_error.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_event_properties.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_ports_readonly_array.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Channel_postMessage_target_source.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/META.yml >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted-worker.js >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent-trusted.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_onmessage_postMessage_infinite_loop.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessageEvent_properties.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_initial_disabled.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/MessagePort_onmessage_start.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/README.md >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/Transferred_objects_unusable.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.data.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.origin.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.ports.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/event.source.xorigin.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/messageerror.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_ArrayBuffer.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Date.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Document.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_Function.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_sorigin.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_MessagePorts_xorigin.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_arrays.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_asterisk_xorigin.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_dup_transfer_objects.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_invalid_targetOrigin.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_objects.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_origin_mismatch_xorigin.sub.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_sorigin.htm >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/postMessage_solidus_xorigin.sub.htm >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4791191bc7aa0131d2cea9ccd0b160558df1cd20 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving broken url >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e3687f16226aff75493b37b5eedb75b6006a9982 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001.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('SYNTAX_ERR', function() { >+ postMessage('', 'http://foo bar', []); >+ }, 'should have failed to resolve'); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..54fc888bbd44dbf9cd635904ee1708402c35e02d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving url with stuff in host-specific >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f7d085937cd5776fd9be5ede6a0417844c88d864 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002.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('', location.protocol + '//' + location.host + '//', []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e9a59367c643c533c0fe5edeb434de99f95aa2c6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving 'example.org' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3c0d4296b07e85f7b5fd9bd3e9f7fe9bf8cdd9b1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003.html >@@ -0,0 +1,12 @@ >+<!doctype html> >+<title>resolving 'example.org'</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+test(function() { >+ assert_throws('SYNTAX_ERR', function() { >+ postMessage('', 'example.org', []); >+ }, 'targetOrigin is not an absolute url'); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2f447aada4e2658f18d7f1017d697e0a5e5320d3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS special value '/' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d129ad119a8d229d4e20647f80f80fe4a6bb07e1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004.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('', '/', []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7acb2318517166f9c849da42e7f7ff3fba8f56d1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving a same origin targetOrigin >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e803968919836cdbbd65f2c62e2f09b1907d9498 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>resolving a same origin targetOrigin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ postMessage('', location.protocol + '//' + location.host, []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e83eead997dbbc9e6885c7bcd15a068f9613b742 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving a same origin targetOrigin with trailing slash >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4e3f1ede8414b5664fedf1b9af03f25e6ee3678a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>resolving a same origin targetOrigin with trailing slash</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ postMessage('', location.protocol + '//' + location.host + '/', []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5f7931f1f96520cba207040c7241825051b3db6f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS targetOrigin '*' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c049a1337d32ede71cd625a16ad6db9f12b65350 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f3ce64556919c533debeb7e119311ce013e86327 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS undefined >+PASS null >+PASS false >+PASS true >+PASS 1 >+PASS NaN >+PASS Infinity >+PASS string >+FAIL date Can't find variable: sameDate >+PASS regex >+PASS self >+FAIL array Can't find variable: assert_array_equals_ >+FAIL object Can't find variable: assert_object_equals_ >+PASS error >+PASS unreached >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010.html >new file mode 100644 >index 0000000000000000000000000000000000000000..05080e3f7ae85a8b276569c6d532e9959bb78646 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010.html >@@ -0,0 +1,113 @@ >+<!doctype html> >+<title>message clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="../support/compare.js"></script> >+<div id=log></div> >+<script> >+ var err = new Error('foo'); >+ var date = new Date(); >+ >+ var test_array = [ undefined, >+ null, >+ false, >+ true, >+ 1, >+ NaN, >+ Infinity, >+ 'foo', >+ date, >+ /foo/, >+ null/*self*/, >+ null/*err*/]; >+ >+ var cloned_array = [ undefined, >+ null, >+ false, >+ true, >+ 1, >+ NaN, >+ Infinity, >+ 'foo', >+ date, >+ /foo/, >+ null/*self*/, >+ null/*err*/]; >+ >+ var test_object = {a: undefined, >+ b: null, >+ c: false, >+ d: true, >+ e: 1, >+ f: NaN, >+ g: Infinity, >+ h: 'foo', >+ i: date, >+ j: /foo/, >+ k: null/*self*/, >+ l: [], >+ m: {}, >+ n: null /*err*/}; >+ >+ var cloned_object = {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', i: date, j: /foo/, k:null, l: [], m: {}, n:null}; >+ >+ var tests = [undefined, null, >+ false, true, >+ 1, NaN, Infinity, >+ 'foo', >+ date, >+ /foo/, >+ /* ImageData, File, FileData, FileList, */ >+ null /*self*/, >+ test_array, >+ test_object, >+ null /*err*/]; >+ >+ for (var i = 0; i < tests.length; ++i) { >+ postMessage(tests[i], '*', []); >+ } >+ >+ var test_undefined = async_test('undefined'); >+ var test_null = async_test('null'); >+ var test_false = async_test('false'); >+ var test_true = async_test('true'); >+ var test_1 = async_test('1'); >+ var test_NaN = async_test('NaN'); >+ var test_Infinity = async_test('Infinity'); >+ var test_string = async_test('string'); >+ var test_date = async_test('date'); >+ var test_regex = async_test('regex'); >+ var test_self = async_test('self'); >+ var test_array = async_test('array'); >+ var test_object = async_test('object'); >+ var test_error = async_test('error'); >+ var test_unreached = async_test('unreached'); >+ >+ var j = 0; >+ onmessage = function(e) { >+ switch (j) { >+ case 0: test_undefined.step(function() { assert_equals(e.data, undefined); this.done(); }); break; >+ case 1: test_null.step(function() { assert_equals(e.data, null); this.done(); }); break; >+ case 2: test_false.step(function() { assert_false(e.data); this.done(); }); break; >+ case 3: test_true.step(function() { assert_true(e.data); this.done(); }); break; >+ case 4: test_1.step(function() { assert_equals(e.data, 1); this.done(); }); break; >+ case 5: test_NaN.step(function() { assert_equals(e.data, NaN); this.done(); }); break; >+ case 6: test_Infinity.step(function() { assert_equals(e.data, Infinity); this.done(); }); break; >+ case 7: test_string.step(function() { assert_equals(e.data, 'foo'); this.done(); }); break; >+ case 8: test_date.step(function() { assert_true(sameDate(e.data, date)); this.done(); }); break; >+ case 9: test_regex.step(function() { assert_equals('' + e.data, '/foo/'); assert_equals(e.data instanceof RegExp, true, 'e.data instanceof RegExp'); this.done(); }); break; >+ // not testing it any more, as cloning host objects will now raise exceptions. TODO: add (exceptional) tests for these. >+ case 10: test_self.step(function() { assert_equals(e.data, null); this.done(); }); break; >+ case 11: test_array.step(function() { assert_array_equals_(e.data, cloned_array, 'array'); this.done(); }); break; >+ case 12: test_object.step(function() { assert_object_equals_(e.data, cloned_object, 'object'); this.done(); }); break; >+ case 13: >+ test_error.step(function() { assert_equals(e.data, null, 'new Error()'); this.done(); }); >+ setTimeout(test_unreached.step_func(function() { assert_equals(j, 14); this.done(); }), 50); >+ break; >+ default: test_unreached.step(function() { assert_unreached('got an unexpected message event ('+j+')'); }); >+ }; >+ j++; >+ } >+ >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..78195c84408644b6daa5449d5b9532fe80f7d2dd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS posting an imagedata (from a cloned canvas) in an array >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011.html >new file mode 100644 >index 0000000000000000000000000000000000000000..782b3208ba4b69c35a595aab7b6d3e1ba2945e66 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011.html >@@ -0,0 +1,29 @@ >+<!doctype html> >+<title>posting an imagedata (from a cloned canvas) in an array</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ >+ var canvas = document.createElement('canvas'); >+ var clone = canvas.cloneNode(true); >+ var ctx = clone.getContext('2d'); >+ var imagedata = ctx.getImageData(0, 0, 300, 150); >+ postMessage([imagedata], '*', []); >+ >+ onmessage = this.step_func(function(e) { >+ function processPixels(imagedata) { >+ var pixeldata = imagedata.data; >+ for (var i = 0; i < pixeldata.length; i = i+4) { >+ pixeldata[i] = 128; >+ assert_equals(pixeldata[i], 128); >+ } >+ } >+ processPixels(e.data[0]); >+ this.done(); >+ }); >+ >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dee05dc35f71f7e03489d12c17c1112d86a33d21 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS loop in array in structured clone >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6efe4c114ab00e496733a1edda1b497993d8ccd4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012.html >@@ -0,0 +1,16 @@ >+<!doctype html> >+<title>loop in array in structured clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ var x = []; >+ x[0] = x; >+ postMessage(x, '*', []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, e.data[0]); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5c11efb879162cd5287b80afe1ff69164a691ec8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS loop in object in structured clone >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013.html >new file mode 100644 >index 0000000000000000000000000000000000000000..248958ea108c17436a3df5479ea3005270106d2f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<title>loop in object in structured clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ var x = {}; >+ x.foo = x; >+ postMessage(x, '*', []); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, e.data.foo); >+ this.done(); >+ }); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..07d85622c0686c9c526b9331f12640da6c0e3c4a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS structured clone vs reference >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3c970c42adea807a37a19d502c5c46f054e32a69 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<title>structured clone vs reference</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function(t) { >+ var x = []; >+ y = [x,x]; >+ postMessage(y, '*', []); >+ onmessage = t.step_func(function(e) { >+ assert_equals(e.data[0], e.data[1], 'e.data[0] === e.data[1]'); >+ assert_not_equals(e.data[0], x, 'e.data[0] !== x'); >+ t.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b2c6d6f6780c6c0b1d6abd4973a2998aae579212 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015-expected.txt >@@ -0,0 +1,5 @@ >+CONSOLE MESSAGE: Unable to post message to http://example.org. Recipient has origin http://localhost:8800. >+ >+ >+PASS different origin >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a17c97be19a1d5972d1fa4af409f2bfe520759cf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015.html >@@ -0,0 +1,15 @@ >+<!doctype html> >+<title>different origin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ postMessage('', 'http://example.org', []); >+ onmessage = this.step_func(function(e) { >+ assert_unreached(); >+ }); >+ setTimeout(this.step_func(function(){ this.done(); }), 50); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ebb54fb22b60f3dddd18eee7c67770bb009c3cbb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, data: >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016.html >new file mode 100644 >index 0000000000000000000000000000000000000000..51cadec7c17609fd39ebbc8fa67b03abebc3f241 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016.html >@@ -0,0 +1,23 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, data:</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="data:text/html,<script>onmessage = function(e) { parent.postMessage(e.origin, '*'); }; parent.postMessage('loaded', '*');</script>"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ onmessage = this.step_func(function(e) { >+ if (e.data === 'loaded') { >+ window[0].postMessage('', '*'); >+ return; >+ } >+ >+ assert_equals(e.data, location.protocol + '//' + location.host); >+ assert_equals(e.origin, 'null'); >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dd4d946d7cad123dc931c16a97cd1a0824ab7509 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, about:blank >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017.html >new file mode 100644 >index 0000000000000000000000000000000000000000..94cd3e6ae2d8a6e6ea19bbe652a7fcdfc1b9c463 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017.html >@@ -0,0 +1,18 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, about:blank</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="about:blank"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ window[0].postMessage('', '*', []); >+ window[0].onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6bf533b33e5dc8f74f9af59cc8a6bf11ff22eea6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, javascript: >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5525206e44483dd73a3abf84465335a4af2ffc49 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018.html >@@ -0,0 +1,18 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, javascript:</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="javascript:''"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ window[0].postMessage('', '*', []); >+ window[0].onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8efab48a20a3851522914205e5d0e20d8998d77d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, scheme/host/port >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e9de6c36e1faaeea6fa43784444f9f300ffb3a3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019.html >@@ -0,0 +1,20 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, scheme/host/port</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/019-1.html"></iframe> >+<div id=log></div> >+<script> >+async_test(function(test) { >+ onload = test.step_func(function() { >+ window[0].postMessage('', location.protocol.toUpperCase() + '//' + location.host.toUpperCase() + '/', []); >+ window[0].onmessage = test.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ assert_array_equals(e.ports, []); >+ test.done(); >+ }); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/020.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/020.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4fc2c4e2dd9a81057f1978f4bafc00bd5e8baa44 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/020.html >@@ -0,0 +1,30 @@ >+<!doctype html> >+<title>cross-origin test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/020-1.html"></iframe> >+<div id="log"></div> >+<script> >+var iframe = document.createElement('iframe'); >+var url_prefix = location.href.replace('://', '://www1.').replace(/\/with(out)?-ports\/[^\/]+$/, ''); >+var url = url_prefix + '/without-ports/020-1.html'; >+iframe.src = url; >+document.body.appendChild(iframe); >+</script> >+<div id=log></div> >+<script> >+onload = function() { >+ window[0].postMessage(1, location.href, []); >+ window[1].postMessage(2, url, []); >+ var i = 0; >+ onmessage = function(e) { >+ i++; >+ assert_equals(e.data[0], i); >+ assert_equals(e.data[1], location.protocol + '//' + location.host); >+ if (i === 2) { >+ done(); >+ } >+ }; >+}; >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/021.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/021.html >new file mode 100644 >index 0000000000000000000000000000000000000000..37a0767fee0f0266e1b933b049242aaf698455c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/021.html >@@ -0,0 +1,30 @@ >+<!doctype html> >+<title>cross-origin test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/020-1.html"></iframe> >+<div id="log"></div> >+<script> >+var iframe = document.createElement('iframe'); >+var url_prefix = location.href.replace('://', '://www1.').replace(/\/with(out)?-ports\/[^\/]+$/, ''); >+var url = url_prefix + '/without-ports/020-1.html'; >+iframe.src = url; >+document.body.appendChild(iframe); >+</script> >+<div id=log></div> >+<script> >+onload = function() { >+ window[0].postMessage(1, '*', []); >+ window[1].postMessage(2, '*', []); >+ var i = 0; >+ onmessage = function(e) { >+ i++; >+ assert_equals(e.data[0], i); >+ assert_equals(e.data[1], location.protocol + '//' + location.host); >+ if (i === 2) { >+ done(); >+ } >+ }; >+}; >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1aaae9a1a0a601d4d887386d649acbd09619e44c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS null ports >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023.html >new file mode 100644 >index 0000000000000000000000000000000000000000..da6a5c49a448c2ce502fe09a0693ce15abb6e00d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023.html >@@ -0,0 +1,11 @@ >+<!doctype html> >+<title>null ports</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+test(function(t) { >+ assert_throws(new TypeError, () => postMessage('', '*', null)); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..16bdd9c894311582e2e503b898354aaa9b125369 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS undefined as ports >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e6c0dcba08676ae72e488302135dfc0d41c9c4c9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024.html >@@ -0,0 +1,15 @@ >+<!doctype html> >+<title>undefined as ports</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ postMessage('', '*', undefined); >+ onmessage = this.step_func(function(e) { >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..36a7fa5826c4b8f8b327d51d48c3bd81b768b32b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS 1 as ports >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9a0e5cf6ffb729d7949e4073d75d3c4595800a16 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025.html >@@ -0,0 +1,13 @@ >+<!doctype html> >+<title>1 as ports</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+test(function() { >+ assert_throws(new TypeError(), function() { >+ postMessage('', '*', 1); >+ }); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9623bed9cb90a3fd14a4752bab77b72e47c98ede >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS object with length as transferable >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cf5c5e18ae5cd4a7bb69f7aed59fee3e3d960c4b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026.html >@@ -0,0 +1,13 @@ >+<!doctype html> >+<title>object with length as transferable</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+test(function() { >+ assert_throws(new TypeError(), function() { >+ postMessage('', '*', {length:1}); >+ }); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ba107a85a6467e4edf39ef7ae0c4a150f09c1d10 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS MessageChannel's ports as MessagePort objects >+PASS Old-style array objects >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e5f8c9c14abeaf779c5e59f4ce2e1b9aea1a5ec0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027.html >@@ -0,0 +1,26 @@ >+<!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('', '*', [channel.port1, channel.port2]); >+ onmessage = t.step_func(function(e) { >+ assert_equals(e.ports.length, 2); >+ t.done(); >+ }); >+}, "MessageChannel's ports as MessagePort objects"); >+ >+test(() => { >+ var channel = new MessageChannel(); >+ channel[0] = channel.port1; >+ channel[1] = channel.port2; >+ channel.length = 2; >+ assert_throws(new TypeError(), >+ () => { postMessage('', '*', channel) }, >+ 'Old-style WebIDL arrays must throw a type error'); >+}, "Old-style array objects"); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..f8d406ef940c8ad056959b29c4bc68d9d659a05c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/w3c-import.log >@@ -0,0 +1,40 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/001.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/002.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/003.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/004.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/005.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/006.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/007.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/010.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/011.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/012.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/013.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/014.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/015.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/016.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/017.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/018.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/019.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/020.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/021.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/023.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/024.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/025.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/026.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/with-ports/027.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4791191bc7aa0131d2cea9ccd0b160558df1cd20 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving broken url >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8f77c31fc61046fdd1d8783917793dda7a388c8f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001.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('SYNTAX_ERR', function() { >+ postMessage('', 'http://foo bar'); >+ }, 'should have failed to resolve'); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..54fc888bbd44dbf9cd635904ee1708402c35e02d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving url with stuff in host-specific >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ef3eceb2a0231b4fab4605dbfe356abc62cd6ba7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002.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('', location.protocol + '//' + location.host + '//'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e9a59367c643c533c0fe5edeb434de99f95aa2c6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving 'example.org' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5021e09f46b37b987aa99652b229bf415bebc735 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003.html >@@ -0,0 +1,12 @@ >+<!doctype html> >+<title>resolving 'example.org'</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+test(function() { >+ assert_throws('SYNTAX_ERR', function() { >+ postMessage('', 'example.org'); >+ }, 'targetOrigin is not an absolute url'); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2f447aada4e2658f18d7f1017d697e0a5e5320d3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS special value '/' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9a9eb81a5de844f44e43e6f1e55d06dbfddbdc65 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004.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('', '/'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7acb2318517166f9c849da42e7f7ff3fba8f56d1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving a same origin targetOrigin >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ed05a476bc45a4e2c3660f80e9c08c498549f509 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>resolving a same origin targetOrigin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ postMessage('', location.protocol + '//' + location.host); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e83eead997dbbc9e6885c7bcd15a068f9613b742 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS resolving a same origin targetOrigin with trailing slash >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006.html >new file mode 100644 >index 0000000000000000000000000000000000000000..47479ea01184f30e97433c462bc765c5c85344e0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>resolving a same origin targetOrigin with trailing slash</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ postMessage('', location.protocol + '//' + location.host + '/'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, ''); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5f7931f1f96520cba207040c7241825051b3db6f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS targetOrigin '*' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007.html >new file mode 100644 >index 0000000000000000000000000000000000000000..eb2b5c52e56f3ed1d3aa20c16e5ec099213efac0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>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/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c4925fc6bab392d4d1eaf93d2546e1499c2180e7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS just one argument >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008.html >new file mode 100644 >index 0000000000000000000000000000000000000000..30bf607f3577e6b4220893c436a7f8bfd8f60fa6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008.html >@@ -0,0 +1,12 @@ >+<!doctype html> >+<title>just one argument</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+test(function() { >+ assert_throws(new TypeError(), function() { >+ postMessage(''); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..255a1a5f76b7399c78dff6b34075ad3569c17b60 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS zero arguments >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009.html >new file mode 100644 >index 0000000000000000000000000000000000000000..779383da203902aa5c34e1e3085e43467dc9c4a0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009.html >@@ -0,0 +1,12 @@ >+<!doctype html> >+<title>zero arguments</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+test(function() { >+ assert_throws(new TypeError(), function() { >+ postMessage(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f3ce64556919c533debeb7e119311ce013e86327 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS undefined >+PASS null >+PASS false >+PASS true >+PASS 1 >+PASS NaN >+PASS Infinity >+PASS string >+FAIL date Can't find variable: sameDate >+PASS regex >+PASS self >+FAIL array Can't find variable: assert_array_equals_ >+FAIL object Can't find variable: assert_object_equals_ >+PASS error >+PASS unreached >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010.html >new file mode 100644 >index 0000000000000000000000000000000000000000..062316f68039e1a1d71f0b7b145b330efd7e3d5e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010.html >@@ -0,0 +1,112 @@ >+<!doctype html> >+<title>message clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="../support/compare.js"></script> >+<div id=log></div> >+<script> >+ var err = new Error('foo'); >+ var date = new Date(); >+ >+ var test_array = [ undefined, >+ null, >+ false, >+ true, >+ 1, >+ NaN, >+ Infinity, >+ 'foo', >+ date, >+ /foo/, >+ null/*self*/, >+ null/*err*/]; >+ >+ var cloned_array = [ undefined, >+ null, >+ false, >+ true, >+ 1, >+ NaN, >+ Infinity, >+ 'foo', >+ date, >+ /foo/, >+ null/*self*/, >+ null/*err*/]; >+ >+ var test_object = {a: undefined, >+ b: null, >+ c: false, >+ d: true, >+ e: 1, >+ f: NaN, >+ g: Infinity, >+ h: 'foo', >+ i: date, >+ j: /foo/, >+ k: null/*self*/, >+ l: [], >+ m: {}, >+ n: null /*err*/}; >+ >+ var cloned_object = {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', i: date, j: /foo/, k:null, l: [], m: {}, n:null}; >+ >+ var tests = [undefined, null, >+ false, true, >+ 1, NaN, Infinity, >+ 'foo', >+ date, >+ /foo/, >+ /* ImageData, File, FileData, FileList, */ >+ null /*self*/, >+ test_array, >+ test_object, >+ null /*err*/]; >+ >+ for (var i = 0; i < tests.length; ++i) { >+ postMessage(tests[i], '*'); >+ } >+ >+ var test_undefined = async_test('undefined'); >+ var test_null = async_test('null'); >+ var test_false = async_test('false'); >+ var test_true = async_test('true'); >+ var test_1 = async_test('1'); >+ var test_NaN = async_test('NaN'); >+ var test_Infinity = async_test('Infinity'); >+ var test_string = async_test('string'); >+ var test_date = async_test('date'); >+ var test_regex = async_test('regex'); >+ var test_self = async_test('self'); >+ var test_array = async_test('array'); >+ var test_object = async_test('object'); >+ var test_error = async_test('error'); >+ var test_unreached = async_test('unreached'); >+ >+ var j = 0; >+ onmessage = function(e) { >+ switch (j) { >+ case 0: test_undefined.step(function() { assert_equals(e.data, undefined); this.done(); }); break; >+ case 1: test_null.step(function() { assert_equals(e.data, null); this.done(); }); break; >+ case 2: test_false.step(function() { assert_false(e.data); this.done(); }); break; >+ case 3: test_true.step(function() { assert_true(e.data); this.done(); }); break; >+ case 4: test_1.step(function() { assert_equals(e.data, 1); this.done(); }); break; >+ case 5: test_NaN.step(function() { assert_equals(e.data, NaN); this.done(); }); break; >+ case 6: test_Infinity.step(function() { assert_equals(e.data, Infinity); this.done(); }); break; >+ case 7: test_string.step(function() { assert_equals(e.data, 'foo'); this.done(); }); break; >+ case 8: test_date.step(function() { assert_true(sameDate(e.data, date)); this.done(); }); break; >+ case 9: test_regex.step(function() { assert_equals('' + e.data, '/foo/'); assert_equals(e.data instanceof RegExp, true, 'e.data instanceof RegExp'); this.done(); }); break; >+ // not testing it any more, as cloning host objects will now raise exceptions. TODO: add (exceptional) tests for these. >+ case 10: test_self.step(function() { assert_equals(e.data, null); this.done(); }); break; >+ case 11: test_array.step(function() { assert_array_equals_(e.data, cloned_array, 'array'); this.done(); }); break; >+ case 12: test_object.step(function() { assert_object_equals_(e.data, cloned_object, 'object'); this.done(); }); break; >+ case 13: >+ test_error.step(function() { assert_equals(e.data, null, 'new Error()'); this.done(); }); >+ setTimeout(test_unreached.step_func(function() { assert_equals(j, 14); this.done(); }), 50); >+ break; >+ default: test_unreached.step(function() { assert_unreached('got an unexpected message event ('+j+')'); }); >+ }; >+ j++; >+ } >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..78195c84408644b6daa5449d5b9532fe80f7d2dd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS posting an imagedata (from a cloned canvas) in an array >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cac2990c49a6f51b9e638c64a691f89d12a71e2a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011.html >@@ -0,0 +1,29 @@ >+<!doctype html> >+<title>posting an imagedata (from a cloned canvas) in an array</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ >+ var canvas = document.createElement('canvas'); >+ var clone = canvas.cloneNode(true); >+ var ctx = clone.getContext('2d'); >+ var imagedata = ctx.getImageData(0, 0, 300, 150); >+ postMessage([imagedata], '*'); >+ >+ onmessage = this.step_func(function(e) { >+ function processPixels(imagedata) { >+ var pixeldata = imagedata.data; >+ for (var i = 0; i < pixeldata.length; i = i+4) { >+ pixeldata[i] = 128; >+ assert_equals(pixeldata[i], 128); >+ } >+ } >+ processPixels(e.data[0]); >+ this.done(); >+ }); >+ >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dee05dc35f71f7e03489d12c17c1112d86a33d21 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS loop in array in structured clone >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8eb46539b7efa008ae7472b35a925c8991b6916a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012.html >@@ -0,0 +1,16 @@ >+<!doctype html> >+<title>loop in array in structured clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ var x = []; >+ x[0] = x; >+ postMessage(x, '*'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, e.data[0]); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5c11efb879162cd5287b80afe1ff69164a691ec8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS loop in object in structured clone >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013.html >new file mode 100644 >index 0000000000000000000000000000000000000000..34ba76221aa96a2d089aa5f70f7c20f5dcd6f086 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<title>loop in object in structured clone</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function() { >+ var x = {}; >+ x.foo = x; >+ postMessage(x, '*'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data, e.data.foo); >+ this.done(); >+ }); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..07d85622c0686c9c526b9331f12640da6c0e3c4a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS structured clone vs reference >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f200aa467361dbf1f9dc149993be048591b2b417 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<title>structured clone vs reference</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+async_test(function(t) { >+ var x = []; >+ y = [x,x]; >+ postMessage(y, '*'); >+ onmessage = t.step_func(function(e) { >+ assert_equals(e.data[0], e.data[1], 'e.data[0] === e.data[1]'); >+ assert_not_equals(e.data[0], x, 'e.data[0] !== x'); >+ t.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b2c6d6f6780c6c0b1d6abd4973a2998aae579212 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015-expected.txt >@@ -0,0 +1,5 @@ >+CONSOLE MESSAGE: Unable to post message to http://example.org. Recipient has origin http://localhost:8800. >+ >+ >+PASS different origin >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a17c97be19a1d5972d1fa4af409f2bfe520759cf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015.html >@@ -0,0 +1,15 @@ >+<!doctype html> >+<title>different origin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ postMessage('', 'http://example.org', []); >+ onmessage = this.step_func(function(e) { >+ assert_unreached(); >+ }); >+ setTimeout(this.step_func(function(){ this.done(); }), 50); >+}); >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ebb54fb22b60f3dddd18eee7c67770bb009c3cbb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, data: >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016.html >new file mode 100644 >index 0000000000000000000000000000000000000000..51cadec7c17609fd39ebbc8fa67b03abebc3f241 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016.html >@@ -0,0 +1,23 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, data:</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="data:text/html,<script>onmessage = function(e) { parent.postMessage(e.origin, '*'); }; parent.postMessage('loaded', '*');</script>"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ onmessage = this.step_func(function(e) { >+ if (e.data === 'loaded') { >+ window[0].postMessage('', '*'); >+ return; >+ } >+ >+ assert_equals(e.data, location.protocol + '//' + location.host); >+ assert_equals(e.origin, 'null'); >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dd4d946d7cad123dc931c16a97cd1a0824ab7509 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, about:blank >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a4a0483624f60a45e40d9d1dfb2b2e87e054ab55 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017.html >@@ -0,0 +1,18 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, about:blank</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="about:blank"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ window[0].postMessage('', '*'); >+ window[0].onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ assert_array_equals(e.ports, []); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6bf533b33e5dc8f74f9af59cc8a6bf11ff22eea6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, javascript: >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018.html >new file mode 100644 >index 0000000000000000000000000000000000000000..207ae36ed836dcad029368c2cf97d8196ec89933 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, javascript:</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="javascript:''"></iframe> >+<div id=log></div> >+<script> >+async_test(function() { >+ window[0].postMessage('', '*'); >+ window[0].onmessage = this.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ this.done(); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-1.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-1.html >new file mode 100644 >index 0000000000000000000000000000000000000000..513123ee6d56b01177c20bfb841c233118189515 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-1.html >@@ -0,0 +1 @@ >+<!-- blank --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8efab48a20a3851522914205e5d0e20d8998d77d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS origin of the script that invoked the method, scheme/host/port >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019.html >new file mode 100644 >index 0000000000000000000000000000000000000000..38e7ca230ed0747795a05963e1cfb59e5022ebbe >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019.html >@@ -0,0 +1,20 @@ >+<!doctype html> >+<title>origin of the script that invoked the method, scheme/host/port</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/019-1.html"></iframe> >+<div id=log></div> >+<script> >+async_test(function(test) { >+ onload = test.step_func(function() { >+ window[0].postMessage('', location.protocol.toUpperCase() + '//' + location.host.toUpperCase() + '/'); >+ window[0].onmessage = test.step_func(function(e) { >+ assert_equals(e.origin, location.protocol + '//' + location.host); >+ assert_array_equals(e.ports, []); >+ test.done(); >+ }); >+ }); >+}); >+</script> >+ >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020-1.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020-1.html >new file mode 100644 >index 0000000000000000000000000000000000000000..225bd7a41e38280bdb0891ecbf8cd4c39a4c3029 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020-1.html >@@ -0,0 +1,5 @@ >+<script> >+onmessage = function(e) { >+ parent.postMessage([e.data, e.origin], '*'); >+} >+</script> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e35a1128a0d73100d9d652e5b8c35484dc567f47 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020.html >@@ -0,0 +1,30 @@ >+<!doctype html> >+<title>cross-origin test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/020-1.html"></iframe> >+<div id="log"></div> >+<script> >+var iframe = document.createElement('iframe'); >+var url_prefix = location.href.replace('://', '://www1.').replace(/\/with(out)?-ports\/[^\/]+$/, ''); >+var url = url_prefix + '/without-ports/020-1.html'; >+iframe.src = url; >+document.body.appendChild(iframe); >+</script> >+<div id=log></div> >+<script> >+onload = function() { >+ window[0].postMessage(1, location.href); >+ window[1].postMessage(2, url); >+ var i = 0; >+ onmessage = function(e) { >+ i++; >+ assert_equals(e.data[0], i); >+ assert_equals(e.data[1], location.protocol + '//' + location.host); >+ if (i == 2) { >+ done(); >+ } >+ }; >+}; >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/021.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/021.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b240fa0cad53d828b1a3a8c86cf316372b608437 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/021.html >@@ -0,0 +1,30 @@ >+<!doctype html> >+<title>cross-origin test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<iframe src="../without-ports/020-1.html"></iframe> >+<div id="log"></div> >+<script> >+var iframe = document.createElement('iframe'); >+var url_prefix = location.href.replace('://', '://www1.').replace(/\/with(out)?-ports\/[^\/]+$/, ''); >+var url = url_prefix + '/without-ports/020-1.html'; >+iframe.src = url; >+document.body.appendChild(iframe); >+</script> >+<div id=log></div> >+<script> >+onload = function() { >+ window[0].postMessage(1, '*'); >+ window[1].postMessage(2, '*'); >+ var i = 0; >+ onmessage = function(e) { >+ i++; >+ assert_equals(e.data[0], i); >+ assert_equals(e.data[1], location.protocol + '//' + location.host); >+ if (i === 2) { >+ done(); >+ } >+ }; >+}; >+</script> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..71c4683852a220cacac9c3290239297c9a9f72a8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Object cloning: own properties only, don't follow prototype >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1e12ac4a55e632f9568a2c22cc6dd44f8a709152 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023.html >@@ -0,0 +1,29 @@ >+<!doctype html> >+<title>Object cloning: own properties only, don't follow prototype</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id="log"></div> >+<script> >+var Parent = function(){ >+ this.c = "xyz"; >+}; >+ >+var Child = function(a, b) { >+ this.a = a; >+ this.b = b; >+}; >+Child.prototype = new Parent; >+ >+async_test(function() { >+ var obj = new Child(1, 2); >+ var ch = new MessageChannel(); >+ ch.port1.onmessage = this.step_func(function(e) { >+ for (var i in e.data.obj) >+ assert_not_equals(i, 'c'); >+ this.done(); >+ }); >+ ch.port2.start(); >+ ch.port2.postMessage({obj: obj}); >+}); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2c564b90d8b55bde6417e4a36bebb6121b1b5ab7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Object cloning: throw an exception if function values encountered >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8d99994599c9b638b6af9d02c25b285158d553de >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024.html >@@ -0,0 +1,14 @@ >+<!doctype html> >+<title>Object cloning: throw an exception if function values encountered</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+test(function() { >+ var obj = { f : function(){}}; >+ var ch = new MessageChannel(); >+ ch.port1.onmessage = function(){}; >+ ch.port2.start(); >+ assert_throws('DATA_CLONE_ERR', function() { ch.port2.postMessage({obj: obj}); }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-1.js b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-1.js >new file mode 100644 >index 0000000000000000000000000000000000000000..c088fc981947224d24859d078ef1254c1fdd7910 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-1.js >@@ -0,0 +1,15 @@ >+importScripts("/resources/testharness.js"); >+ >+test(function() { >+ var ch = new MessageChannel(); >+ assert_true(ch.port1 instanceof MessagePort, >+ "Worker MessageChannel's port not an instance of MessagePort"); >+}, "Worker MessageChannel's port should be an instance of MessagePort"); >+ >+test(function() { >+ assert_throws(new TypeError(), function() { >+ new MessagePort() >+ }, "MessagePort is [[Callable]]"); >+}, "Worker MessagePort should not be [[Callable]]"); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d626e73f3635290b43e2b4845479c3fc6e287a3a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-expected.txt >@@ -0,0 +1,5 @@ >+ >+PASS MessagePort constructor properties >+PASS Worker MessageChannel's port should be an instance of MessagePort >+PASS Worker MessagePort should not be [[Callable]] >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025.html >new file mode 100644 >index 0000000000000000000000000000000000000000..47bec6bd842d361c1355a57f4015e3624c766fce >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025.html >@@ -0,0 +1,13 @@ >+<!doctype html> >+<title>MessagePort constructor properties</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+test(function() { >+ var ch = new MessageChannel(); >+ assert_true(ch.port1 instanceof MessagePort, "MessageChannel's port not an instance of MessagePort"); >+ assert_throws(new TypeError(), function () { var p = new MessagePort();}, "MessagePort is [[Callable]]"); >+}); >+fetch_tests_from_worker(new Worker("025-1.js")); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..80ac01d0fa843d25f82f1567eba34a82864d117b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Cloning objects with getter properties >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e8d799c5d2553e6db8b7c117d186e8163d2fb405 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026.html >@@ -0,0 +1,16 @@ >+<!doctype html> >+<title>Cloning objects with getter properties</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ var obj = {}; >+ obj.__defineGetter__( "field", function(){ throw new Error("getter_should_propagate_exceptions"); }); >+ >+ assert_throws(new Error("getter_should_propagate_exceptions"), function() { >+ postMessage(obj, '*'); >+ }); >+ this.done(); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..85004a584fb1f22589428872b7968a225c88c914 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Cloning objects, preserving sharing >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027.html >new file mode 100644 >index 0000000000000000000000000000000000000000..36aa9446a5e35e2db4eb53cea5e2b83e4e45aadf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027.html >@@ -0,0 +1,19 @@ >+<!doctype html> >+<title>Cloning objects, preserving sharing</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ var obj1 = {o: 1}; >+ var obj2 = {d: obj1}; >+ var obj3 = {d: obj1}; >+ var obj_dag = {b: obj2, c: obj3}; >+ >+ postMessage(obj_dag, '*'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data.b.d, e.data.c.d); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..22ba9467d61963d3bb3414e446a59f3d156b5b19 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Cloning objects, preserving sharing #2 assert_equals: expected object "[object ImageData]" but got object "[object ImageData]" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d51ad7d3b690d5bf852ae95365953c5479cc7a7f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028.html >@@ -0,0 +1,19 @@ >+<!doctype html> >+<title>Cloning objects, preserving sharing #2</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<canvas id="a" width=30 height=30></canvas> >+<div id=log></div> >+<script> >+async_test(function() { >+ var canvas = document.getElementsByTagName("canvas")[0]; >+ var context = canvas.getContext("2d"); >+ var img_data = context.getImageData(0, 0, 30, 30); >+ var obj = {a: img_data, b: {c: img_data, d: 3}}; >+ postMessage(obj, '*'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data.a, e.data.b.c); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5e09a2875773e41f3e4acf78e3876c5a917494bb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Check that getters don't linger after deletion wrt cloning >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029.html b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4b1b38f741c940bf0396b28912dcb4fb4902e393 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029.html >@@ -0,0 +1,20 @@ >+<!doctype html> >+<title>Check that getters don't linger after deletion wrt cloning</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function() { >+ var obj = {}; >+ obj.__defineGetter__( "a", function(){ return 2; } ); >+ obj.__defineSetter__( "a", function(v){ return; } ); >+ delete obj.a; >+ obj.a = 2; >+ >+ postMessage(obj, '*'); >+ onmessage = this.step_func(function(e) { >+ assert_equals(e.data.a, 2); >+ this.done(); >+ }); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..140df6828de74fd1bd2c16359cff0be453aa6bee >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/w3c-import.log >@@ -0,0 +1,47 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/001.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/002.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/003.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/004.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/005.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/006.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/007.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/008.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/009.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/010.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/011.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/012.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/013.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/014.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/015.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/016.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/017.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/018.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019-1.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/019.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020-1.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/020.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/021.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/023.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/024.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025-1.js >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/025.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/026.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/027.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/028.html >+/LayoutTests/imported/w3c/web-platform-tests/webmessaging/without-ports/029.html
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187001
:
343501
|
343503
|
343505
|
343506
|
343534
|
343538
|
343559
|
343588
|
343598