Bug 164700 - document.createElementNS doesn't construct a custom element
Summary: document.createElementNS doesn't construct a custom element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks: 154907
  Show dependency treegraph
 
Reported: 2016-11-13 00:15 PST by Ryosuke Niwa
Modified: 2016-11-14 16:30 PST (History)
7 users (show)

See Also:


Attachments
Fixes the bug (19.96 KB, patch)
2016-11-13 00:56 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Added a change log description (20.06 KB, patch)
2016-11-13 00:58 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated for ToT (20.02 KB, patch)
2016-11-13 01:09 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (20.18 KB, patch)
2016-11-14 15:53 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (20.17 KB, patch)
2016-11-14 15:54 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2016-11-13 00:15:00 PST
document.createElementNS doesn't create a custom element :(
Comment 1 Ryosuke Niwa 2016-11-13 00:56:45 PST
Created attachment 294659 [details]
Fixes the bug
Comment 2 Ryosuke Niwa 2016-11-13 00:58:16 PST
Created attachment 294660 [details]
Added a change log description
Comment 3 Radar WebKit Bug Importer 2016-11-13 00:59:41 PST
<rdar://problem/29237299>
Comment 4 Radar WebKit Bug Importer 2016-11-13 01:01:06 PST
<rdar://problem/29237304>
Comment 5 Ryosuke Niwa 2016-11-13 01:09:31 PST
Created attachment 294661 [details]
Updated for ToT
Comment 6 Darin Adler 2016-11-13 11:34:02 PST
Comment on attachment 294661 [details]
Updated for ToT

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

> Source/WebCore/bindings/js/JSCustomElementInterface.cpp:85
> +    return element.get();

This churns the reference count. Should do WTFMove(element) instead to avoid that.

> Source/WebCore/dom/DOMImplementation.cpp:118
> +        ASSERT(!document->domWindow()); // createElemenNS should not synchronously construct a custom element here.

Typo, missing "t" in createElementNS.

Also completely unclear what domWindow has to do with createElementNS.

> Source/WebCore/dom/Document.cpp:881
> +static bool isValidHTMLElementName(const AtomicString& localName) { return Document::isValidName(localName); }
> +static bool isValidHTMLElementName(const QualifiedName& name) { return Document::isValidName(name.localName()); }

Can we write these out normally instead of as one-liners? Should they be marked inline?

> Source/WebCore/dom/Document.cpp:883
> +template <class NameType>

Should be template<typename NameType>; we prefer typename or class and no space after "template".
Comment 7 Ryosuke Niwa 2016-11-14 15:53:00 PST
Thanks for the review.

(In reply to comment #6)
> Comment on attachment 294661 [details]
> Updated for ToT
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=294661&action=review
> 
> > Source/WebCore/bindings/js/JSCustomElementInterface.cpp:85
> > +    return element.get();
> 
> This churns the reference count. Should do WTFMove(element) instead to avoid
> that.

Fixed.

> > Source/WebCore/dom/DOMImplementation.cpp:118
> > +        ASSERT(!document->domWindow()); // createElemenNS should not synchronously construct a custom element here.
> 
> Typo, missing "t" in createElementNS.
> 
> Also completely unclear what domWindow has to do with createElementNS.

Revised to: If domWindow is not null, createElementNS could find CustomElementRegistry and arbitrary scripts.

> > Source/WebCore/dom/Document.cpp:881
> > +static bool isValidHTMLElementName(const AtomicString& localName) { return Document::isValidName(localName); }
> > +static bool isValidHTMLElementName(const QualifiedName& name) { return Document::isValidName(name.localName()); }
> 
> Can we write these out normally instead of as one-liners? Should they be
> marked inline?

Fixed, and added inline keyword.

> > Source/WebCore/dom/Document.cpp:883
> > +template <class NameType>
> 
> Should be template<typename NameType>; we prefer typename or class and no
> space after "template".

Fixed.
Comment 8 Ryosuke Niwa 2016-11-14 15:53:42 PST
Created attachment 294767 [details]
Patch for landing
Comment 9 Ryosuke Niwa 2016-11-14 15:54:23 PST
Created attachment 294768 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2016-11-14 16:30:10 PST
Comment on attachment 294768 [details]
Patch for landing

Clearing flags on attachment: 294768

Committed r208716: <http://trac.webkit.org/changeset/208716>
Comment 11 WebKit Commit Bot 2016-11-14 16:30:16 PST
All reviewed patches have been landed.  Closing bug.