Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[COOP] html/cross-origin-opener-policy/coop-same-origin-allow-popups-…
…document-write.html WPT test is failing https://bugs.webkit.org/show_bug.cgi?id=229692 Reviewed by Darin Adler. LayoutTests/imported/w3c: * web-platform-tests/html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write-expected.txt: Rebaseline WPT test that is now passing. * web-platform-tests/html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html: Merge typo fix from web-platform-tests/wpt@0adccdd Source/WebCore: The test does the following: 1. An opener document with `COOP=same-origin-allow-popups` opens a new window that shows the initial empty document. Note that the openee inherits `COOP=same-origin-allow-popups` from its opener. 2. The opener document then calls document.write() on the openee. Note that, as per the HTML specification, this clears the 'is displaying initial empty document' flag. 3. The openee is navigated cross-origin to a destination without COOP. Normally, `COOP=same-origin-allow-popups` would allow the popup to be navigated cross-origin as per the logic here [1]: """ If all of the following are true: - isInitialAboutBlank, - activeDocumentCOOPValue's value is "same-origin-allow-popups". - responseCOOPValue is "unsafe-none", then return false (meaning, no context group switch). """ However, because of the document.write() call at step 2, the isInitialAboutBlank flag is no longer true and the check should fail, thus causing a browsing context group switch. [1] https://html.spec.whatwg.org/multipage/origin.html#check-browsing-context-group-switch-coop-value No new tests, rebaselined existing test. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::maybeLoadEmpty): Replace the bad check to committedFirstRealDocumentLoad (which stays true after calling document.write() on the initial empty document) with a check to !isDisplayingInitialEmptyDocument, which matches the specification text. isDisplayingInitialEmptyDocument correctly becomes false after calling document.write() on the initial empty document. * loader/DocumentLoader.h: (WebCore::DocumentLoader::crossOriginOpenerPolicy const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::didBeginDocument): Fix didBeginDocument() so that it doesn't overwrite the document's cross-origin-opener-policy when the DocumentLoader does not know what the policy is. When opening a popup, Document::initSecurityContext() will set the popup's cross-origin-opener-policy to the one of its opener. When didBeginDocument() gets called later for the initial empty document, we don't want to overwrite the inherited policy with a new default cross-origin-opener-policy of unsafe-none. The reason the DocumentLoader does not have a policy for us is because this is the initial empty document and DocumentLoader's doCrossOriginOpenerHandlingOfResponse() was thus never called with an actual network response. Canonical link: https://commits.webkit.org/241139@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281802 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
70 additions
and 6 deletions.
- +13 −0 LayoutTests/imported/w3c/ChangeLog
- +1 −1 ...m-tests/html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write-expected.txt
- +1 −1 ...-platform-tests/html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html
- +49 −0 Source/WebCore/ChangeLog
- +1 −1 Source/WebCore/loader/DocumentLoader.cpp
- +1 −1 Source/WebCore/loader/DocumentLoader.h
- +4 −2 Source/WebCore/loader/FrameLoader.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,3 +1,3 @@ | ||
|
||
PASS coop-same-origin-allow-popups-document-write | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters