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

Side by Side Diff: LayoutTests/webexposed/resources/global-context-constructors-listing.js

Issue 17826003: Expose WorkerGlobalScope interface in worker environment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bindings tests Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 if (this.importScripts) 1 if (self.importScripts) {
2 importScripts('../../fast/js/resources/js-test-pre.js'); 2 importScripts('../../fast/js/resources/js-test-pre.js');
3 3
4 if (!self.postMessage) {
5 // Shared worker. Make postMessage send to the newest client, which in
6 // our tests is the only client.
7
8 // Store messages for sending until we have somewhere to send them.
9 self.postMessage = function(message) {
10 if (typeof self.pendingMessages === "undefined")
11 self.pendingMessages = [];
12 self.pendingMessages.push(message);
13 };
14 self.onconnect = function(event) {
15 self.postMessage = function(message) {
16 event.ports[0].postMessage(message);
17 };
18 // Offload any stored messages now that someone has connected to us.
19 if (typeof self.pendingMessages === "undefined")
20 return;
21 while (self.pendingMessages.length)
22 event.ports[0].postMessage(self.pendingMessages.shift());
23 };
24 }
25 }
26
4 function isConstructor(propertyName) { 27 function isConstructor(propertyName) {
5 var descriptor = Object.getOwnPropertyDescriptor(this, propertyName); 28 var descriptor = Object.getOwnPropertyDescriptor(this, propertyName);
6 if (descriptor.value == undefined || descriptor.value.prototype == undefined ) 29 if (descriptor.value == undefined || descriptor.value.prototype == undefined )
7 return false; 30 return false;
8 return descriptor.writable && !descriptor.enumerable && descriptor.configura ble; 31 return descriptor.writable && !descriptor.enumerable && descriptor.configura ble;
9 } 32 }
10 33
11 var constructorNames = []; 34 var constructorNames = [];
12 var propertyNames = Object.getOwnPropertyNames(this); 35 var propertyNames = Object.getOwnPropertyNames(this);
13 for (var i = 0; i < propertyNames.length; i++) { 36 for (var i = 0; i < propertyNames.length; i++) {
14 if (isConstructor(propertyNames[i])) 37 if (isConstructor(propertyNames[i]))
15 constructorNames[constructorNames.length] = propertyNames[i]; 38 constructorNames[constructorNames.length] = propertyNames[i];
16 } 39 }
17 40
18 41
19 constructorNames.sort(); 42 constructorNames.sort();
20 for (var i = 0; i < constructorNames.length; i++) 43 for (var i = 0; i < constructorNames.length; i++)
21 debug(constructorNames[i]); 44 debug(constructorNames[i]);
22 45
23 if (isWorker()) 46 if (isWorker())
24 finishJSTest(); 47 finishJSTest();
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/global-constructors-listing-worker-expected.txt ('k') | Source/bindings/derived_sources.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698