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

Unified Diff: third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing-worker.js

Issue 2889423003: Unify webexposed/global-interface-listing scripts (Closed)
Patch Set: Rebased Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing-worker.js
diff --git a/third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing-worker.js b/third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..8819fb8159bbb63c15cce7ecdf03454cfbe2dae4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing-worker.js
@@ -0,0 +1,36 @@
+// Avoid polluting the global scope.
+(function(globalObject) {
+
+ // Save the list of property names of the global object before loading other scripts.
+ var propertyNamesInGlobal = Object.getOwnPropertyNames(globalObject);
+
+ importScripts('../../resources/js-test.js');
+ importScripts('../../resources/global-interface-listing.js');
+
+ if (!self.postMessage) {
+ // Shared worker. Make postMessage send to the newest client, which in
+ // our tests is the only client.
+
+ // Store messages for sending until we have somewhere to send them.
+ self.postMessage = function(message) {
+ if (typeof self.pendingMessages === "undefined")
+ self.pendingMessages = [];
+ self.pendingMessages.push(message);
+ };
+ self.onconnect = function(event) {
+ self.postMessage = function(message) {
+ event.ports[0].postMessage(message);
+ };
+ // Offload any stored messages now that someone has connected to us.
+ if (typeof self.pendingMessages === "undefined")
+ return;
+ while (self.pendingMessages.length)
+ event.ports[0].postMessage(self.pendingMessages.shift());
+ };
+ }
+
+ globalInterfaceListing(globalObject, propertyNamesInGlobal, debug);
+
+ finishJSTest();
+
+})(this);
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698