-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[COOP] Unable to reconcile html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html with the specification #6960
Comments
cc @camillelamy |
cc @ArthurSonzogni who I think was involved in the WPT test (https://bugs.chromium.org/p/chromium/issues/detail?id=1216244) |
/cc @rakina since it involves her favorite thing, the initial about:blank and document.write(). My totally uneducated guess is that Chrome's notion of is initial about:blank isn't fully synced between our renderer and browser processes, so it doesn't properly get the signal of isInitialAboutBlank = false. |
Your reading of the spec is perfectly correct! I initially thought this behavior was a bug in Chrome when I received bugs and wrote this regression test... Swapping browsing context group because of document.write is indeed the consequence of the specification. There are issues with websites using the closure library. This library causes I think what is needed now is to invert the expectations. We should also probably fill a bug against the closure library so that they could maybe provide an alternative implementation. |
This might be a really good time to separate "is initial about:blank"-ness by use cases, which we discussed here, but only for "window reuse" vs "history replacement". Currently The current references to "is initial about blank" and "still on its initial about:blank" are all about those two cases (history & window reuse), except for the COOP case discussed here. For this use case, I think we have a few options:
|
So the end goal of the initial about:blank check for COOP same-origin-allow-popups is the following:
At the same time, we also need popups to inherit their COOP from the opener, at least if they are same-origin. So we ended up with checking the initial about:blankness. I don't really think we have a better choice here - as I do believe that using document.write on the initial about blank document does put the subsequent navigation into case 2 of the above. We should update the test to match the spec expectations and file a bug against libraries using this mechanism. |
Will do both soon. |
Update test expectations to follow the current HTML specification. Bug:whatwg/html#6960 Bug:google/closure-library#1137 Bug:1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be
Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551}
Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551}
Done:
I guess this issue is now resolved. |
Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551}
Thanks all for the followup here! |
Following up in web-platform-tests/wpt#30243 because I don't think the WPT test is entirely correct. |
…ations., a=testonly Automatic update from web-platform-tests COOP:SOAP vs document.write update expecations. Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551} -- wpt-commits: 18f738d6c0a314f7230c7f6c9f3cd943e5b5c009 wpt-pr: 30049
…ations., a=testonly Automatic update from web-platform-tests COOP:SOAP vs document.write update expecations. Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551} -- wpt-commits: 18f738d6c0a314f7230c7f6c9f3cd943e5b5c009 wpt-pr: 30049
Update test expectations to follow the current HTML specification. Bug: whatwg/html#6960 Bug: google/closure-library#1137 Bug: 1216244 Change-Id: Ib8bd9e69a5a84de47577f5be1c211af9a35468be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3097699 Commit-Queue: Arthur Sonzogni <[email protected]> Commit-Queue: Camille Lamy <[email protected]> Auto-Submit: Arthur Sonzogni <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#912551} NOKEYCHECK=True GitOrigin-RevId: b83a573bae82e84554a8b2ebe8636f56d940a782
In html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html:
Document A has COOP=same-origin-allow-popups
Document A calls
window.open()
(Let's call Document B, the document in openee)Document A calls document.write() on Document B, adding a
<meta http-equiv="refresh">
to navigate the popup cross-origin and with coop=unsafe-none.The test does not expect the refresh navigation to swap browsing context group and I am unable to figure out why from the specification.
Because Document A has COOP=same-origin-allow-popup, I believe Document B inherits COOP=same-origin-allow-popup as well before the document.write().
Then document.write() is called and as per the document write steps, we would call the document open steps. Step 13 of the document open steps says:
So then the navigation from occurs in the popup, activeCOOP=same-origin-allow-popup and isInitialAboutBlank=false when we call the check browsing context group switch coop value steps, I believe:
From my reading of the specification, this SHOULD cause a browsing context group switch because isInitialAboutBlank=false, due to the earlier call to
document.write()
. However, this is not what the test expects or Chrome's behavior.What am I missing?
The text was updated successfully, but these errors were encountered: