Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fe0a3853f26cdab89db9785c4409334207de4667
      
https://github.com/WebKit/WebKit/commit/fe0a3853f26cdab89db9785c4409334207de4667
  Author: Ben Nham <[email protected]>
  Date:   2025-10-09 (Thu, 09 Oct 2025)

  Changed paths:
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  didGeneratePageLoadTiming sometimes does not fire if a subresource request 
occurs around the time of a main frame navigation
https://bugs.webkit.org/show_bug.cgi?id=300416
rdar://162239496

Reviewed by Alex Christensen and Ryosuke Niwa.

PLT depends on didGeneratePageLoadTiming being fired reliably. It isn't firing 
reliably on some
devices right now especially when there is a subresource request made at around 
the time of a main
frame navigation.

After add a bunch of logging, it looks like the issue is this. Suppose there is 
a webpage containing
a main frame MF and an OOP iframe IF. MF is hosted in process A and IF is 
hosted in process B.

1. We commit a main frame load in A. This causes a DidDestroyFrame(IF) message 
to be sent from
   process A to UIProcess.
2. The UIProcess handles the DidDestroyFrame(IF) message, which also clears
   `m_framesWithSubresourceLoadingForPageLoadTiming` for IF.
3. In B, we start a subresource load in IF and send the 
StartNetworkRequestsForPageLoadTiming(IF)
   IPC to UIProcess.
4. The UIProcess handles the StartNetworkRequestsForPageLoadTiming(IF) IPC and 
inserts IF in to
   `m_framesWithSubresourceLoadingForPageLoadTiming` map, indicating IF has 
outstanding requests.
5. Process B handles `FrameWasRemovedInAnotherProcess`, which eventually causes 
the local IF to be
   invalidated. But B never sends a DidDestroyFrame for IF to UIProcess since 
it was already
   destroyed in another process (see the `wasRemovedInAnotherProcess` check in 
`removeWebFrame`).
6. Now the UIProcess has a `m_framesWithSubresourceLoadingForPageLoadTiming` 
map containing a frame
   ID that is never be removed (i.e. it thinks that frame contains a pending 
network request
   forever), so it never calls didGeneratePageLoadTiming.

To fix this, have the UIProcess `StartNetworkRequestsForPageLoadTiming` ignore 
any requests
corresponding to disconnected frames.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::isConnected const):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::startNetworkRequestsForPageLoadTiming):
(WebKit::WebPageProxy::endNetworkRequestsForPageLoadTiming):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, GeneratesPageLoadTimingAfterOnUnloadFetch)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to