OLD | NEW |
(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 }; |
OLD | NEW |