Bug 235736

Summary: Expose some web APIs on Shadow Realms and Worklets
Product: WebKit Reporter: Joseph Griego <joseph.j.griego>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, caitp, calvaris, cdumez, changseok, clopez, darin, esprehn+autocc, ews-watchlist, gyuyoung.kim, kangil.han, kondapallykalyan, lmoura, webkit-bug-importer, youennf, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 234554    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Joseph Griego 2022-01-27 14:41:50 PST
Expose some web APIs on Shadow Realms and Worklets
Comment 1 Joseph Griego 2022-01-27 14:44:23 PST
Created attachment 450181 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2022-02-03 14:42:17 PST
<rdar://problem/88456764>
Comment 3 Joseph Griego 2022-02-28 13:50:29 PST
Created attachment 453421 [details]
Patch
Comment 4 EWS Watchlist 2022-02-28 13:52:43 PST
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 5 Joseph Griego 2022-02-28 14:18:55 PST
Created attachment 453426 [details]
Patch
Comment 6 Darin Adler 2022-02-28 18:18:54 PST
Comment on attachment 453426 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        Mark a handful of web APIs as Exposed=*, making them visible in shadow
> +        realm contexts. The existence of these APIs is checked by new idlharness-shadowrealm
> +        tests in WPT, which have been imported.

Is [Exposed=*] part of the WebIDL specification? It does not seem particularly forward looking.
Comment 7 Joseph Griego 2022-03-01 07:51:22 PST
Hi Darin,

Exposed=* was added fairly recently, in January:
https://webidl.spec.whatwg.org/#Exposed
https://github.com/whatwg/webidl/pull/526

AIUI it's probably not going to be used on many more interfaces.
Comment 8 Caitlin Potter (:caitp) 2022-03-07 09:18:14 PST
Comment on attachment 453426 [details]
Patch

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

It's hard to argue with the improvements in the WPT results --- LGTM

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1975
> +            return $contextExposures eq "*";

Personally, I'd be happy if there was a comment here like the one in the ChangeLog explaining why this is needed, so future readers don't need to find the ChangeLog entry to understand it. It isn't entirely intuitive, IMHO.

> Also required adjustment to CodeGeneratorJS.pm since it refused to
> generate a runtime check when a member is exposed less than the interface it
> appears on *and* in more than one scope.
Comment 9 Joseph Griego 2022-03-11 13:53:48 PST
Created attachment 454509 [details]
Patch
Comment 10 Yusuke Suzuki 2022-03-14 11:44:34 PDT
Comment on attachment 454509 [details]
Patch

r=me
Comment 11 Joseph Griego 2022-03-14 12:49:27 PDT
Comment on attachment 454509 [details]
Patch

Thanks, Yusuke :)
Comment 12 EWS 2022-03-15 09:38:34 PDT
Committed r291295 (248434@main): <https://commits.webkit.org/248434@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454509 [details].
Comment 13 Darin Adler 2022-03-16 15:48:51 PDT
Comment on attachment 454509 [details]
Patch

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

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1974
> +        # if the interface exposure list isn't an arary, wrap it in one; unless the

Typo here in the word "array".