Bug 222589

Summary: WebKitLegacy needs to keep JSDOMWindow even though it is used while its origin is not set
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description youenn fablet 2021-03-02 02:39:45 PST
WebKitLegacy needs to keep JSDOMWindow even though it is used while its origin is not set
Comment 1 youenn fablet 2021-03-02 02:40:10 PST
<rdar://problem/74258258>
Comment 2 youenn fablet 2021-03-02 02:44:53 PST
Created attachment 421917 [details]
Patch
Comment 3 Geoffrey Garen 2021-03-02 12:38:20 PST
Comment on attachment 421917 [details]
Patch

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

r=me

> Source/WebCore/bindings/js/JSWindowProxy.cpp:109
> +        if (!localWindow.document()->haveInitializedSecurityOrigin() && localWindow.document()->settings().windowObjectAlwaysInitializedWithSecurityOriginEnabled())

I wonder if this should include a linked on or after check -- or just be a linked on or after check? Would be nice to avoid unnecessary divergence in web platform behavior.
Comment 4 youenn fablet 2021-03-03 08:36:50 PST
(In reply to Geoffrey Garen from comment #3)
> Comment on attachment 421917 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421917&action=review
> 
> r=me
> 
> > Source/WebCore/bindings/js/JSWindowProxy.cpp:109
> > +        if (!localWindow.document()->haveInitializedSecurityOrigin() && localWindow.document()->settings().windowObjectAlwaysInitializedWithSecurityOriginEnabled())
> 
> I wonder if this should include a linked on or after check -- or just be a
> linked on or after check? Would be nice to avoid unnecessary divergence in
> web platform behavior.

I do not really know.
Are WK1 APIs good enough to handle that case, ie provide easy hooks to delay what people are doing to the point where the origin is set?
I guess we can do that as a follow-up.
Comment 5 EWS 2021-03-03 08:55:10 PST
Committed r273817: <https://commits.webkit.org/r273817>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421917 [details].