Bug 187851 - Add CEReactions=NotNeeded for reactions only needed for customized builtins
Summary: Add CEReactions=NotNeeded for reactions only needed for customized builtins
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Frédéric Wang (:fredw)
URL: https://www.w3.org/TR/html-media-capt...
Keywords: InRadar
Depends on:
Blocks: 188368
  Show dependency treegraph
 
Reported: 2018-07-20 02:39 PDT by Frédéric Wang (:fredw)
Modified: 2018-08-06 17:15 PDT (History)
11 users (show)

See Also:


Attachments
Patch (9.48 KB, patch)
2018-07-21 11:21 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.99 MB, application/zip)
2018-07-21 19:36 PDT, EWS Watchlist
no flags Details
Patch (84.77 KB, patch)
2018-07-22 09:27 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Patch (85.29 KB, patch)
2018-07-23 01:22 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews201 for win-future (12.76 MB, application/zip)
2018-07-24 04:10 PDT, EWS Watchlist
no flags Details
Patch (85.71 KB, patch)
2018-07-26 05:13 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
Adds CEReactions=NotNeeded (19.98 KB, patch)
2018-08-04 02:07 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Adds the basic support (38.15 KB, patch)
2018-08-04 02:17 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed release builds (38.16 KB, patch)
2018-08-06 13:43 PDT, Ryosuke Niwa
cdumez: review+
cdumez: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2018-07-20 02:39:32 PDT
partial interface HTMLInputElement {
    [CEReactions]
    attribute DOMString capture;
};

This is tested by https://w3c-test.org/custom-elements/reactions/HTMLInputElement.html (imported in bug 187806) but we lack support for customized built-in elements (bug 187849) so the test fails.
Comment 1 Ryosuke Niwa 2018-07-20 10:44:50 PDT
This should be easy to fix!
Comment 2 Frédéric Wang (:fredw) 2018-07-20 11:48:55 PDT
(In reply to Ryosuke Niwa from comment #1)
> This should be easy to fix!

Yes, just a change in the IDL file but I was not sure how to test it. Maybe https://w3c-test.org/custom-elements/reactions/HTMLInputElement.html can be modified to not rely on customized built-in elements?
Comment 3 Ryosuke Niwa 2018-07-20 12:18:30 PDT
Oh, actually, this is one of those [CEReactions] that are only needed for customized builtins. We should simply either new IDL attribute e.g. [CEReactionsNotNeeded] or make  CEReactions take a value as in [CEReactions=NotNeeded] and simply assert that there is no new custom element reaction being enqueued.
Comment 4 Frédéric Wang (:fredw) 2018-07-20 12:38:35 PDT
(In reply to Ryosuke Niwa from comment #3)
> Oh, actually, this is one of those [CEReactions] that are only needed for
> customized builtins. We should simply either new IDL attribute e.g.
> [CEReactionsNotNeeded] or make  CEReactions take a value as in
> [CEReactions=NotNeeded] and simply assert that there is no new custom
> element reaction being enqueued.

I see. Yes, probably we should do something like that for all the similar cases, so that one is not surprised when comparing the IDL against the spec.
Comment 5 Frédéric Wang (:fredw) 2018-07-21 11:21:34 PDT
Created attachment 345514 [details]
Patch
Comment 6 Frédéric Wang (:fredw) 2018-07-21 11:22:56 PDT
(In reply to Ryosuke Niwa from comment #3)
> Oh, actually, this is one of those [CEReactions] that are only needed for
> customized builtins. We should simply either new IDL attribute e.g.
> [CEReactionsNotNeeded] or make  CEReactions take a value as in
> [CEReactions=NotNeeded] and simply assert that there is no new custom
> element reaction being enqueued.

@Ryosuke: I just uploaded a patch that tries to do that. Is it what we you had in mind?

Note: I still need to add tests and do all the CEReaction=NotNeeded.
Comment 7 EWS Watchlist 2018-07-21 11:23:37 PDT
Attachment 345514 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 EWS Watchlist 2018-07-21 11:25:24 PDT
Comment on attachment 345514 [details]
Patch

Attachment 345514 [details] did not pass bindings-ews (mac):
Output: https://webkit-queues.webkit.org/results/8610226

New failing tests:
(JS) JSTestCEReactions.cpp
(JS) JSTestCEReactionsStringifier.cpp
Comment 9 EWS Watchlist 2018-07-21 19:36:11 PDT
Comment on attachment 345514 [details]
Patch

Attachment 345514 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8612417

New failing tests:
http/tests/security/canvas-remote-read-remote-video-blocked-no-crossorigin.html
Comment 10 EWS Watchlist 2018-07-21 19:36:22 PDT
Created attachment 345531 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 11 Frédéric Wang (:fredw) 2018-07-22 09:27:58 PDT
Created attachment 345538 [details]
Patch
Comment 12 Frédéric Wang (:fredw) 2018-07-23 01:22:13 PDT
Created attachment 345564 [details]
Patch
Comment 13 EWS Watchlist 2018-07-24 04:09:57 PDT
Comment on attachment 345564 [details]
Patch

Attachment 345564 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8636398

New failing tests:
http/tests/security/local-video-source-from-remote.html
http/tests/security/canvas-remote-read-remote-video-localhost.html
Comment 14 EWS Watchlist 2018-07-24 04:10:09 PDT
Created attachment 345656 [details]
Archive of layout-test-results from ews201 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews201  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 15 Sam Weinig 2018-07-24 21:20:10 PDT
Comment on attachment 345564 [details]
Patch

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

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:7220
> +    foreach my $interface (@_) {
> +        if ($interface && $interface->extendedAttributes->{CEReactions}) {
> +            InsertCustomElementReactionStack($outputArray, $conditional, $indent, $interface);
> +            return;
> +        }
> +    }

The thing that worries me here is the case where this function is passed multiple interfaces and on has normal CEReactions and one has CEReactions=NotNeeded.  In that case, depending on the order you passed the interfaces either CustomElementReactionStack or CustomElementReactionStackWithReactionsForbidden will be used. It might be worth asserting that all the passed in interfaces with CEReactions have the same value for those CEReactions.
Comment 16 Frédéric Wang (:fredw) 2018-07-26 05:13:49 PDT
Created attachment 345839 [details]
Patch
Comment 17 Ryosuke Niwa 2018-07-31 17:45:24 PDT
Comment on attachment 345839 [details]
Patch

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

> Source/WebCore/dom/CustomElementReactionQueue.h:109
> +class CustomElementReactionStackWithReactionsForbidden : public CustomElementReactionStack {

I don't think we can afford to instantiate CustomElementReactionStack everywhere like this.
We need to create a completely new class (i.e. doesn't inherit from CustomElementReactionStack) which clang can optimize way.
r- because of this.

Also, this class name is rather verbose. How about UnneededCustomElementReactionStack?

> Source/WebCore/html/HTMLAnchorElement.idl:22
> +    [CEReactions=NotNeeded, Reflect] attribute DOMString charset;

Let's split the patch to make the binding code & actual IDL changes.
Comment 18 Radar WebKit Bug Importer 2018-08-01 22:41:33 PDT
<rdar://problem/42843003>
Comment 19 Ryosuke Niwa 2018-08-04 02:07:54 PDT
Created attachment 346584 [details]
Adds CEReactions=NotNeeded
Comment 20 Ryosuke Niwa 2018-08-04 02:17:29 PDT
Created attachment 346585 [details]
Adds the basic support
Comment 21 Ryosuke Niwa 2018-08-06 13:43:13 PDT
Created attachment 346652 [details]
Fixed release builds
Comment 22 Chris Dumez 2018-08-06 16:43:21 PDT
Comment on attachment 346652 [details]
Fixed release builds

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

r=me

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:7416
> +sub GenerateCustomElementReactionsStackIfNeeed

Typo: GenerateCustomElementReactionsStackIfNeeed -> GenerateCustomElementReactionsStackIfNeeded
Comment 23 Ryosuke Niwa 2018-08-06 17:13:18 PDT
Committed r234636: <https://trac.webkit.org/changeset/234636>