Title: [236769] trunk
Revision
236769
Author
cdu...@apple.com
Date
2018-10-02 15:53:33 -0700 (Tue, 02 Oct 2018)

Log Message

Image.__proto__ should be Function.prototype, not HTMLElement.prototype
https://bugs.webkit.org/show_bug.cgi?id=190216

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing WPT test now that it is passing.

* web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt:

Source/WebCore:

Properties created for named constructors should always use Function.prototype as prototype, as per:
- https://heycam.github.io/webidl/#named-constructors

Gecko and Blink agree with the Web IDL specification. However, WebKit was using the parent interface's
prototype if such a parent existing. So Image.__proto__ would end up being HTMLElement.prototype
instead of Function.prototype.

No new tests, rebaselined existing test.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (236768 => 236769)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-10-02 22:53:33 UTC (rev 236769)
@@ -1,3 +1,14 @@
+2018-10-02  Chris Dumez  <cdu...@apple.com>
+
+        Image.__proto__ should be Function.prototype, not HTMLElement.prototype
+        https://bugs.webkit.org/show_bug.cgi?id=190216
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline existing WPT test now that it is passing.
+
+        * web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt:
+
 2018-10-01  Simon Pieters  <zcor...@gmail.com>
 
         <form> in quirks mode should have margin-block-end: 1em

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt (236768 => 236769)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/Image-constructor-expected.txt	2018-10-02 22:53:33 UTC (rev 236769)
@@ -3,9 +3,5 @@
 PASS Image and HTMLImageElement share a prototype 
 PASS Image localName is img 
 PASS Image namespace URI is correct 
-FAIL NamedConstructor creates the correct object structure. assert_equals: Image __proto__ is Function prototype expected function "function () {
-    [native code]
-}" but got function "function HTMLElement() {
-    [native code]
-}"
+PASS NamedConstructor creates the correct object structure. 
 

Modified: trunk/LayoutTests/js/interface-objects-expected.txt (236768 => 236769)


--- trunk/LayoutTests/js/interface-objects-expected.txt	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/LayoutTests/js/interface-objects-expected.txt	2018-10-02 22:53:33 UTC (rev 236769)
@@ -16,7 +16,7 @@
 * Interface with named constructor
 PASS window.Audio instanceof Function is true
 PASS typeof Audio is "function"
-PASS Object.getPrototypeOf(Audio) is HTMLMediaElement
+PASS Object.getPrototypeOf(Audio) is Function.prototype
 PASS Audio() threw exception TypeError: Constructor requires 'new' operator.
 PASS Audio.call() threw exception TypeError: Constructor requires 'new' operator.
 PASS new Audio() did not throw exception.

Modified: trunk/LayoutTests/js/interface-objects.html (236768 => 236769)


--- trunk/LayoutTests/js/interface-objects.html	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/LayoutTests/js/interface-objects.html	2018-10-02 22:53:33 UTC (rev 236769)
@@ -19,7 +19,7 @@
 debug("* Interface with named constructor");
 shouldBeTrue("window.Audio instanceof Function");
 shouldBeEqualToString("typeof Audio", "function");
-shouldBe("Object.getPrototypeOf(Audio)", "HTMLMediaElement");
+shouldBe("Object.getPrototypeOf(Audio)", "Function.prototype");
 shouldThrow("Audio()");
 shouldThrow("Audio.call()");
 shouldNotThrow("new Audio()");

Modified: trunk/Source/WebCore/ChangeLog (236768 => 236769)


--- trunk/Source/WebCore/ChangeLog	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/Source/WebCore/ChangeLog	2018-10-02 22:53:33 UTC (rev 236769)
@@ -1,3 +1,22 @@
+2018-10-02  Chris Dumez  <cdu...@apple.com>
+
+        Image.__proto__ should be Function.prototype, not HTMLElement.prototype
+        https://bugs.webkit.org/show_bug.cgi?id=190216
+
+        Reviewed by Alex Christensen.
+
+        Properties created for named constructors should always use Function.prototype as prototype, as per:
+        - https://heycam.github.io/webidl/#named-constructors
+
+        Gecko and Blink agree with the Web IDL specification. However, WebKit was using the parent interface's
+        prototype if such a parent existing. So Image.__proto__ would end up being HTMLElement.prototype
+        instead of Function.prototype.
+
+        No new tests, rebaselined existing test.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateConstructorHelperMethods):
+
 2018-10-02  Alex Christensen  <achristen...@webkit.org>
 
         Prepare WebCoreNSURLExtras for ARC

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (236768 => 236769)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2018-10-02 22:53:26 UTC (rev 236768)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2018-10-02 22:53:33 UTC (rev 236769)
@@ -7224,7 +7224,7 @@
 
     assert("An interface cannot inherit from another interface that is marked as [NoInterfaceObject]") if $interface->parentType && $codeGenerator->GetInterfaceExtendedAttributesFromName($interface->parentType->name)->{NoInterfaceObject};
 
-    if ($interface->parentType) {
+    if (!$generatingNamedConstructor and $interface->parentType) {
         my $parentClassName = "JS" . $interface->parentType->name;
         push(@$outputArray, "    return ${parentClassName}::getConstructor(vm, &globalObject);\n");
     } else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to