Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/get_interface_names.js

Issue 2627023002: Introduce Origin-Trial for Service Worker Navigation Preload (Closed)
Patch Set: add LayoutTests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/get_interface_names.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/get_interface_names.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/get_interface_names.js
new file mode 100644
index 0000000000000000000000000000000000000000..a3cf937845194063b5629b5800e1a14e10682b2c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/get_interface_names.js
@@ -0,0 +1,35 @@
+function get_interface_names(global_object, interface_names) {
+ var result = [];
+ function collect_property_info(object, property_name, output) {
+ var descriptor = Object.getOwnPropertyDescriptor(object, property_name);
+ if ('value' in descriptor) {
+ if (typeof descriptor.value === 'function') {
+ output.push(' method ' + property_name);
+ } else {
+ output.push(' attribute ' + property_name);
+ }
+ } else {
+ if (descriptor.get)
+ output.push(' getter ' + property_name);
+ if (descriptor.set)
+ output.push(' setter ' + property_name);
falken 2017/01/13 03:43:42 nit: use braces here if the others have it
horo 2017/01/13 08:41:33 Done.
+ }
+ }
+ interface_names.sort();
+ interface_names.forEach(function(interface_name) {
+ if (this[interface_name] === undefined) {
+ return;
+ }
+ result.push('interface ' + interface_name);
+ var property_names =
+ Object.getOwnPropertyNames(this[interface_name].prototype);
+ var property_strings = [];
+ property_names.forEach(function(property_name) {
+ collect_property_info(this[interface_name].prototype,
+ property_name,
+ property_strings);
+ });
+ result.push.apply(result, property_strings.sort());
+ });
+ return result.join("\n");;
+}

Powered by Google App Engine
This is Rietveld 408576698