OLD | NEW |
1 /* Adopted from LayoutTests/webexposed/resources/global-interface-listing.js */ | 1 /* Adopted from LayoutTests/resources/global-interface-listing.js */ |
2 | 2 |
3 // Run all the code in a local scope. | 3 // Run all the code in a local scope. |
4 (function() { | 4 (function() { |
5 | 5 |
6 // Generally, Worklet should not have a reference to the global object. | 6 // Generally, Worklet should not have a reference to the global object. |
7 // https://drafts.css-houdini.org/worklets/#code-idempotency | 7 // https://drafts.css-houdini.org/worklets/#code-idempotency |
8 if (this) { | 8 if (this) { |
9 console.error('"this" should not refer to the global object'); | 9 console.error('"this" should not refer to the global object'); |
10 return; | 10 return; |
11 } | 11 } |
12 // Instead, retrieve the global object in a tricky way. | 12 // Instead, retrieve the global object in a tricky way. |
13 var global_object = Function('return this')(); | 13 var global_object = Function('return this')(); |
14 | 14 |
15 var globals = []; | 15 var globals = []; |
16 | 16 |
17 // List of builtin JS constructors; Blink is not controlling what properties the
se | 17 // List of builtin JS constructors; Blink is not controlling what properties the
se |
18 // objects have, so exercising them in a Blink test doesn't make sense. | 18 // objects have, so exercising them in a Blink test doesn't make sense. |
19 // | 19 // |
20 // This list should be kept in sync with the one at LayoutTests/webexposed/resou
rces/global-interface-listing.js | 20 // This list should be kept in sync with the one at LayoutTests/resources/global
-interface-listing.js |
21 var js_builtins = new Set([ | 21 var js_builtins = new Set([ |
22 'Array', | 22 'Array', |
23 'ArrayBuffer', | 23 'ArrayBuffer', |
24 'Boolean', | 24 'Boolean', |
25 'Date', | 25 'Date', |
26 'Error', | 26 'Error', |
27 'EvalError', | 27 'EvalError', |
28 'Float32Array', | 28 'Float32Array', |
29 'Float64Array', | 29 'Float64Array', |
30 'Function', | 30 'Function', |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 }); | 141 }); |
142 globals.push.apply(globals, property_strings.sort()); | 142 globals.push.apply(globals, property_strings.sort()); |
143 | 143 |
144 // Worklets don't have a mechanism to communicate back to the main page, dump | 144 // Worklets don't have a mechanism to communicate back to the main page, dump |
145 // results into the console. | 145 // results into the console. |
146 globals.forEach(function(global) { | 146 globals.forEach(function(global) { |
147 console.log(global); | 147 console.log(global); |
148 }); | 148 }); |
149 | 149 |
150 })(); // Run all the code in a local scope. | 150 })(); // Run all the code in a local scope. |
OLD | NEW |