Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e95d3cb282b586c54897b153b498c4fa46310d0a
      
https://github.com/WebKit/WebKit/commit/e95d3cb282b586c54897b153b498c4fa46310d0a
  Author: Sihui Liu <[email protected]>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/Navigator.cpp
    M Source/WebCore/page/SecurityOriginData.cpp
    M Source/WebCore/page/SecurityOriginData.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm

  Log Message:
  -----------
  [Site Isolation] Partially fix WKNavigation.Frames
https://bugs.webkit.org/show_bug.cgi?id=309103
rdar://171660809

Reviewed by Per Arne Vollan.

API test WKNavigation.Frames is a complex test case that involves multiple 
navigations and delegate callbacks. It is
currently failing under Site Isolation due to multiple issues. This patch fixes 
some of them and adds dedicated tests.
Here are the issues and fixes:
1. The test expects `WKFrameInfo._errorOccurred` to be the value from currently 
loading frame. However, `WebFrame::info`
returns the value of `coreLocalFrame`, which is not necessarily the loading 
frame and it can be null (because the core
frame is remote) when the frame is doing provisional load.
To fix it, make `WebFrame::info` check for `m_provisionalFrame` when trying to 
set `FrameInfoData::errorOccurred`.
2. The test expects `WKFrameInfo.securityOrigin` to be the last committed 
origin of frame (i.e. if the frame loads a
non-null URL before, then security origin should be origin of that URL). 
However, `WebFrame::info` returns the security
origin of  `coreLocalFrame`. As mentioned in 1, `coreLocalFrame` can be null if 
frame is doing provisional load; in this
case we can get the origin from the `coreRemoteFrame` or simply `coreFrame`.
To fix it, this patch renames `SecurityOriginData::fromFrame` to 
`SecurityOriginData::fromLocalFrame` and adds a new
function `SecurityOriginData::fromFrame`, which takes a `WebCore::Frame`, and 
use the new function in `WebFrame::info`.
3. The test expects `WKFrameInfo.request` to include the frame's current URL 
(last committed URL). Under Site Isolation,
when UI process tells a different web process to start a provisonal frame load, 
it does not tell that web process about
the current frame URL, as the web process shouldn't depend on previous URL for 
loading (and process has strict access to
sensitive information under Site Isolation). So for these web processes, when 
they create `FrameDataInfo` and include it
in `WebPageProxy::DidStartProvisionalLoadForFrame` and 
`WebPageProxy::DidFailProvisionalLoadForFrame` messages, they
won't be able to create requests the test (or existing clients) expects.
To fix it, this patch makes UI process update the request in 
`WebPageProxy::didFailProvisionalLoadForFrameShare` and
`WebPageProxy::didStartProvisionalLoadForFrame` with correct URLs before 
invoking delegate callbacks.

API tests: WKNavigation.FramesWithHTTPSNavigation
           WKNavigation.FramesWithLoadingError

* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::didAccessWindowProxyPropertyViaOpener):
* Source/WebCore/page/Navigator.cpp:
(WebCore::Navigator::setAppBadge):
* Source/WebCore/page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::fromLocalFrame):
(WebCore::SecurityOriginData::fromFrame):
* Source/WebCore/page/SecurityOriginData.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::info const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
(-[FrameNavigationDelegate validateCallbacks:]):
(-[FrameNavigationDelegate 
webView:didReceiveAuthenticationChallenge:completionHandler:]):
(TEST(WKNavigation, Frames)):
(TEST(WKNavigation, FramesWithHTTPSNavigation)):
(TEST(WKNavigation, FramesWithLoadingError)):

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



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

Reply via email to