WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 220658
A DOMWindow should not be reused if its JSDOMWindow has been created
https://bugs.webkit.org/show_bug.cgi?id=220658
Summary
A DOMWindow should not be reused if its JSDOMWindow has been created
youenn fablet
Reported
2021-01-15 08:32:26 PST
WindowProxy should be updated when the DOMWindow is transitioned from one document to another
Attachments
WIP
(2.36 KB, patch)
2021-01-15 10:46 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(8.46 KB, patch)
2021-01-18 00:42 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(8.46 KB, patch)
2021-01-20 01:06 PST
,
youenn fablet
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2021-01-15 08:32:48 PST
<
rdar://problem/70335075
>
youenn fablet
Comment 2
2021-01-15 10:46:31 PST
Created
attachment 417715
[details]
WIP
youenn fablet
Comment 3
2021-01-15 10:50:25 PST
One repro step for the problem: - Update MobileMiniBrowser to be limitsNavigationsToAppBoundDomains and add webkit.org to the allowed list - Add a navigation delegate to block about:blank and instead make it load another secure domain than webkit.org. - Load webkit.org and attach an inspector to it - Through inspector, trigger loading to about:blank - This should go to the other domain page. At that point, the JSDOMWindow will be created before having the document with the secure context. Window properties that are secure will not show up. I am not sure how to further reduce the test case. It seems this is triggered by limitsNavigationsToAppBoundDomains so I am unsure whether this is the exact right fix.
Geoffrey Garen
Comment 4
2021-01-15 14:24:21 PST
I'm not sure why limitsNavigationsToAppBoundDomains specifically triggers this; it seems like any app or extension use of JavaScript in the page could potentially trigger this. Code change seems OK to me; but EWS is angry.
youenn fablet
Comment 5
2021-01-18 00:28:47 PST
(In reply to Geoffrey Garen from
comment #4
)
> I'm not sure why limitsNavigationsToAppBoundDomains specifically triggers > this; it seems like any app or extension use of JavaScript in the page could > potentially trigger this.
Right, my testing was wrong without limitsNavigationsToAppBoundDomains. The bug can be done with early JS injection, prior to the document having its security origin and URL set. Web Inspector also triggers this.
youenn fablet
Comment 6
2021-01-18 00:30:00 PST
> Code change seems OK to me; but EWS is angry.
We need to handle the window.open in same process case where the window document secure context is set by its opener, hence the wrapping is done correctly.
youenn fablet
Comment 7
2021-01-18 00:42:57 PST
Created
attachment 417810
[details]
Patch
youenn fablet
Comment 8
2021-01-18 00:47:24 PST
(In reply to youenn fablet from
comment #7
)
> Created
attachment 417810
[details]
> Patch
Patch covers the case of isSecureContext. Patch also covers most of the Quirked properties as well, but it is difficult to ensure this in the future as this might depend on how quirks will implement their checks.
youenn fablet
Comment 9
2021-01-18 02:12:08 PST
Comment on
attachment 417810
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417810&action=review
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:822 > + [webView stringByEvaluatingJavaScript:@""];
Maybe there is a known pattern, but it might be difficult for developers to know when they can evaluate JS in a page being loaded, before page JS starts executing but after the DOMWindow has its final document. Maybe we should consider delaying evaluation of this JS a bit so that the DOMWindow would have a correct SecurityOrigin. Also, the transition of the window to a new document is clearing location or navigator, which might have subtle and potentially racy effects.
Geoffrey Garen
Comment 10
2021-01-19 10:39:56 PST
Comment on
attachment 417810
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=417810&action=review
r=me
> Source/WebCore/page/DOMWindow.h:487 > + bool m_wasWrappedWithoutInitializedDocument { false };
I would call this wasWrappedWithoutInitializedSecurityOrigin, since it's the security origin that was not initialized.
youenn fablet
Comment 11
2021-01-20 01:06:24 PST
Created
attachment 417950
[details]
Patch for landing
EWS
Comment 12
2021-01-20 02:41:35 PST
Committed
r271642
: <
https://trac.webkit.org/changeset/271642
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 417950
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug