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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/extendable-message-event-worker.js

Issue 1156703003: ServiceWorker: Introduce ExtendableMessageEvent to replace MessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update Created 5 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 self.onmessage = function(e) {
2 if (e.data.port) {
3 self.port = e.data.port;
4 return;
5 }
6 if (e instanceof ExtendableMessageEvent === false) {
7 self.port.postMessage('Event type should be ExtendableMessageEvent');
8 return;
9 }
10 if (e.source instanceof Client === false &&
11 e.source.__proto__ !== registration.active.__proto__) {
12 self.port.postMessage('Source type should be Client or ServiceWorker');
13 return;
14 }
15 if (e.type !== 'message') {
16 self.port.postMessage('Event type should be "message"');
17 return;
18 }
19 var event = new ExtendableMessageEvent('eventType', {source: e.source});
20 if (event.source !== e.source) {
21 self.port.postMessage('Construct new event with source fail');
22 return;
23 }
24 self.port.postMessage('PASS');
25 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698