Title: [227425] trunk
Revision
227425
Author
beid...@apple.com
Date
2018-01-23 11:24:23 -0800 (Tue, 23 Jan 2018)

Log Message

Allow passing MessagePorts across processes (e.g. ServiceWorkers).
https://bugs.webkit.org/show_bug.cgi?id=181178

Reviewed by Andy Estes.

LayoutTests/imported/w3c:

Re-baseline for many new passes and a few new failure modes.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https-expected.txt:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-fetch.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-not-using-registration.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-using-registration.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-worker-fetch.https-expected.txt:
* web-platform-tests/service-workers/service-worker/client-id.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-get.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-matchall-order.https-expected.txt:
* web-platform-tests/service-workers/service-worker/clients-matchall.https-expected.txt:
* web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-css-images.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-no-freshness-headers.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt:
* web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-end-to-end.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-events.https-expected.txt:
* web-platform-tests/service-workers/service-worker/skip-waiting-installed.https-expected.txt:

Source/WebCore:

Test: http/tests/workers/service/basic-messageport.html

* dom/MessagePort.cpp:
(WebCore::MessagePort::MessagePort):
(WebCore::MessagePort::~MessagePort):

* dom/messageports/MessagePortChannel.cpp:
(WebCore::MessagePortChannel::entanglePortWithProcess):
* dom/messageports/MessagePortChannel.h:

* workers/service/SWClientConnection.cpp:
(WebCore::SWClientConnection::postMessageToServiceWorkerClient):
* workers/service/SWClientConnection.h:

* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::postMessage):

* workers/service/ServiceWorkerClient.cpp:
(WebCore::ServiceWorkerClient::postMessage):

* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::postMessageToServiceWorker):
* workers/service/context/SWContextManager.h:

Source/WebKit:

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::postMessageToServiceWorker):
(WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::postMessageToServiceWorkerClient):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
(WebKit::WebProcessProxy::postMessageToRemote):

* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::postMessageToServiceWorker):
(WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
(WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

LayoutTests:

* http/tests/workers/service/basic-messageport-expected.txt: Added.
* http/tests/workers/service/basic-messageport.html: Added.
* http/tests/workers/service/resources/basic-messageport.js: Added.
* http/tests/workers/service/resources/messageport-echo-worker.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227424 => 227425)


--- trunk/LayoutTests/ChangeLog	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/ChangeLog	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,15 @@
+2018-01-23  Brady Eidson  <beid...@apple.com>
+
+        Allow passing MessagePorts across processes (e.g. ServiceWorkers).
+        https://bugs.webkit.org/show_bug.cgi?id=181178
+
+        Reviewed by Andy Estes.
+
+        * http/tests/workers/service/basic-messageport-expected.txt: Added.
+        * http/tests/workers/service/basic-messageport.html: Added.
+        * http/tests/workers/service/resources/basic-messageport.js: Added.
+        * http/tests/workers/service/resources/messageport-echo-worker.js: Added.
+
 2018-01-23  Ryan Haddad  <ryanhad...@apple.com>
 
         Unskip http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html on Sierra.

Modified: trunk/LayoutTests/TestExpectations (227424 => 227425)


--- trunk/LayoutTests/TestExpectations	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/TestExpectations	2018-01-23 19:24:23 UTC (rev 227425)
@@ -160,6 +160,8 @@
 imported/w3c/web-platform-tests/service-workers/service-worker/update-bytecheck.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/update-recovery.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/client-navigate.https.html [ Skip ]
+imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-include-uncontrolled.https.html [ Skip ]
+imported/w3c/web-platform-tests/service-workers/service-worker/indexeddb.https.html [ Skip ]
 
 # Unsupported features: SharedWorker, NavigationPreload
 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-preload [ Skip ]
@@ -166,6 +168,12 @@
 imported/w3c/web-platform-tests/service-workers/service-worker/shared-worker-controlled.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/claim-shared-worker-fetch.https.html [ Skip ]
 
+# Reliably ASSERTS in ServiceWorkerClientFetch::didFinish
+imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect-body.https.html [ Skip ]
+
+# Different failure string each test run due to a random number being dumped in test output
+imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-images.https.html [ Skip ]
+
 imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html [ Pass Failure ]
 webkit.org/b/179248 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-response-body-with-invalid-chunk.https.html [ Pass Failure ]

Added: trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt (0 => 227425)


--- trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-messageport-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -0,0 +1,4 @@
+Message received from ServiceWorker: PASS: Got the MessagePort
+Message received from ServiceWorker: messageport thing received....
+Message received from MessagePort: MessagePort echo: Message to a port!
+

Added: trunk/LayoutTests/http/tests/workers/service/basic-messageport.html (0 => 227425)


--- trunk/LayoutTests/http/tests/workers/service/basic-messageport.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-messageport.html	2018-01-23 19:24:23 UTC (rev 227425)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js (0 => 227425)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-messageport.js	2018-01-23 19:24:23 UTC (rev 227425)
@@ -0,0 +1,19 @@
+navigator.serviceWorker.addEventListener("message", function(event) {
+    log("Message received from ServiceWorker: " + event.data);
+});
+
+var channel = new MessageChannel;
+channel.port1._onmessage_ = function(event) {
+	log("Message received from MessagePort: " + event.data);
+	finishSWTest();
+}
+
+navigator.serviceWorker.register("resources/messageport-echo-worker.js", { }).then(function(registration) {
+	try {
+    	registration.installing.postMessage("Here is your port", [channel.port2]);
+        channel.port1.postMessage("Message to a port!");
+	} catch(e) {
+		log("Exception: " + e);
+		finishSWTest();
+	}
+});

Added: trunk/LayoutTests/http/tests/workers/service/resources/messageport-echo-worker.js (0 => 227425)


--- trunk/LayoutTests/http/tests/workers/service/resources/messageport-echo-worker.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/messageport-echo-worker.js	2018-01-23 19:24:23 UTC (rev 227425)
@@ -0,0 +1,25 @@
+var client = null;
+self.addEventListener("message", (event) => {    
+    if (!client) {
+        client = event.source;
+        if (!(client instanceof WindowClient)) {
+            event.source.postMessage("FAIL: client source is not a WindowClient");
+            return;
+        }
+    } else if (client !== event.source) {
+        event.source.postMessage("FAIL: client source of the second message is not the same as the first message");
+        return;
+    }
+    if (event.ports) {
+        event.source.postMessage("PASS: Got the MessagePort");
+        event.ports[0]._onmessage_ = echoBack;
+        event.ports[0].start();
+    } else 
+        event.source.postMessage("FAIL: Message did not have a MessagePort");
+});
+
+function echoBack(evt) {
+	client.postMessage("messageport thing received....");
+
+    evt.target.postMessage("MessagePort echo: " + evt.data);
+}

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,42 @@
+2018-01-23  Brady Eidson  <beid...@apple.com>
+
+        Allow passing MessagePorts across processes (e.g. ServiceWorkers).
+        https://bugs.webkit.org/show_bug.cgi?id=181178
+
+        Reviewed by Andy Estes.
+
+        Re-baseline for many new passes and a few new failure modes.
+
+        * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/claim-fetch.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/claim-not-using-registration.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/claim-using-registration.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/claim-worker-fetch.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/client-id.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-get.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-matchall-order.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/clients-matchall.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-request-css-images.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-request-no-freshness-headers.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/registration-end-to-end.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/registration-events.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/skip-waiting-installed.https-expected.txt:
+
 2018-01-22  Chris Nardi  <csnar...@gmail.com>
 
         Parse calc() in CSS media queries

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,5 +1,5 @@
 
-FAIL Post an extendable message from a top-level client promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS Post an extendable message from a top-level client 
 FAIL Post an extendable message from a nested client assert_equals: event `source` property `focused` expected false but got true
 PASS Post loopback extendable messages 
 PASS Post extendable messages among service workers 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/postmessage.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,5 +1,4 @@
 
+PASS Post loopback messages 
+PASS Post messages among service workers 
 
-FAIL Post loopback messages promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Post messages among service workers promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,4 @@
 
 PASS Verify registration attributes on ServiceWorkerGlobalScope 
-FAIL Verify registration attributes on ServiceWorkerGlobalScope of the newer worker promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS Verify registration attributes on ServiceWorkerGlobalScope of the newer worker 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,7 +1,6 @@
 
-
 PASS Unregister on script evaluation 
 PASS Unregister on installing event 
 PASS Unregister on activate event 
-FAIL Unregister controlling service worker promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS Unregister controlling service worker 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS claim() should affect the originally controlling registration. 
 
-FAIL claim() should affect the originally controlling registration. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-fetch.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS fetch() should be intercepted after the client is claimed. 
 
-FAIL fetch() should be intercepted after the client is claimed. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-not-using-registration.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,5 +1,4 @@
 
+PASS Test claim client which is not using registration 
+PASS Test claim client when there's a longer-matched registration not already used by the page 
 
-FAIL Test claim client which is not using registration promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Test claim client when there's a longer-matched registration not already used by the page promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-using-registration.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,5 +1,4 @@
 
+PASS Test worker claims client which is using another registration 
+PASS Test for the waiting worker claims a client which is using the the same registration 
 
-FAIL Test worker claims client which is using another registration promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Test for the waiting worker claims a client which is using the the same registration promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-worker-fetch.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS fetch() in Worker should be intercepted after the client is claimed. 
 
-FAIL fetch() in Worker should be intercepted after the client is claimed. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/client-id.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/client-id.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/client-id.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS Client.id returns the client's ID. 
 
-FAIL Client.id returns the client's ID. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,2 +1,3 @@
-CONSOLE MESSAGE: line 48: Unhandled Promise Rejection: NotSupportedError: Passing MessagePort objects to postMessage is not yet supported
 
+FAIL Test Clients.get() cross origin assert_equals: iframe client ID expected (undefined) undefined but got (object) [["visible", true, "https://localhost:9443/service-workers/service-worker/resources/clients-get-frame.html", "window", "nested"]]
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL Test Clients.get() promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+FAIL Test Clients.get() assert_array_equals: property 1, expected false but got true
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,5 +1,5 @@
 
 
-FAIL Verify matchAll() with window client type assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Verify matchAll() with {window, sharedworker, worker} client types promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker"
+PASS Verify matchAll() with window client type 
+FAIL Verify matchAll() with {window, sharedworker, worker} client types promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: SharedWorker"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-exact-controller.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,4 @@
 
 
-FAIL Test Clients.matchAll() with exact controller assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
+FAIL Test Clients.matchAll() with exact controller assert_unreached: unexpected rejection: assert_array_equals: property 1, expected false but got true Reached unreachable code
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-order.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,9 +1,9 @@
 
-FAIL Clients.matchAll() returns non-focused controlled windows in creation order. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns controlled windows in focus order.  Case 1. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns controlled windows in focus order.  Case 2. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns non-focused uncontrolled windows in creation order. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns uncontrolled windows in focus order.  Case 1. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns uncontrolled windows in focus order.  Case 2. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Clients.matchAll() returns controlled windows and frames in focus order. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS Clients.matchAll() returns non-focused controlled windows in creation order. 
+FAIL Clients.matchAll() returns controlled windows in focus order.  Case 1. assert_equals: expected URL index 0 expected "https://localhost:9443/service-workers/service-worker/resources/empty.html?name=focus-controlled-windows-1&q=2" but got "https://localhost:9443/service-workers/service-worker/resources/empty.html?name=focus-controlled-windows-1&q=0"
+PASS Clients.matchAll() returns controlled windows in focus order.  Case 2. 
+FAIL Clients.matchAll() returns non-focused uncontrolled windows in creation order. assert_equals: expected 6 but got 5
+FAIL Clients.matchAll() returns uncontrolled windows in focus order.  Case 1. assert_equals: expected 6 but got 5
+FAIL Clients.matchAll() returns uncontrolled windows in focus order.  Case 2. assert_equals: expected 6 but got 5
+FAIL Clients.matchAll() returns controlled windows and frames in focus order. assert_equals: expected URL index 0 expected "https://localhost:9443/service-workers/service-worker/resources/empty.html?name=focus-controlled-nested-windows&q=2" but got "https://localhost:9443/service-workers/service-worker/resources/empty.html?name=focus-controlled-nested-windows&q=0"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,4 @@
 
 
-FAIL Test Clients.matchAll() assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
+FAIL Test Clients.matchAll() assert_array_equals: property 1, expected false but got true
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,12 +1,13 @@
 
-FAIL Test calling waitUntil in a different task without an existing extension throws assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil in a different microtask without an existing extension throws assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil in a different task with an existing extension succeeds assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil with an existing extension promise handler succeeds assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil at the end of the microtask turn throws assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil after the current extension expired in a different task fails assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil on a script constructed ExtendableEvent throws exception assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil asynchronously with pending respondWith promise. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil synchronously inside microtask of respondWith promise. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Test calling waitUntil asynchronously inside microtask of respondWith promise. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
 
+PASS Test calling waitUntil in a different task without an existing extension throws 
+PASS Test calling waitUntil in a different microtask without an existing extension throws 
+PASS Test calling waitUntil in a different task with an existing extension succeeds 
+FAIL Test calling waitUntil with an existing extension promise handler succeeds assert_unreached: unexpected rejection: assert_equals: expected "OK" but got "InvalidStateError" Reached unreachable code
+PASS Test calling waitUntil at the end of the microtask turn throws 
+PASS Test calling waitUntil after the current extension expired in a different task fails 
+PASS Test calling waitUntil on a script constructed ExtendableEvent throws exception 
+PASS Test calling waitUntil asynchronously with pending respondWith promise. 
+FAIL Test calling waitUntil synchronously inside microtask of respondWith promise. assert_unreached: unexpected rejection: assert_equals: expected "OK" but got "InvalidStateError" Reached unreachable code
+PASS Test calling waitUntil asynchronously inside microtask of respondWith promise. 
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-async-respond-with.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL Calling respondWith asynchronously throws an exception promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS Calling respondWith asynchronously throws an exception 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL respondWith() invokes stopImmediatePropagation() promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS respondWith() invokes stopImmediatePropagation() 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-throws-after-respond-with.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,4 @@
 
-FAIL Fetch event handler throws after a successful respondWith() promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
 
+PASS Fetch event handler throws after a successful respondWith() 
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-base-url.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,4 @@
 
-FAIL CSS's base URL must be the request URL even when fetched from other URL. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
 
+FAIL CSS's base URL must be the request URL even when fetched from other URL. assert_equals: The base URL while loading the images referred from CSS must be the request URL of CSS. expected "https://localhost:9443/service-workers/service-worker/resources/dummy.png" but got "https://127.0.0.1:9443/service-workers/service-worker/resources/dummy.png"
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-images.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-images.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-css-images.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,7 +1,7 @@
 
 
-FAIL Verify FetchEvent for css image (backgroundImage). assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Verify FetchEvent for css image (shapeOutside). assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Verify FetchEvent for css image-set (backgroundImage). assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-FAIL Verify FetchEvent for css image-set (shapeOutside). assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
+PASS Verify FetchEvent for css image (backgroundImage). 
+FAIL Verify FetchEvent for css image (shapeOutside). assert_equals: credentials of CSSImage load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test1516682573070 type:shapeOutside) must be same-origin. expected "same-origin" but got "include"
+PASS Verify FetchEvent for css image-set (backgroundImage). 
+FAIL Verify FetchEvent for css image-set (shapeOutside). assert_equals: credentials of CSSImageSet load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test1516682573028 type:shapeOutside) must be same-origin. expected "same-origin" but got "include"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-fallback.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -8,20 +8,20 @@
 CONSOLE MESSAGE: Cross-origin image load denied by Cross-Origin Resource Sharing policy.
 
 PASS initialize global state 
-FAIL The SW must intercept the request for a main resource. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request of same origin XHR. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request of CORS-unsupported other origin XHR. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request of CORS-supported other origin XHR. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request of redirected XHR. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for XHR which is redirected to CORS-unsupported other origin. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for XHR which is redirected to CORS-supported other origin. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request for image. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request for other origin image. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request for CORS-unsupported other origin image. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept the request for CORS-supported other origin image. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for redirected image resource. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for image resource which is redirected to other origin. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for image resource which is redirected to CORS-unsupported other origin. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL The SW must intercept only the first request for image resource which is redirected to CORS-supported other origin. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS The SW must intercept the request for a main resource. 
+PASS The SW must intercept the request of same origin XHR. 
+PASS The SW must intercept the request of CORS-unsupported other origin XHR. 
+PASS The SW must intercept the request of CORS-supported other origin XHR. 
+PASS The SW must intercept only the first request of redirected XHR. 
+FAIL The SW must intercept only the first request for XHR which is redirected to CORS-unsupported other origin. assert_object_equals: unexpected property "1"
+FAIL The SW must intercept only the first request for XHR which is redirected to CORS-supported other origin. assert_object_equals: unexpected property "1"
+PASS The SW must intercept the request for image. 
+PASS The SW must intercept the request for other origin image. 
+PASS The SW must intercept the request for CORS-unsupported other origin image. 
+PASS The SW must intercept the request for CORS-supported other origin image. 
+PASS The SW must intercept only the first request for redirected image resource. 
+PASS The SW must intercept only the first request for image resource which is redirected to other origin. 
+PASS The SW must intercept only the first request for image resource which is redirected to CORS-unsupported other origin. 
+PASS The SW must intercept only the first request for image resource which is redirected to CORS-supported other origin. 
 PASS restore global state 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-no-freshness-headers.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-no-freshness-headers.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-no-freshness-headers.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS The headers of FetchEvent shouldn't contain freshness headers. 
 
-FAIL The headers of FetchEvent shouldn't contain freshness headers. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,19 @@
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
 
-FAIL Verify FetchEvent for resources. assert_unreached: unexpected rejection: Passing MessagePort objects to postMessage is not yet supported Reached unreachable code
 
+FAIL Verify FetchEvent for resources. assert_equals: integrity of Script load (url:https://localhost:9443/service-workers/service-worker/resources/dummy?test24) must be      . expected "     " but got ""
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL worker prototype chain should be immutable promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS worker prototype chain should be immutable 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,21 +1,26 @@
+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=https%3A%2F%2Flocalhost%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Fsimple.txt%3F&error. Redirections are not allowed
+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/service-workers/service-worker/resources/simple.txt?. Response served by service worker has redirections
+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/service-workers/service-worker/resources/simple.txt?. Response served by service worker has redirections
+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=https%3A%2F%2Flocalhost%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Fsimple.txt%3F&original-redirect-mode=follow&sw=manual. Response served by service worker is opaque redirect
+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=https%3A%2F%2Flocalhost%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Fsimple.txt%3F&original-redirect-mode=error&sw=manual. Response served by service worker is opaque redirect
 
-FAIL initialize global state (service worker registration and caches) promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", non-intercepted request, no server redirect promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", non-intercepted request promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "manual", non-intercepted request promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "error", non-intercepted request promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", no mode change, no server redirect promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", no mode change promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "error", mode change: "follow" promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "manual", mode change: "follow" promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", mode change: "manual" promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "error", mode change: "manual" promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "manual", no mode change promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "follow", generated redirect response promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "error", generated redirect response promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL mode: "manual", generated redirect response promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Fetch should follow the redirect response 20 times promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-FAIL Fetch should not follow the redirect response 21 times. promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
+PASS initialize global state (service worker registration and caches) 
+PASS mode: "follow", non-intercepted request, no server redirect 
+PASS mode: "follow", non-intercepted request 
+PASS mode: "manual", non-intercepted request 
+PASS mode: "error", non-intercepted request 
+PASS mode: "follow", no mode change, no server redirect 
+PASS mode: "follow", no mode change 
+PASS mode: "error", mode change: "follow" 
+PASS mode: "manual", mode change: "follow" 
+PASS mode: "follow", mode change: "manual" 
+PASS mode: "error", mode change: "manual" 
+PASS mode: "manual", no mode change 
+PASS mode: "follow", generated redirect response 
+PASS mode: "error", generated redirect response 
+PASS mode: "manual", generated redirect response 
+PASS Fetch should follow the redirect response 20 times 
+PASS Fetch should not follow the redirect response 21 times. 
 PASS restore global state (service worker registration) 
 PASS restore global state (caches) 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-end-to-end.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL Registration: end-to-end Passing MessagePort objects to postMessage is not yet supported
+PASS Registration: end-to-end 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-events.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-events.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-events.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,3 @@
 
-FAIL Registration: events Passing MessagePort objects to postMessage is not yet supported
+PASS Registration: events 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https-expected.txt (227424 => 227425)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https-expected.txt	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-installed.https-expected.txt	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,4 +1,3 @@
 
+PASS Test skipWaiting when a installed worker is waiting 
 
-FAIL Test skipWaiting when a installed worker is waiting promise_test: Unhandled rejection with value: object "NotSupportedError: Passing MessagePort objects to postMessage is not yet supported"
-

Modified: trunk/Source/WebCore/ChangeLog (227424 => 227425)


--- trunk/Source/WebCore/ChangeLog	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/ChangeLog	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,34 @@
+2018-01-23  Brady Eidson  <beid...@apple.com>
+
+        Allow passing MessagePorts across processes (e.g. ServiceWorkers).
+        https://bugs.webkit.org/show_bug.cgi?id=181178
+
+        Reviewed by Andy Estes.
+
+        Test: http/tests/workers/service/basic-messageport.html
+
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::MessagePort):
+        (WebCore::MessagePort::~MessagePort):
+
+        * dom/messageports/MessagePortChannel.cpp:
+        (WebCore::MessagePortChannel::entanglePortWithProcess):
+        * dom/messageports/MessagePortChannel.h:
+
+        * workers/service/SWClientConnection.cpp:
+        (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
+        * workers/service/SWClientConnection.h:
+
+        * workers/service/ServiceWorker.cpp:
+        (WebCore::ServiceWorker::postMessage):
+
+        * workers/service/ServiceWorkerClient.cpp:
+        (WebCore::ServiceWorkerClient::postMessage):
+
+        * workers/service/context/SWContextManager.cpp:
+        (WebCore::SWContextManager::postMessageToServiceWorker):
+        * workers/service/context/SWContextManager.h:
+
 2018-01-23  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r227279 and r227373.

Modified: trunk/Source/WebCore/dom/MessagePort.cpp (227424 => 227425)


--- trunk/Source/WebCore/dom/MessagePort.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/dom/MessagePort.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -91,7 +91,7 @@
     , m_identifier(local)
     , m_remoteIdentifier(remote)
 {
-    LOG(MessagePorts, "Created MessagePort %s (%p)", m_identifier.logString().utf8().data(), this);
+    LOG(MessagePorts, "Created MessagePort %s (%p) in process %" PRIu64, m_identifier.logString().utf8().data(), this, Process::identifier().toUInt64());
 
     Locker<Lock> locker(allMessagePortsLock());
     allMessagePorts().set(m_identifier, this);
@@ -104,7 +104,7 @@
 
 MessagePort::~MessagePort()
 {
-    LOG(MessagePorts, "Destroyed MessagePort %s (%p)", m_identifier.logString().utf8().data(), this);
+    LOG(MessagePorts, "Destroyed MessagePort %s (%p) in process %" PRIu64, m_identifier.logString().utf8().data(), this, Process::identifier().toUInt64());
 
     ASSERT(allMessagePortsLock().isLocked());
 

Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp (227424 => 227425)


--- trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannel.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -79,11 +79,11 @@
 {
     ASSERT(isMainThread());
 
-    LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s", logString().utf8().data(), this, port.logString().utf8().data());
-
     ASSERT(port == m_ports[0] || port == m_ports[1]);
     size_t i = port == m_ports[0] ? 0 : 1;
 
+    LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s (that port has %zu messages available)", logString().utf8().data(), this, port.logString().utf8().data(), m_pendingMessages[i].size());
+
     ASSERT(!m_processes[i] || *m_processes[i] == process);
     m_processes[i] = process;
     m_entangledToProcessProtectors[i] = this;

Modified: trunk/Source/WebCore/dom/messageports/MessagePortChannel.h (227424 => 227425)


--- trunk/Source/WebCore/dom/messageports/MessagePortChannel.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/dom/messageports/MessagePortChannel.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -56,7 +56,7 @@
     void takeAllMessagesForPort(const MessagePortIdentifier&, Function<void(Vector<MessageWithMessagePorts>&&, Function<void()>&&)>&&);
     void checkRemotePortForActivity(const MessagePortIdentifier&, CompletionHandler<void(MessagePortChannelProvider::HasActivity)>&& callback);
 
-    bool hasAnyMessagesPendingOrInFlight() const;
+    WEBCORE_EXPORT bool hasAnyMessagesPendingOrInFlight() const;
 
     uint64_t beingTransferredCount();
 

Modified: trunk/Source/WebCore/workers/service/SWClientConnection.cpp (227424 => 227425)


--- trunk/Source/WebCore/workers/service/SWClientConnection.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -116,7 +116,7 @@
 }
 
 
-void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& sourceData, const String& sourceOrigin)
+void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerData&& sourceData, const String& sourceOrigin)
 {
     ASSERT(isMainThread());
 
@@ -131,8 +131,7 @@
 
     MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(*destinationDocument, WTFMove(sourceData)) };
 
-    // FIXME: We should pass in ports.
-    auto messageEvent = MessageEvent::create({ }, WTFMove(message), sourceOrigin, { }, WTFMove(source));
+    auto messageEvent = MessageEvent::create(MessagePort::entanglePorts(*destinationDocument, WTFMove(message.transferredPorts)), WTFMove(message.message), sourceOrigin, { }, WTFMove(source));
     container->dispatchEvent(messageEvent);
 }
 

Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (227424 => 227425)


--- trunk/Source/WebCore/workers/service/SWClientConnection.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -46,6 +46,7 @@
 enum class ServiceWorkerState;
 enum class ShouldNotifyWhenResolved;
 struct ExceptionData;
+struct MessageWithMessagePorts;
 struct ServiceWorkerClientData;
 struct ServiceWorkerClientIdentifier;
 struct ServiceWorkerData;
@@ -73,7 +74,7 @@
 
     virtual void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&) = 0;
 
-    virtual void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, const ServiceWorkerOrClientIdentifier& source) = 0;
+    virtual void postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&&, const ServiceWorkerOrClientIdentifier& source) = 0;
 
     virtual SWServerConnectionIdentifier serverConnectionIdentifier() const = 0;
     virtual bool mayHaveServiceWorkerRegisteredForOrigin(const SecurityOrigin&) const = 0;
@@ -91,7 +92,7 @@
     WEBCORE_EXPORT void registrationJobResolvedInServer(ServiceWorkerJobIdentifier, ServiceWorkerRegistrationData&&, ShouldNotifyWhenResolved);
     WEBCORE_EXPORT void unregistrationJobResolvedInServer(ServiceWorkerJobIdentifier, bool unregistrationResult);
     WEBCORE_EXPORT void startScriptFetchForServer(ServiceWorkerJobIdentifier, const ServiceWorkerRegistrationKey&, FetchOptions::Cache);
-    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerData&& source, const String& sourceOrigin);
+    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&&, ServiceWorkerData&& source, const String& sourceOrigin);
     WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const std::optional<ServiceWorkerData>&);
     WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState);
     WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);

Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (227424 => 227425)


--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -107,22 +107,15 @@
     ASSERT(execState);
 
     Vector<RefPtr<MessagePort>> ports;
-    auto message = SerializedScriptValue::create(*execState, messageValue, WTFMove(transfer), ports, SerializationContext::WorkerPostMessage);
-    if (message.hasException())
-        return message.releaseException();
+    auto messageData = SerializedScriptValue::create(*execState, messageValue, WTFMove(transfer), ports, SerializationContext::WorkerPostMessage);
+    if (messageData.hasException())
+        return messageData.releaseException();
 
     // Disentangle the port in preparation for sending it to the remote context.
-    auto channelsOrException = MessagePort::disentanglePorts(WTFMove(ports));
-    if (channelsOrException.hasException())
-        return channelsOrException.releaseException();
+    auto portsOrException = MessagePort::disentanglePorts(WTFMove(ports));
+    if (portsOrException.hasException())
+        return portsOrException.releaseException();
 
-    // FIXME: Support sending the channels.
-    auto channels = channelsOrException.releaseReturnValue();
-    if (!channels.isEmpty()) {
-        WORKER_RELEASE_LOG_ERROR_IF_ALLOWED("postMessage: Passing MessagePort objects to postMessage is not yet supported");
-        return Exception { NotSupportedError, ASCIILiteral("Passing MessagePort objects to postMessage is not yet supported") };
-    }
-
     ServiceWorkerOrClientIdentifier sourceIdentifier;
     if (is<ServiceWorkerGlobalScope>(context))
         sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
@@ -131,9 +124,10 @@
         sourceIdentifier = ServiceWorkerClientIdentifier { connection.serverConnectionIdentifier(), downcast<Document>(context).identifier() };
     }
 
+    MessageWithMessagePorts message = { messageData.releaseReturnValue(), portsOrException.releaseReturnValue() };
     callOnMainThread([sessionID = context.sessionID(), destinationIdentifier = identifier(), message = WTFMove(message), sourceIdentifier = WTFMove(sourceIdentifier)]() mutable {
         auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(sessionID);
-        connection.postMessageToServiceWorker(destinationIdentifier, message.releaseReturnValue(), sourceIdentifier);
+        connection.postMessageToServiceWorker(destinationIdentifier, WTFMove(message), sourceIdentifier);
     });
     return { };
 }

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp (227424 => 227425)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -88,22 +88,18 @@
     ASSERT(execState);
 
     Vector<RefPtr<MessagePort>> ports;
-    auto message = SerializedScriptValue::create(*execState, messageValue, WTFMove(transfer), ports, SerializationContext::WorkerPostMessage);
-    if (message.hasException())
-        return message.releaseException();
+    auto messageData = SerializedScriptValue::create(*execState, messageValue, WTFMove(transfer), ports, SerializationContext::WorkerPostMessage);
+    if (messageData.hasException())
+        return messageData.releaseException();
 
     // Disentangle the port in preparation for sending it to the remote context.
-    auto channelsOrException = MessagePort::disentanglePorts(WTFMove(ports));
-    if (channelsOrException.hasException())
-        return channelsOrException.releaseException();
+    auto portsOrException = MessagePort::disentanglePorts(WTFMove(ports));
+    if (portsOrException.hasException())
+        return portsOrException.releaseException();
 
-    // FIXME: Support sending the channels.
-    auto channels = channelsOrException.releaseReturnValue();
-    if (!channels.isEmpty())
-        return Exception { NotSupportedError, ASCIILiteral("Passing MessagePort objects to postMessage is not yet supported") };
-
+    MessageWithMessagePorts message = { messageData.releaseReturnValue(), portsOrException.releaseReturnValue() };
     auto sourceIdentifier = downcast<ServiceWorkerGlobalScope>(context).thread().identifier();
-    callOnMainThread([message = message.releaseReturnValue(), destinationIdentifier = identifier(), sourceIdentifier, sourceOrigin = context.origin().isolatedCopy()] () mutable {
+    callOnMainThread([message = WTFMove(message), destinationIdentifier = identifier(), sourceIdentifier, sourceOrigin = context.origin().isolatedCopy()] () mutable {
         if (auto* connection = SWContextManager::singleton().connection())
             connection->postMessageToServiceWorkerClient(destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin);
     });

Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (227424 => 227425)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -77,7 +77,7 @@
     return m_workerMap.get(identifier);
 }
 
-void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerOrClientData&& sourceData)
+void SWContextManager::postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&& message, ServiceWorkerOrClientData&& sourceData)
 {
     auto* serviceWorker = m_workerMap.get(destination);
     ASSERT(serviceWorker);
@@ -84,7 +84,7 @@
     ASSERT(!serviceWorker->isTerminatingOrTerminated());
 
     // FIXME: We should pass valid MessagePortChannels.
-    serviceWorker->thread().postMessageToServiceWorker({ WTFMove(message), { } }, WTFMove(sourceData));
+    serviceWorker->thread().postMessageToServiceWorker(WTFMove(message), WTFMove(sourceData));
 }
 
 void SWContextManager::fireInstallEvent(ServiceWorkerIdentifier identifier)

Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (227424 => 227425)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -48,7 +48,7 @@
     public:
         virtual ~Connection() { }
 
-        virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0;
+        virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&&, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0;
         virtual void serviceWorkerStartedWithMessage(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage) = 0;
         virtual void didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool wasSuccessful) = 0;
         virtual void didFinishActivation(ServiceWorkerIdentifier) = 0;
@@ -67,7 +67,7 @@
 
     WEBCORE_EXPORT void registerServiceWorkerThreadForInstall(Ref<ServiceWorkerThreadProxy>&&);
     WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(ServiceWorkerIdentifier) const;
-    WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, Ref<SerializedScriptValue>&& message, ServiceWorkerOrClientData&& sourceData);
+    WEBCORE_EXPORT void postMessageToServiceWorker(ServiceWorkerIdentifier destination, MessageWithMessagePorts&&, ServiceWorkerOrClientData&& sourceData);
     WEBCORE_EXPORT void fireInstallEvent(ServiceWorkerIdentifier);
     WEBCORE_EXPORT void fireActivateEvent(ServiceWorkerIdentifier);
     WEBCORE_EXPORT void terminateWorker(ServiceWorkerIdentifier, Seconds timeout, Function<void()>&&);

Modified: trunk/Source/WebKit/ChangeLog (227424 => 227425)


--- trunk/Source/WebKit/ChangeLog	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/ChangeLog	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1,3 +1,37 @@
+2018-01-23  Brady Eidson  <beid...@apple.com>
+
+        Allow passing MessagePorts across processes (e.g. ServiceWorkers).
+        https://bugs.webkit.org/show_bug.cgi?id=181178
+
+        Reviewed by Andy Estes.
+
+        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::postMessageToServiceWorker):
+        (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
+        * StorageProcess/ServiceWorker/WebSWServerConnection.h:
+        * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
+
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::postMessageToServiceWorkerClient):
+        * StorageProcess/StorageProcess.h:
+        * StorageProcess/StorageProcess.messages.in:
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::entangleLocalPortInThisProcessToRemote):
+        (WebKit::WebProcessProxy::postMessageToRemote):
+
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        (WebKit::WebSWClientConnection::postMessageToServiceWorker):
+        (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
+        * WebProcess/Storage/WebSWClientConnection.h:
+        * WebProcess/Storage/WebSWClientConnection.messages.in:
+
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
+        (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
+        * WebProcess/Storage/WebSWContextManagerConnection.h:
+        * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
+
 2018-01-23  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r227279 and r227373.

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -171,7 +171,7 @@
     runServerWorkerAndStartFetch(true);
 }
 
-void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
+void WebSWServerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
 {
     std::optional<ServiceWorkerOrClientData> sourceData;
     WTF::switchOn(sourceIdentifier, [&](ServiceWorkerIdentifier identifier) {
@@ -186,9 +186,9 @@
         return;
 
     // It's possible this specific worker cannot be re-run (e.g. its registration has been removed)
-    server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = message.vector(), sourceData = WTFMove(*sourceData)](bool success, auto& contextConnection) mutable {
+    server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = WTFMove(message), sourceData = WTFMove(*sourceData)](bool success, auto& contextConnection) mutable {
         if (success)
-            sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorker { destinationIdentifier, message, WTFMove(sourceData) });
+            sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorker { destinationIdentifier, WTFMove(message), WTFMove(sourceData) });
     });
 }
 
@@ -225,13 +225,13 @@
     m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidNotHandle { }, fetchIdentifier);
 }
 
-void WebSWServerConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
+void WebSWServerConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
 {
     auto* sourceServiceWorker = server().workerByID(sourceIdentifier);
     if (!sourceServiceWorker)
         return;
 
-    send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationContextIdentifier, message, sourceServiceWorker->data(), sourceOrigin });
+    send(Messages::WebSWClientConnection::PostMessageToServiceWorkerClient { destinationContextIdentifier, WTFMove(message), sourceServiceWorker->data(), sourceOrigin });
 }
 
 void WebSWServerConnection::matchRegistration(uint64_t registrationMatchRequestIdentifier, const SecurityOriginData& topOrigin, const URL& clientURL)

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -38,10 +38,11 @@
 }
 
 namespace WebCore {
+class ServiceWorkerRegistrationKey;
 struct ClientOrigin;
 struct ExceptionData;
+struct MessageWithMessagePorts;
 struct ServiceWorkerClientData;
-class ServiceWorkerRegistrationKey;
 }
 
 namespace WebKit {
@@ -67,7 +68,7 @@
     void didFailFetch(uint64_t fetchIdentifier);
     void didNotHandleFetch(uint64_t fetchIdentifier);
 
-    void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin);
+    void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceServiceWorkerIdentifier, const String& sourceOrigin);
 
 private:
     // Implement SWServer::Connection (Messages to the client WebProcess)
@@ -85,7 +86,7 @@
 
     void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer);
 
-    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference&& message, const WebCore::ServiceWorkerOrClientIdentifier& source);
+    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source);
 
     void matchRegistration(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);
     void getRegistrations(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL);

Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in	2018-01-23 19:24:23 UTC (rev 227425)
@@ -31,7 +31,7 @@
 
     StartFetch(uint64_t identifier, WebCore::ServiceWorkerRegistrationIdentifier serviceWorkerRegistrationIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody, String referrer)
 
-    PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference message, WebCore::ServiceWorkerOrClientIdentifier source)
+    PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destination, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerOrClientIdentifier source)
 
     DidResolveRegistrationPromise(WebCore::ServiceWorkerRegistrationKey key)
 

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -477,10 +477,10 @@
         connection->didFinishFetch(fetchIdentifier);
 }
 
-void StorageProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
+void StorageProcess::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
 {
     if (auto* connection = m_swServerConnections.get(destinationIdentifier.serverConnectionIdentifier))
-        connection->postMessageToServiceWorkerClient(destinationIdentifier.contextIdentifier, message, sourceIdentifier, sourceOrigin);
+        connection->postMessageToServiceWorkerClient(destinationIdentifier.contextIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin);
 }
 
 void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -42,9 +42,10 @@
 
 namespace WebCore {
 class SWServer;
+class ServiceWorkerRegistrationKey;
+struct MessageWithMessagePorts;
 struct SecurityOriginData;
 struct ServiceWorkerClientIdentifier;
-class ServiceWorkerRegistrationKey;
 }
 
 namespace WebKit {
@@ -135,7 +136,7 @@
     void didFailFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier);
     void didNotHandleFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier);
 
-    void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);
+    void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);
     WebSWOriginStore& swOriginStoreForSession(PAL::SessionID);
     bool needsServerToContextConnection() const;
 #endif

Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (227424 => 227425)


--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in	2018-01-23 19:24:23 UTC (rev 227425)
@@ -42,6 +42,6 @@
     DidReceiveFetchData(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::DataReference data, int64_t encodedDataLength)
     DidReceiveFetchFormData(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, IPC::FormDataReference data)
     DidFinishFetch(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier)
-    PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, IPC::DataReference message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin)
+    PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin)
 #endif
 }

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (227424 => 227425)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -1262,6 +1262,10 @@
 {
     m_processEntangledPorts.add(local);
     UIMessagePortChannelProvider::singleton().registry().didEntangleLocalToRemote(local, remote, coreProcessIdentifier());
+
+    auto* channel = UIMessagePortChannelProvider::singleton().registry().existingChannelContainingPort(local);
+    if (channel && channel->hasAnyMessagesPendingOrInFlight())
+        send(Messages::WebProcess::MessagesAvailableForPort(local), 0);
 }
 
 void WebProcessProxy::messagePortDisentangled(const MessagePortIdentifier& port)
@@ -1304,9 +1308,11 @@
         // Look up the process for that port
         auto* channel = UIMessagePortChannelProvider::singleton().registry().existingChannelContainingPort(port);
         ASSERT(channel);
-        auto process = channel->processForPort(port);
-        if (process)
-            send(Messages::WebProcess::MessagesAvailableForPort(port), 0);
+        auto processIdentifier = channel->processForPort(port);
+        if (processIdentifier) {
+            if (auto* process = WebProcessProxy::processForIdentifier(*processIdentifier))
+                process->send(Messages::WebProcess::MessagesAvailableForPort(port), 0);
+        }
     }
 }
 

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -82,9 +82,9 @@
     send(Messages::WebSWServerConnection::RemoveServiceWorkerRegistrationInServer(identifier));
 }
 
-void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, Ref<SerializedScriptValue>&& scriptValue, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
+void WebSWClientConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, const ServiceWorkerOrClientIdentifier& sourceIdentifier)
 {
-    send(Messages::WebSWServerConnection::PostMessageToServiceWorker(destinationIdentifier, IPC::DataReference { scriptValue->data() }, sourceIdentifier) );
+    send(Messages::WebSWServerConnection::PostMessageToServiceWorker(destinationIdentifier, WTFMove(message), sourceIdentifier) );
 }
 
 void WebSWClientConnection::registerServiceWorkerClient(const SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData& data, const std::optional<WebCore::ServiceWorkerIdentifier>& controllingServiceWorkerIdentifier)
@@ -197,9 +197,9 @@
     send(Messages::WebSWServerConnection::StartFetch { fetchIdentifier, serviceWorkerRegistrationIdentifier, request, options, IPC::FormDataReference { request.httpBody() }, referrer });
 }
 
-void WebSWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, ServiceWorkerData&& source, const String& sourceOrigin)
+void WebSWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerData&& source, const String& sourceOrigin)
 {
-    SWClientConnection::postMessageToServiceWorkerClient(destinationContextIdentifier, SerializedScriptValue::adopt(message.vector()), WTFMove(source), sourceOrigin);
+    SWClientConnection::postMessageToServiceWorkerClient(destinationContextIdentifier, WTFMove(message), WTFMove(source), sourceOrigin);
 }
 
 void WebSWClientConnection::connectionToServerLost()

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -32,6 +32,7 @@
 #include "MessageSender.h"
 #include "ServiceWorkerClientFetch.h"
 #include "SharedMemory.h"
+#include <WebCore/MessageWithMessagePorts.h>
 #include <WebCore/SWClientConnection.h>
 #include <pal/SessionID.h>
 #include <wtf/UniqueRef.h>
@@ -62,7 +63,7 @@
     bool mayHaveServiceWorkerRegisteredForOrigin(const WebCore::SecurityOrigin&) const final;
     void startFetch(uint64_t fetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier, const WebCore::ResourceRequest&, const WebCore::FetchOptions&, const String& referrer);
 
-    void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerData&& source, const String& sourceOrigin);
+    void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerData&& source, const String& sourceOrigin);
 
     void connectionToServerLost();
 
@@ -73,7 +74,7 @@
 
     void scheduleJobInServer(const WebCore::ServiceWorkerJobData&) final;
     void finishFetchingScriptInServer(const WebCore::ServiceWorkerFetchResult&) final;
-    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, Ref<WebCore::SerializedScriptValue>&&, const WebCore::ServiceWorkerOrClientIdentifier& source) final;
+    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, WebCore::MessageWithMessagePorts&&, const WebCore::ServiceWorkerOrClientIdentifier& source) final;
     void registerServiceWorkerClient(const WebCore::SecurityOrigin& topOrigin, const WebCore::ServiceWorkerClientData&, const std::optional<WebCore::ServiceWorkerIdentifier>&) final;
     void unregisterServiceWorkerClient(WebCore::DocumentIdentifier) final;
 

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in	2018-01-23 19:24:23 UTC (rev 227425)
@@ -37,7 +37,7 @@
 
     SetSWOriginTableIsImported()
     SetSWOriginTableSharedMemory(WebKit::SharedMemory::Handle handle)
-    PostMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, IPC::DataReference message, struct WebCore::ServiceWorkerData source, String sourceOrigin)
+    PostMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, struct WebCore::MessageWithMessagePorts message, struct WebCore::ServiceWorkerData source, String sourceOrigin)
 
     DidMatchRegistration(uint64_t matchRequestIdentifier, std::optional<WebCore::ServiceWorkerRegistrationData> data)
     DidGetRegistrations(uint64_t matchRequestIdentifier, Vector<WebCore::ServiceWorkerRegistrationData> registrations)

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2018-01-23 19:24:23 UTC (rev 227425)
@@ -45,6 +45,7 @@
 #include <WebCore/EmptyClients.h>
 #include <WebCore/EmptyFrameLoaderClient.h>
 #include <WebCore/LibWebRTCProvider.h>
+#include <WebCore/MessageWithMessagePorts.h>
 #include <WebCore/PageConfiguration.h>
 #include <WebCore/RuntimeEnabledFeatures.h>
 #include <WebCore/SerializedScriptValue.h>
@@ -182,9 +183,9 @@
     serviceWorkerThreadProxy->thread().postFetchTask(WTFMove(client), WTFMove(clientId), WTFMove(request), WTFMove(referrer), WTFMove(options));
 }
 
-void WebSWContextManagerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerOrClientData&& sourceData)
+void WebSWContextManagerConnection::postMessageToServiceWorker(ServiceWorkerIdentifier destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerOrClientData&& sourceData)
 {
-    SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, SerializedScriptValue::adopt(message.vector()), WTFMove(sourceData));
+    SWContextManager::singleton().postMessageToServiceWorker(destinationIdentifier, WTFMove(message), WTFMove(sourceData));
 }
 
 void WebSWContextManagerConnection::fireInstallEvent(ServiceWorkerIdentifier identifier)
@@ -209,9 +210,9 @@
     });
 }
 
-void WebSWContextManagerConnection::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
+void WebSWContextManagerConnection::postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&& message, ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin)
 {
-    m_connectionToStorageProcess->send(Messages::StorageProcess::PostMessageToServiceWorkerClient(destinationIdentifier, IPC::DataReference { message->data() }, sourceIdentifier, sourceOrigin), 0);
+    m_connectionToStorageProcess->send(Messages::StorageProcess::PostMessageToServiceWorkerClient(destinationIdentifier, WTFMove(message), sourceIdentifier, sourceOrigin), 0);
 }
 
 void WebSWContextManagerConnection::didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h	2018-01-23 19:24:23 UTC (rev 227425)
@@ -63,7 +63,7 @@
     void updatePreferencesStore(const WebPreferencesStore&);
 
     // WebCore::SWContextManager::Connection.
-    void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
+    void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
     void didFinishInstall(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final;
     void didFinishActivation(WebCore::ServiceWorkerIdentifier) final;
     void setServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier, bool) final;
@@ -77,7 +77,7 @@
     void serviceWorkerStartedWithMessage(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
     void installServiceWorker(const WebCore::ServiceWorkerContextData&, PAL::SessionID);
     void startFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer);
-    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerOrClientData&& sourceData);
+    void postMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerOrClientData&& sourceData);
     void fireInstallEvent(WebCore::ServiceWorkerIdentifier);
     void fireActivateEvent(WebCore::ServiceWorkerIdentifier);
     void terminateWorker(WebCore::ServiceWorkerIdentifier);

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (227424 => 227425)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in	2018-01-23 18:26:35 UTC (rev 227424)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in	2018-01-23 19:24:23 UTC (rev 227425)
@@ -25,7 +25,7 @@
 messages -> WebSWContextManagerConnection {
     InstallServiceWorker(struct WebCore::ServiceWorkerContextData contextData, PAL::SessionID sessionID)
     StartFetch(WebCore::SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options, IPC::FormDataReference requestBody, String referrer)
-    PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference message, WebCore::ServiceWorkerOrClientData sourceData)
+    PostMessageToServiceWorker(WebCore::ServiceWorkerIdentifier destinationIdentifier, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerOrClientData sourceData)
     FireInstallEvent(WebCore::ServiceWorkerIdentifier identifier)
     FireActivateEvent(WebCore::ServiceWorkerIdentifier identifier)
     TerminateWorker(WebCore::ServiceWorkerIdentifier identifier)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to