Title: [188252] trunk
Revision
188252
Author
[email protected]
Date
2015-08-10 23:42:09 -0700 (Mon, 10 Aug 2015)

Log Message

The 'prototype' property on interface objects should not be enumerable
https://bugs.webkit.org/show_bug.cgi?id=147861

Reviewed by Darin Adler.

Source/WebCore:

1. Make the 'prototype' property not enumerable on interface object to
   comply with the Web IDL specification [1] and to align our behavior
   with Firefox 38 and Chrome 44.

2. Also update the 'prototype' property on named constructors to have the
   following attributes:
   { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }

   Previously, all these were true in WebKit. The new behavior complies
   with the Web IDL specification [2] and aligns our behavior with
   Firefox 38. On Chrome 44, the attributes are as follows:
   { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }

This behavior is also covered by the following W3C test suite:
http://w3c-test.org/dom/interfaces.html

[1] http://heycam.github.io/webidl/#interface-object
[2] http://heycam.github.io/webidl/#named-constructors

Test: fast/dom/prototype-property-not-enumerable.html

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorHelperMethods):

LayoutTests:

Add layout test to check that the 'prototype' property on interface
objects has the following attributes:
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }

* fast/dom/prototype-property-not-enumerable-expected.txt: Added.
* fast/dom/prototype-property-not-enumerable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188251 => 188252)


--- trunk/LayoutTests/ChangeLog	2015-08-11 06:40:56 UTC (rev 188251)
+++ trunk/LayoutTests/ChangeLog	2015-08-11 06:42:09 UTC (rev 188252)
@@ -1,3 +1,17 @@
+2015-08-10  Chris Dumez  <[email protected]>
+
+        The 'prototype' property on interface objects should not be enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=147861
+
+        Reviewed by Darin Adler.
+
+        Add layout test to check that the 'prototype' property on interface
+        objects has the following attributes:
+        { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }
+
+        * fast/dom/prototype-property-not-enumerable-expected.txt: Added.
+        * fast/dom/prototype-property-not-enumerable.html: Added.
+
 2015-08-10  Antti Koivisto  <[email protected]>
 
         http/tests/cache/disk-cache/disk-cache-validation.html has too many subtests

Added: trunk/LayoutTests/fast/dom/prototype-property-not-enumerable-expected.txt (0 => 188252)


--- trunk/LayoutTests/fast/dom/prototype-property-not-enumerable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/prototype-property-not-enumerable-expected.txt	2015-08-11 06:42:09 UTC (rev 188252)
@@ -0,0 +1,33 @@
+The 'prototype' property on interface objects should have attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* Event
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+* Element
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+* Document
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+* Window
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+* HTMLOptionElement
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+* Option
+PASS descriptor.writable is false
+PASS descriptor.enumerable is false
+PASS descriptor.configurable is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/prototype-property-not-enumerable.html (0 => 188252)


--- trunk/LayoutTests/fast/dom/prototype-property-not-enumerable.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/prototype-property-not-enumerable.html	2015-08-11 06:42:09 UTC (rev 188252)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("The 'prototype' property on interface objects should have attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }");
+
+debug("* Event");
+var descriptor = Object.getOwnPropertyDescriptor(Event, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+
+debug("* Element");
+var descriptor = Object.getOwnPropertyDescriptor(Element, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+
+debug("* Document");
+var descriptor = Object.getOwnPropertyDescriptor(Document, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+
+debug("* Window");
+var descriptor = Object.getOwnPropertyDescriptor(Window, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+
+debug("* HTMLOptionElement");
+var descriptor = Object.getOwnPropertyDescriptor(HTMLOptionElement, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+
+debug("* Option");
+var descriptor = Object.getOwnPropertyDescriptor(Option, "prototype");
+shouldBeFalse("descriptor.writable");
+shouldBeFalse("descriptor.enumerable");
+shouldBeFalse("descriptor.configurable");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (188251 => 188252)


--- trunk/Source/WebCore/ChangeLog	2015-08-11 06:40:56 UTC (rev 188251)
+++ trunk/Source/WebCore/ChangeLog	2015-08-11 06:42:09 UTC (rev 188252)
@@ -1,3 +1,34 @@
+2015-08-10  Chris Dumez  <[email protected]>
+
+        The 'prototype' property on interface objects should not be enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=147861
+
+        Reviewed by Darin Adler.
+
+        1. Make the 'prototype' property not enumerable on interface object to
+           comply with the Web IDL specification [1] and to align our behavior
+           with Firefox 38 and Chrome 44.
+
+        2. Also update the 'prototype' property on named constructors to have the
+           following attributes:
+           { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }
+
+           Previously, all these were true in WebKit. The new behavior complies
+           with the Web IDL specification [2] and aligns our behavior with
+           Firefox 38. On Chrome 44, the attributes are as follows:
+           { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }
+
+        This behavior is also covered by the following W3C test suite:
+        http://w3c-test.org/dom/interfaces.html
+
+        [1] http://heycam.github.io/webidl/#interface-object
+        [2] http://heycam.github.io/webidl/#named-constructors
+
+        Test: fast/dom/prototype-property-not-enumerable.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateConstructorHelperMethods):
+
 2015-08-10  Alex Christensen  <[email protected]>
 
         Build fix after r188239.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (188251 => 188252)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-08-11 06:40:56 UTC (rev 188251)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-08-11 06:42:09 UTC (rev 188252)
@@ -4781,15 +4781,15 @@
     if (IsDOMGlobalObject($interface)) {
         push(@$outputArray, "    Base::finishCreation(vm);\n");
         push(@$outputArray, "    ASSERT(inherits(info()));\n");
-        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, globalObject->prototype(), DontDelete | ReadOnly);\n");
+        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, globalObject->prototype(), DontDelete | ReadOnly | DontEnum);\n");
     } elsif ($generatingNamedConstructor) {
         push(@$outputArray, "    Base::finishCreation(globalObject);\n");
         push(@$outputArray, "    ASSERT(inherits(info()));\n");
-        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), None);\n");
+        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);\n");
     } else {
         push(@$outputArray, "    Base::finishCreation(vm);\n");
         push(@$outputArray, "    ASSERT(inherits(info()));\n");
-        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly);\n");
+        push(@$outputArray, "    putDirect(vm, vm.propertyNames->prototype, ${className}::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);\n");
     }
 
     if (defined $leastConstructorLength) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to