[webkit-changes] [WebKit/WebKit] 9fcc0a: window.open with noopener shouldn't create page in...

Alex Christensen noreply at github.com
Wed Oct 16 22:56:59 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9fcc0a6c7237291ae714b3a67fce464c96997062
      https://github.com/WebKit/WebKit/commit/9fcc0a6c7237291ae714b3a67fce464c96997062
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2024-10-16 (Wed, 16 Oct 2024)

  Changed paths:
    M LayoutTests/http/tests/dom/noopener-window-not-targetable-expected.txt
    M LayoutTests/http/tests/dom/noopener-window-not-targetable.html
    M LayoutTests/http/tests/dom/noopener-window-not-targetable2-expected.txt
    M LayoutTests/http/tests/dom/noopener-window-not-targetable2.html
    M LayoutTests/http/tests/dom/noreferrer-window-not-targetable-expected.txt
    M LayoutTests/http/tests/dom/noreferrer-window-not-targetable.html
    M LayoutTests/http/tests/download/sandboxed-iframe-download-not-allowed-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coop-coep-sandbox.https-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coop-sandbox.https-expected.txt
    A LayoutTests/platform/mac-wk1/http/tests/dom/noopener-window-not-targetable-expected.txt
    A LayoutTests/platform/mac-wk1/http/tests/dom/noopener-window-not-targetable2-expected.txt
    A LayoutTests/platform/mac-wk1/http/tests/dom/noreferrer-window-not-targetable-expected.txt
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebKit/Shared/NavigationActionData.h
    M Source/WebKit/UIProcess/API/APINavigationAction.h
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  window.open with noopener shouldn't create page in opener process
https://bugs.webkit.org/show_bug.cgi?id=279031
rdar://135438724

Reviewed by Charlie Wolfe.

We used to make a page in the opener process then navigate it and immediately discard it.
That doesn't play well with site isolation's process accounting.  JS can't observe this
because window.open returns null in such a case.

In order to implement this, I need to only call API::PageConfiguration::setRelatedPage
if there is actually an opener, and I need to remove the now duplicate checks that verify
the API client is using the provided WKWebViewConfiguration by checking the related page.
There is already another check that verifies using the opener info.

The referrer set in WebCore::createWindow needs to check WindowFeatures::wantsNoReferrer
like the one in LocalDOMWindow::createWindow.  This referrer was never used because until
now LocalDOMWindow::createWindow made a second FrameLoadRequest with the correct referrer,
but now the referrer in WebCore::createWindow needs to be correct because that is what is
sent to another process now to be the referrer of the initial request of the new page.

A few layout tests in http/tests/dom count the number of windows in the process that is
finishing the test.  Since one of the windows is now opening in another process in modern
WebKit, the count goes from 3 to 2.  WebKitLegacy test expectations are unchanged for
those three tests.  Same with a few other tests that now have an error printed in multiple
processes.

* LayoutTests/http/tests/dom/noopener-window-not-targetable-expected.txt:
* LayoutTests/http/tests/dom/noopener-window-not-targetable.html:
* LayoutTests/http/tests/dom/noopener-window-not-targetable2-expected.txt:
* LayoutTests/http/tests/dom/noopener-window-not-targetable2.html:
* LayoutTests/http/tests/dom/noreferrer-window-not-targetable-expected.txt:
* LayoutTests/http/tests/dom/noreferrer-window-not-targetable.html:
* LayoutTests/http/tests/download/sandboxed-iframe-download-not-allowed-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coop-coep-sandbox.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/coop-sandbox.https-expected.txt:
* LayoutTests/platform/mac-wk1/http/tests/dom/noopener-window-not-targetable-expected.txt: Copied from LayoutTests/http/tests/dom/noopener-window-not-targetable-expected.txt.
* LayoutTests/platform/mac-wk1/http/tests/dom/noopener-window-not-targetable2-expected.txt: Copied from LayoutTests/http/tests/dom/noopener-window-not-targetable2-expected.txt.
* LayoutTests/platform/mac-wk1/http/tests/dom/noreferrer-window-not-targetable-expected.txt: Copied from LayoutTests/http/tests/dom/noreferrer-window-not-targetable-expected.txt.
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::createWindow):
* Source/WebKit/Shared/NavigationActionData.h:
* Source/WebKit/UIProcess/API/APINavigationAction.h:
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageLoadURLWithUserData):
(WKPageLoadURLRequestWithUserData):
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::createNewPage):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::createNewPage):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::create):
(WebKit::m_textAnimationController):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
((ProcessSwap, SameSiteWindowOpenNoOpener)):
((ProcessSwap, SameSiteWindowOpenWithNameNoOpener)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, OpenWithNoopener)):

Canonical link: https://commits.webkit.org/285310@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list