Bug 161528

Summary: Add validations for a synchronously constructed custom element
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, cdumez, commit-queue, kling, koivisto, mkwst, rniwa, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 154907, 187757    
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews100 for mac-yosemite
none
Archive of layout-test-results from ews104 for mac-yosemite-wk2
none
Archive of layout-test-results from ews112 for mac-yosemite
none
Archive of layout-test-results from ews124 for ios-simulator-elcapitan-wk2
none
Updated for ToT ysuzuki: review+

Description Ryosuke Niwa 2016-09-01 22:05:12 PDT
The DOM spec now has a bunch of sanity checks after constructing an element synchronously:
https://dom.spec.whatwg.org/#concept-create-element
Comment 1 Ryosuke Niwa 2016-09-01 22:17:09 PDT
Created attachment 287731 [details]
Patch
Comment 2 Ryosuke Niwa 2016-09-01 22:18:24 PDT
Created attachment 287732 [details]
Patch
Comment 3 Build Bot 2016-09-01 22:50:02 PDT
Comment on attachment 287732 [details]
Patch

Attachment 287732 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1991887

New failing tests:
fast/custom-elements/defined-pseudo-class.html
Comment 4 Build Bot 2016-09-01 22:50:06 PDT
Created attachment 287735 [details]
Archive of layout-test-results from ews100 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Build Bot 2016-09-01 22:53:00 PDT
Comment on attachment 287732 [details]
Patch

Attachment 287732 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1991904

New failing tests:
fast/custom-elements/defined-pseudo-class.html
Comment 6 Build Bot 2016-09-01 22:53:03 PDT
Created attachment 287736 [details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 7 Build Bot 2016-09-01 23:16:57 PDT
Comment on attachment 287732 [details]
Patch

Attachment 287732 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1991963

New failing tests:
fast/custom-elements/defined-pseudo-class.html
Comment 8 Build Bot 2016-09-01 23:17:08 PDT
Created attachment 287738 [details]
Archive of layout-test-results from ews112 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 9 Build Bot 2016-09-01 23:24:38 PDT
Comment on attachment 287732 [details]
Patch

Attachment 287732 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1991972

New failing tests:
fast/custom-elements/defined-pseudo-class.html
Comment 10 Build Bot 2016-09-01 23:24:45 PDT
Created attachment 287741 [details]
Archive of layout-test-results from ews124 for ios-simulator-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-elcapitan-wk2  Platform: Mac OS X 10.11.5
Comment 11 Ryosuke Niwa 2016-09-02 00:05:11 PDT
Created attachment 287747 [details]
Updated for ToT
Comment 12 Yusuke Suzuki 2016-09-02 15:09:50 PDT
Comment on attachment 287747 [details]
Updated for ToT

View in context: https://bugs.webkit.org/attachment.cgi?id=287747&action=review

r=me

> Source/WebCore/ChangeLog:11
> +        4. If resultâs attribute list is not empty, then throw a NotSupportedError.

Let's use the ASCII `'`.

> Source/WebCore/ChangeLog:16
> +        6. If resultâs parent is not null, then throw a NotSupportedError.
> +        7. If resultâs node document is not document, then throw a NotSupportedError.
> +        8. If resultâs namespace is not the HTML namespace, then throw a NotSupportedError.
> +        9. If resultâs local name is not equal to localName, then throw a NotSupportedError.

Ditto.

> Source/WebCore/bindings/js/JSCustomElementInterface.cpp:80
> +    auto* state = context->execState();

Can we take this by `auto&`.

> Source/WebCore/bindings/js/JSCustomElementInterface.cpp:140
> +    ASSERT(wrappedElement->namespaceURI() == HTMLNames::xhtmlNamespaceURI);

Is this always held?
Comment 13 Ryosuke Niwa 2016-09-02 17:05:28 PDT
Comment on attachment 287747 [details]
Updated for ToT

View in context: https://bugs.webkit.org/attachment.cgi?id=287747&action=review

>> Source/WebCore/bindings/js/JSCustomElementInterface.cpp:140
>> +    ASSERT(wrappedElement->namespaceURI() == HTMLNames::xhtmlNamespaceURI);
> 
> Is this always held?

Yes. HTMLElement always uses xhtmlNamespaceURI. This is a pretty important invariant in WebCore.
Comment 14 Ryosuke Niwa 2016-09-02 17:05:54 PDT
Comment on attachment 287747 [details]
Updated for ToT

View in context: https://bugs.webkit.org/attachment.cgi?id=287747&action=review

Thanks for the review!

>> Source/WebCore/ChangeLog:11
>> +        4. If resultâs attribute list is not empty, then throw a NotSupportedError.
> 
> Let's use the ASCII `'`.

Fixed

>> Source/WebCore/ChangeLog:16
>> +        9. If resultâs local name is not equal to localName, then throw a NotSupportedError.
> 
> Ditto.

Fixed

>> Source/WebCore/bindings/js/JSCustomElementInterface.cpp:80
>> +    auto* state = context->execState();
> 
> Can we take this by `auto&`.

Fixed.
Comment 15 Radar WebKit Bug Importer 2016-09-02 17:06:16 PDT
<rdar://problem/28145713>
Comment 16 Ryosuke Niwa 2016-09-02 17:10:55 PDT
Committed r205386: <http://trac.webkit.org/changeset/205386>