| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-listing-worker.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-listing-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-listing-worker.js
|
| index 8e0881b879f9af4aaa09fb02ef112fd044feb8c7..c88c0b2962669a2763c04cbb79523661ebe47176 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-listing-worker.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/resources/global-interface-listing-worker.js
|
| @@ -1,5 +1,8 @@
|
| /* Adopted from LayoutTests/webexposed/resources/global-interface-listing.js */
|
|
|
| +// Run all the code in a local scope.
|
| +(function(global_object) {
|
| +
|
| var globals = [];
|
|
|
| // List of builtin JS constructors; Blink is not controlling what properties these
|
| @@ -16,10 +19,15 @@ var js_builtins = new Set([
|
| 'Float32Array',
|
| 'Float64Array',
|
| 'Function',
|
| + 'Infinity',
|
| 'Int16Array',
|
| 'Int32Array',
|
| 'Int8Array',
|
| + 'Intl',
|
| + 'JSON',
|
| 'Map',
|
| + 'Math',
|
| + 'NaN',
|
| 'Number',
|
| 'Object',
|
| 'Promise',
|
| @@ -31,13 +39,25 @@ var js_builtins = new Set([
|
| 'Symbol',
|
| 'SyntaxError',
|
| 'TypeError',
|
| + 'URIError',
|
| 'Uint16Array',
|
| 'Uint32Array',
|
| 'Uint8Array',
|
| 'Uint8ClampedArray',
|
| - 'URIError',
|
| 'WeakMap',
|
| 'WeakSet',
|
| + 'decodeURI',
|
| + 'decodeURIComponent',
|
| + 'encodeURI',
|
| + 'encodeURIComponent',
|
| + 'escape',
|
| + 'eval',
|
| + 'isFinite',
|
| + 'isNaN',
|
| + 'parseFloat',
|
| + 'parseInt',
|
| + 'undefined',
|
| + 'unescape',
|
| ]);
|
|
|
| function is_web_idl_constructor(property_name) {
|
| @@ -52,33 +72,48 @@ function is_web_idl_constructor(property_name) {
|
| descriptor.configurable;
|
| }
|
|
|
| -var interface_names = Object.getOwnPropertyNames(this).filter(is_web_idl_constructor);
|
| +function collect_property_info(object, property_name, output) {
|
| + var descriptor = Object.getOwnPropertyDescriptor(object, property_name);
|
| + if ('value' in descriptor) {
|
| + var type;
|
| + if (typeof descriptor.value === 'function') {
|
| + type = 'method';
|
| + } else {
|
| + type = 'attribute';
|
| + }
|
| + output.push(' ' + type + ' ' + property_name);
|
| + } else {
|
| + if (descriptor.get)
|
| + output.push(' getter ' + property_name);
|
| + if (descriptor.set)
|
| + output.push(' setter ' + property_name);
|
| + }
|
| +}
|
| +
|
| +var interface_names = Object.getOwnPropertyNames(global_object).filter(is_web_idl_constructor);
|
| interface_names.sort();
|
| interface_names.forEach(function(interface_name) {
|
| globals.push('interface ' + interface_name);
|
| var property_strings = [];
|
| var prototype = this[interface_name].prototype;
|
| Object.getOwnPropertyNames(prototype).forEach(function(property_name) {
|
| - var descriptor = Object.getOwnPropertyDescriptor(
|
| - prototype, property_name);
|
| - if ('value' in descriptor) {
|
| - var type;
|
| - if (typeof descriptor.value === 'function') {
|
| - type = 'method';
|
| - } else {
|
| - type = 'attribute';
|
| - }
|
| - property_strings.push(' ' + type + ' ' + property_name);
|
| - } else {
|
| - if (descriptor.get)
|
| - property_strings.push(' getter ' + property_name);
|
| - if (descriptor.set)
|
| - property_strings.push(' setter ' + property_name);
|
| - }
|
| - });
|
| + collect_property_info(prototype, property_name, property_strings);
|
| + });
|
| globals.push.apply(globals, property_strings.sort());
|
| });
|
|
|
| +globals.push('global object');
|
| +var property_strings = [];
|
| +var member_names = Object.getOwnPropertyNames(global_object).filter(function(property_name) {
|
| + return !js_builtins.has(property_name) && !is_web_idl_constructor(property_name);
|
| +});
|
| +member_names.forEach(function(property_name) {
|
| + collect_property_info(global_object, property_name, property_strings);
|
| +});
|
| +globals.push.apply(globals, property_strings.sort());
|
| +
|
| self.addEventListener('message', function(event) {
|
| event.ports[0].postMessage({ result: globals });
|
| });
|
| +
|
| +})(this); // Run all the code in a local scope.
|
|
|