Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 62fb864bff87d513cf2570d7f32fb453311d2457
      
https://github.com/WebKit/WebKit/commit/62fb864bff87d513cf2570d7f32fb453311d2457
  Author: Sihui Liu <[email protected]>
  Date:   2026-05-20 (Wed, 20 May 2026)

  Changed paths:
    M Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Ensure FrameInfoData.documentID is populated when posting 
script messages from Document
https://bugs.webkit.org/show_bug.cgi?id=315162
rdar://171866703

Reviewed by Ryosuke Niwa.

With Site Isolation enabled, when a cross-origin iframe undergoes a process 
swap (e.g., navigating to a different
origin), the frame transitions from local to remote state. During this 
transition, WebFrame::coreLocalFrame() can return
nullptr, causing webFrame->info() to produce a FrameInfoData with a nil 
documentID. That means, if client posts message
in pagehide event fired on a frame, it may get a null documentIdentifier. This 
has caused crash in existing clients --
since the message must come from an active Document, they expect the 
documentIdentifier will never be null and they can
access it safely.

To fix this, now we fall back to obtain the document identifier directly from 
JSGlobalObject's ScriptExecutionContext
when webFrame->info() fails to populate it.

Test: SiteIsolation.ScriptMessageHandlerDocumentIdentifierOnPageHide

* Source/WebKit/WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserMessageHandlerDescriptorProxy::frameInfoWithDocumentID):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, 
ScriptMessageHandlerDocumentIdentifierOnPageHide)):

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



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

Reply via email to