OLD | NEW |
| (Empty) |
1 // Avoid polluting the global scope. | |
2 (function(globalObject) { | |
3 | |
4 // Save the list of property names of the global object before loading other s
cripts. | |
5 var propertyNamesInGlobal = Object.getOwnPropertyNames(globalObject); | |
6 | |
7 importScripts('../../resources/js-test.js'); | |
8 importScripts('../../resources/global-interface-listing.js'); | |
9 | |
10 if (!self.postMessage) { | |
11 // Shared worker. Make postMessage send to the newest client, which in | |
12 // our tests is the only client. | |
13 | |
14 // Store messages for sending until we have somewhere to send them. | |
15 self.postMessage = function(message) { | |
16 if (typeof self.pendingMessages === "undefined") | |
17 self.pendingMessages = []; | |
18 self.pendingMessages.push(message); | |
19 }; | |
20 self.onconnect = function(event) { | |
21 self.postMessage = function(message) { | |
22 event.ports[0].postMessage(message); | |
23 }; | |
24 // Offload any stored messages now that someone has connected to us. | |
25 if (typeof self.pendingMessages === "undefined") | |
26 return; | |
27 while (self.pendingMessages.length) | |
28 event.ports[0].postMessage(self.pendingMessages.shift()); | |
29 }; | |
30 } | |
31 | |
32 globalInterfaceListing(globalObject, propertyNamesInGlobal, debug); | |
33 | |
34 finishJSTest(); | |
35 | |
36 })(this); | |
OLD | NEW |