Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js

Issue 2426723004: ServiceWorker: Modernize postMessage tests for cleanup (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js
index 4eb14ee1c41337b805f2ce65186b0f8b21219380..1883518d9bdfed2b80a4806c79a24da3e59c302b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-msgport-to-client-worker.js
@@ -3,18 +3,18 @@ self.onmessage = function(e) {
clients.forEach(function(client) {
var messageChannel = new MessageChannel();
messageChannel.port1.onmessage =
- onMessageViaMessagePort.bind(null, client);
+ onMessageViaMessagePort.bind(null, messageChannel.port1);
client.postMessage({port: messageChannel.port2},
[messageChannel.port2]);
});
}));
};
-function onMessageViaMessagePort(client, e) {
+function onMessageViaMessagePort(port, e) {
nhiroki 2016/10/18 06:46:03 I changed a communication path from "client" to "p
var message = e.data;
if ('value' in message) {
- client.postMessage({ack: 'Acking value: ' + message.value});
+ port.postMessage({ack: 'Acking value: ' + message.value});
} else if ('done' in message) {
- client.postMessage({done: true});
+ port.postMessage({done: true});
falken 2016/10/19 01:55:24 Not sure if this works but can it just be e.ports[
nhiroki 2016/10/19 04:00:50 In my understanding, 'ports' array is filled only
falken 2016/10/19 04:06:27 Acknowledged.
}
}

Powered by Google App Engine
This is Rietveld 408576698