Bug 230941 - Some WebIDL operations / attributes incorrectly use _current_ realm instead of _relevant_
Summary: Some WebIDL operations / attributes incorrectly use _current_ realm instead o...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Trivial
Assignee: Alexey Shvayka
URL:
Keywords: InRadar
Depends on:
Blocks: 231702
  Show dependency treegraph
 
Reported: 2021-09-29 02:10 PDT by Alexey Shvayka
Modified: 2022-02-04 06:31 PST (History)
14 users (show)

See Also:


Attachments
Patch (38.57 KB, patch)
2021-09-29 02:37 PDT, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Patch for landing (50.63 KB, patch)
2021-12-10 17:03 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shvayka 2021-09-29 02:10:59 PDT
Some WebIDL operations / attributes incorrectly use _current_ realm instead of _relevant_
Comment 1 Alexey Shvayka 2021-09-29 02:37:14 PDT
Created attachment 439585 [details]
Patch
Comment 2 EWS Watchlist 2021-09-29 02:38:09 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 Radar WebKit Bug Importer 2021-09-29 09:54:18 PDT
<rdar://problem/83675608>
Comment 4 Sam Weinig 2021-10-16 09:36:24 PDT
Comment on attachment 439585 [details]
Patch

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

> Source/WebCore/ChangeLog:22
> +        Most of the remaining [CallWith=GlobalObject] instances are correctly used for
> +        converting JS arguments to WebIDL values; the rest, along with _current_ Document
> +        and ScriptExecutionContext, either match the spec or replacing them with _relevant_
> +        global object is not directly observable (see condition #3).

It would be great to have some guidance to others in the future that need to figure out which the correct document/globalObject,scriptExecutionContext is the right one to use (though I don't have a great idea where to put this guidance).
Comment 5 Sam Weinig 2021-10-16 09:38:20 PDT
Perhaps also remaining the non-prefixed ones to use Current/Entry/etc prefixes would help, since people would feel they need to understand the concept before picking.
Comment 6 Alexey Shvayka 2021-10-16 09:50:57 PDT
(In reply to Sam Weinig from comment #5)

Thanks for review!

> Perhaps also remaining the non-prefixed ones to use Current/Entry/etc
> prefixes would help, since people would feel they need to understand the
> concept before picking.

Yeah, that is the plan. Having _current_ by default, for non-prefixed values, is prone to introducing incompatibilities.

For now I will add a spec link to both IDLAttributes.json and CodeGeneratorJS.pm; WHATWG editors did a great job explaining the concepts.
Comment 7 Sam Weinig 2021-11-15 09:02:31 PST
(In reply to Alexey Shvayka from comment #6)
> (In reply to Sam Weinig from comment #5)
> 
> Thanks for review!
> 
> > Perhaps also remaining the non-prefixed ones to use Current/Entry/etc
> > prefixes would help, since people would feel they need to understand the
> > concept before picking.
> 
> Yeah, that is the plan. Having _current_ by default, for non-prefixed
> values, is prone to introducing incompatibilities.
> 
> For now I will add a spec link to both IDLAttributes.json and
> CodeGeneratorJS.pm; WHATWG editors did a great job explaining the concepts.

Sounds great. (The more we can use spec names in our code, the better in my book. I would love to see more done in this area, especially in the area of JSC functions that WebCore bindings have to interact with).
Comment 8 Alexey Shvayka 2021-12-10 17:03:58 PST
Created attachment 446847 [details]
Patch for landing
Comment 9 Alexey Shvayka 2021-12-10 17:05:53 PST
(In reply to Alexey Shvayka from comment #8)
> Created attachment 446847 [details]
> Patch for landing

Also added bindings tests for newly added Relevant* values.
Comment 10 EWS 2021-12-10 18:27:51 PST
Committed r286895 (245123@main): <https://commits.webkit.org/245123@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446847 [details].
Comment 11 Alexey Shvayka 2022-02-04 06:31:17 PST
(In reply to Sam Weinig from comment #5)
> Perhaps also remaining the non-prefixed ones to use Current/Entry/etc
> prefixes would help, since people would feel they need to understand the
> concept before picking.

Hey Sam, that change is now up for available for review: https://bugs.webkit.org/show_bug.cgi?id=236137. Thanks!