fix(webkit): support Cross-Origin-Opener-Policy navigation#9120
fix(webkit): support Cross-Origin-Opener-Policy navigation#9120yury-s wants to merge 11 commits into
Conversation
| shouldIgnoreFrameStoppedLoading(frameId: string): boolean { | ||
| if (frameId !== this._frameId) | ||
| return false; | ||
| // Navigation in the original frame is canceled and actually continues in the |
There was a problem hiding this comment.
I am afraid this might not be always the case. For example, we navigate to cross-origin 204 page that creates a provisional page but never commits?
There was a problem hiding this comment.
Coincidentally that works because we generate loadingFinished event in WebKit ourselves when 204 response comes:
playwright/src/server/webkit/wkPage.ts
Lines 1023 to 1030 in 45b365d
With network failures we will receive Playwright.provisionalLoadFailed and that will abort the navigation, so we are good in that case too. Added a test.
| } | ||
|
|
||
| checkIfDuplicateResponseEvent(event: Protocol.Network.responseReceivedPayload): boolean { | ||
| if (this._originalRequestId === event.requestId || this._provisionalPageRequestId === event.requestId) { |
There was a problem hiding this comment.
Can we ignore responses from the old web process only? This ensures that we get correct response from the new web process, in case WebKit fixes more security holes in the old web process and send bogus response from there (if any).
There was a problem hiding this comment.
At the moment response notification comes from old process we don't know if it's gonna be a cross-process or same process navigation. In case of same-process navigation we have to dispatch messages from the old process. Unless we introduce a separate notification that the navigation turned into cross-process and buffer up some messages from old web process before the notification arrives we cannot safely ignore responses from the old web process .
007faea to
6c32eff
Compare
|
Seems not needed anymore, closing. |
WebKit recently enabled support for Cross-Origin-Opener-Policy / Cross-Origin-Embedder-Policy and decision about whether navigation should happen in a new process now made twice:
In the latter case the requestWillBeSent and responseReceivedEvents are fired in the original process and then (if process should be swapped) fired again in the new process (with new request id but same loaderId). Moreover, after the response policy decision the old process will send Page.frameStoppedLoading and Network.loadingFailed(canceled) events. We now ignore those events if there is ongoing navigation in a provisional page.
Fixes #9065