OLD | NEW |
---|---|
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../../resources/js-test.js'); | 2 importScripts('../../resources/js-test.js'); |
3 | 3 |
4 if (!self.postMessage) { | 4 if (!self.postMessage) { |
5 // Shared worker. Make postMessage send to the newest client, which in | 5 // Shared worker. Make postMessage send to the newest client, which in |
6 // our tests is the only client. | 6 // our tests is the only client. |
7 | 7 |
8 // Store messages for sending until we have somewhere to send them. | 8 // Store messages for sending until we have somewhere to send them. |
9 self.postMessage = function(message) { | 9 self.postMessage = function(message) { |
10 if (typeof self.pendingMessages === "undefined") | 10 if (typeof self.pendingMessages === "undefined") |
11 self.pendingMessages = []; | 11 self.pendingMessages = []; |
12 self.pendingMessages.push(message); | 12 self.pendingMessages.push(message); |
13 }; | 13 }; |
14 self.onconnect = function(event) { | 14 self.onconnect = function(event) { |
15 self.postMessage = function(message) { | 15 self.postMessage = function(message) { |
16 event.ports[0].postMessage(message); | 16 event.ports[0].postMessage(message); |
17 }; | 17 }; |
18 // Offload any stored messages now that someone has connected to us. | 18 // Offload any stored messages now that someone has connected to us. |
19 if (typeof self.pendingMessages === "undefined") | 19 if (typeof self.pendingMessages === "undefined") |
20 return; | 20 return; |
21 while (self.pendingMessages.length) | 21 while (self.pendingMessages.length) |
22 event.ports[0].postMessage(self.pendingMessages.shift()); | 22 event.ports[0].postMessage(self.pendingMessages.shift()); |
23 }; | 23 }; |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 // List of builtin JS constructors; Blink is not controlling what properties the se | 27 // List of builtin JS constructors; Blink is not controlling what properties the se |
28 // objects have, so exercising them in a Blink test doesn't make sense. | 28 // objects have, so exercising them in a Blink test doesn't make sense. |
29 // | |
30 // If new builtins are added, please update this list along with the one in | |
31 // LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-li sting-worker.js | |
ojan
2015/08/13 22:29:58
If only we had modules we could share this list! :
jsbell
2015/08/13 23:27:22
If we could align the files there's a PRESUBMIT in
| |
29 var jsBuiltins = new Set([ | 32 var jsBuiltins = new Set([ |
30 'Array', | 33 'Array', |
31 'ArrayBuffer', | 34 'ArrayBuffer', |
32 'Boolean', | 35 'Boolean', |
33 'Date', | 36 'Date', |
34 'Error', | 37 'Error', |
35 'EvalError', | 38 'EvalError', |
36 'Float32Array', | 39 'Float32Array', |
37 'Float64Array', | 40 'Float64Array', |
38 'Function', | 41 'Function', |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 propertyStrings.push(' getter ' + propertyName); | 90 propertyStrings.push(' getter ' + propertyName); |
88 if (descriptor.set) | 91 if (descriptor.set) |
89 propertyStrings.push(' setter ' + propertyName); | 92 propertyStrings.push(' setter ' + propertyName); |
90 } | 93 } |
91 }); | 94 }); |
92 propertyStrings.sort().forEach(debug); | 95 propertyStrings.sort().forEach(debug); |
93 }); | 96 }); |
94 | 97 |
95 if (isWorker()) | 98 if (isWorker()) |
96 finishJSTest(); | 99 finishJSTest(); |
OLD | NEW |