Title: [201876] trunk
Revision
201876
Author
[email protected]
Date
2016-06-09 11:47:21 -0700 (Thu, 09 Jun 2016)

Log Message

WorkerGlobalScope attributes / operations should be on the prototype
https://bugs.webkit.org/show_bug.cgi?id=158568
<rdar://problem/26720079>

Reviewed by Geoffrey Garen.

Source/WebCore:

WorkerGlobalScope attributes / operations should be on the prototype
because WorkerGlobalScope is not marked as [Global] / [PrimaryGlobal]:
- https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
- http://heycam.github.io/webidl/#es-attributes
- http://heycam.github.io/webidl/#es-operations

DedicatedWorkerGlobalScope is the interface that is marked as [Global]
and whose attributes / operations should be on the instance.

This brings the number of failures on http://w3c-test.org/workers/interfaces.worker
from 65 to 34. It also aligns our behavior with Firefox and Chrome.

Test: fast/workers/WorkerGlobalScope-properties-prototype.html

* bindings/scripts/CodeGeneratorJS.pm:
(InterfaceRequiresAttributesOnInstance):
(OperationShouldBeOnInstance):

LayoutTests:

* fast/workers/WorkerGlobalScope-properties-prototype-expected.txt: Added.
* fast/workers/WorkerGlobalScope-properties-prototype.html: Added.
Add layout test coverage.

* fast/workers/self-hasOwnProperty-expected.txt:
* fast/workers/self-hasOwnProperty.html:
Update test I added a couple of days ago because it wrongly expected
the 'navigator' property to be on the instance. This check was failing
in other browsers (Firefox and Chrome).

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201875 => 201876)


--- trunk/LayoutTests/ChangeLog	2016-06-09 18:33:02 UTC (rev 201875)
+++ trunk/LayoutTests/ChangeLog	2016-06-09 18:47:21 UTC (rev 201876)
@@ -1,3 +1,21 @@
+2016-06-09  Chris Dumez  <[email protected]>
+
+        WorkerGlobalScope attributes / operations should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=158568
+        <rdar://problem/26720079>
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/workers/WorkerGlobalScope-properties-prototype-expected.txt: Added.
+        * fast/workers/WorkerGlobalScope-properties-prototype.html: Added.
+        Add layout test coverage.
+
+        * fast/workers/self-hasOwnProperty-expected.txt:
+        * fast/workers/self-hasOwnProperty.html:
+        Update test I added a couple of days ago because it wrongly expected
+        the 'navigator' property to be on the instance. This check was failing
+        in other browsers (Firefox and Chrome).
+
 2016-06-09  Tim Horton  <[email protected]>
 
         Writing-mode-dependent properties don't apply if their value is a variable

Added: trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype-expected.txt (0 => 201876)


--- trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype-expected.txt	2016-06-09 18:47:21 UTC (rev 201876)
@@ -0,0 +1,20 @@
+Tests that WorkerGlobalScope's properties are on the prototype.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+self.__proto__.__proto__ === WorkerGlobalScope.prototype: true
+self.__proto__.__proto__.hasOwnProperty('navigator') === true: true
+self.__proto__.__proto__.hasOwnProperty('self') === true: true
+self.__proto__.__proto__.hasOwnProperty('location') === true: true
+self.__proto__.__proto__.hasOwnProperty('close') === true: true
+self.__proto__.__proto__.hasOwnProperty('importScripts') === true: true
+self.hasOwnProperty('navigator') === false: true
+self.hasOwnProperty('location') === false: true
+self.hasOwnProperty('close') === false: true
+self.hasOwnProperty('postMessage') === true: true
+self.hasOwnProperty('onmessage') === true: true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype.html (0 => 201876)


--- trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype.html	                        (rev 0)
+++ trunk/LayoutTests/fast/workers/WorkerGlobalScope-properties-prototype.html	2016-06-09 18:47:21 UTC (rev 201876)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script>
+
+var jsTestIsAsync = true;
+
+description("Tests that WorkerGlobalScope's properties are on the prototype.");
+
+var worker = createWorker();
+worker.postMessage("eval self.__proto__.__proto__ === WorkerGlobalScope.prototype");
+worker.postMessage("eval self.__proto__.__proto__.hasOwnProperty('navigator') === true");
+worker.postMessage("eval self.__proto__.__proto__.hasOwnProperty('self') === true");
+worker.postMessage("eval self.__proto__.__proto__.hasOwnProperty('location') === true");
+worker.postMessage("eval self.__proto__.__proto__.hasOwnProperty('close') === true");
+worker.postMessage("eval self.__proto__.__proto__.hasOwnProperty('importScripts') === true");
+worker.postMessage("eval self.hasOwnProperty('navigator') === false");
+worker.postMessage("eval self.hasOwnProperty('location') === false");
+worker.postMessage("eval self.hasOwnProperty('close') === false");
+
+// DedicatedWorkerGlobalScope properties should be on the instance.
+worker.postMessage("eval self.hasOwnProperty('postMessage') === true");
+worker.postMessage("eval self.hasOwnProperty('onmessage') === true");
+worker.postMessage("eval DONE");
+
+worker._onmessage_ = function(evt) {
+    if (!/DONE/.test(evt.data))
+        debug(evt.data.replace(new RegExp("/.*LayoutTests"), "<...>"));
+    else
+        finishJSTest();
+};
+
+</script>
+<script src=""

Modified: trunk/LayoutTests/fast/workers/self-hasOwnProperty-expected.txt (201875 => 201876)


--- trunk/LayoutTests/fast/workers/self-hasOwnProperty-expected.txt	2016-06-09 18:33:02 UTC (rev 201875)
+++ trunk/LayoutTests/fast/workers/self-hasOwnProperty-expected.txt	2016-06-09 18:47:21 UTC (rev 201876)
@@ -5,7 +5,7 @@
 
 self.hasOwnProperty('DedicatedWorkerGlobalScope'): true
 self.hasOwnProperty('WorkerGlobalScope'): true
-self.hasOwnProperty('navigator'): true
+self.hasOwnProperty('postMessage'): true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/workers/self-hasOwnProperty.html (201875 => 201876)


--- trunk/LayoutTests/fast/workers/self-hasOwnProperty.html	2016-06-09 18:33:02 UTC (rev 201875)
+++ trunk/LayoutTests/fast/workers/self-hasOwnProperty.html	2016-06-09 18:47:21 UTC (rev 201876)
@@ -10,7 +10,7 @@
 var worker = createWorker();
 worker.postMessage("eval self.hasOwnProperty('DedicatedWorkerGlobalScope')");
 worker.postMessage("eval self.hasOwnProperty('WorkerGlobalScope')");
-worker.postMessage("eval self.hasOwnProperty('navigator')");
+worker.postMessage("eval self.hasOwnProperty('postMessage')");
 worker.postMessage("eval DONE");
 
 worker._onmessage_ = function(evt) {

Modified: trunk/Source/WebCore/ChangeLog (201875 => 201876)


--- trunk/Source/WebCore/ChangeLog	2016-06-09 18:33:02 UTC (rev 201875)
+++ trunk/Source/WebCore/ChangeLog	2016-06-09 18:47:21 UTC (rev 201876)
@@ -1,3 +1,29 @@
+2016-06-09  Chris Dumez  <[email protected]>
+
+        WorkerGlobalScope attributes / operations should be on the prototype
+        https://bugs.webkit.org/show_bug.cgi?id=158568
+        <rdar://problem/26720079>
+
+        Reviewed by Geoffrey Garen.
+
+        WorkerGlobalScope attributes / operations should be on the prototype
+        because WorkerGlobalScope is not marked as [Global] / [PrimaryGlobal]:
+        - https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
+        - http://heycam.github.io/webidl/#es-attributes
+        - http://heycam.github.io/webidl/#es-operations
+
+        DedicatedWorkerGlobalScope is the interface that is marked as [Global]
+        and whose attributes / operations should be on the instance.
+
+        This brings the number of failures on http://w3c-test.org/workers/interfaces.worker
+        from 65 to 34. It also aligns our behavior with Firefox and Chrome.
+
+        Test: fast/workers/WorkerGlobalScope-properties-prototype.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (InterfaceRequiresAttributesOnInstance):
+        (OperationShouldBeOnInstance):
+
 2016-06-09  Tim Horton  <[email protected]>
 
         Writing-mode-dependent properties don't apply if their value is a variable

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201875 => 201876)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-09 18:33:02 UTC (rev 201875)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-09 18:47:21 UTC (rev 201876)
@@ -558,7 +558,8 @@
     # FIXME: We should be able to drop this once <rdar://problem/24466097> is fixed.
     return 1 if $interface->isException;
 
-    return 1 if IsDOMGlobalObject($interface);
+    # FIXME: Add support for [PrimaryGlobal] / [Global].
+    return 1 if IsDOMGlobalObject($interface) && $interface->name ne "WorkerGlobalScope";
 
     return 1 if InterfaceRequiresAttributesOnInstanceForCompatibility($interface);
 
@@ -596,7 +597,8 @@
     my $interface = shift;
     my $function = shift;
 
-    return 1 if IsDOMGlobalObject($interface);
+    # FIXME: Add support for [PrimaryGlobal] / [Global].
+    return 1 if IsDOMGlobalObject($interface) && $interface->name ne "WorkerGlobalScope";
 
     # FIXME: The bindings generator does not support putting runtime-enabled operations on the instance yet (except for global objects).
     return 0 if $function->signature->extendedAttributes->{"EnabledAtRuntime"};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to