Bug 154944 - Disallow custom elements inside a window-less documents
Summary: Disallow custom elements inside a window-less documents
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-03-02 17:32 PST by Ryosuke Niwa
Modified: 2016-03-03 16:28 PST (History)
8 users (show)

See Also:


Attachments
Fixes the bug (18.54 KB, patch)
2016-03-02 23:22 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed debug builds (19.26 KB, patch)
2016-03-02 23:53 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated the bug title (19.29 KB, patch)
2016-03-03 00:06 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Address Darin's comment and updated per recent discussion on Github (18.98 KB, patch)
2016-03-03 16:17 PST, Ryosuke Niwa
koivisto: review+
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-03-02 17:32:41 PST
I accidentally uploaded and landed my patch for the bug 148850 in the bug 154936,
so here's a new bug to actually fix the bug 154936 was intended to fix.
Comment 1 Radar WebKit Bug Importer 2016-03-02 17:37:34 PST
<rdar://problem/24944875>
Comment 2 Ryosuke Niwa 2016-03-02 23:22:18 PST
Created attachment 272734 [details]
Fixes the bug
Comment 3 Ryosuke Niwa 2016-03-02 23:53:51 PST
Created attachment 272736 [details]
Fixed debug builds
Comment 4 Ryosuke Niwa 2016-03-03 00:06:11 PST
Created attachment 272738 [details]
Updated the bug title
Comment 5 Ryosuke Niwa 2016-03-03 01:25:49 PST
I don't think the Windows EWS failure is related to this patch.
Comment 6 Darin Adler 2016-03-03 09:30:21 PST
Comment on attachment 272738 [details]
Updated the bug title

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

> Source/WebCore/bindings/js/JSDocumentCustom.cpp:155
> +        ExceptionCodeWithMessage ec;
> +        ec.code = NOT_SUPPORTED_ERR;
> +        ec.message = "Cannot define a custom element in template content's document";
> +        setDOMException(&state, ec);
> +        return jsUndefined();

Isn’t here a helper function that does more of this? If not, we should make one. The helper function should be written so that this code reads more like this:

    return throwNotSupportedException(state, "Cannot define a custom element in template content's document");

> Source/WebCore/dom/CustomElementDefinitions.h:51
> +    static Ref<CustomElementDefinitions> create() { return adoptRef(*new CustomElementDefinitions()); }

You can omit those parentheses.

> Source/WebCore/dom/Document.cpp:6359
> +    ASSERT(!m_customElementDefinitions);

Do we also want to assert document.m_customElementDefinitions is non-null?
Comment 7 Ryosuke Niwa 2016-03-03 16:17:20 PST
Created attachment 272789 [details]
Address Darin's comment and updated per recent discussion on Github
Comment 8 Ryosuke Niwa 2016-03-03 16:18:08 PST
We realized that we can't share the registry with window-less document either so we're forbidding that as well.
Comment 9 Ryosuke Niwa 2016-03-03 16:28:34 PST
Committed r197528: <http://trac.webkit.org/changeset/197528>