Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 40f6e72b78becf0d3b952be200c82e1522079c88
      
https://github.com/WebKit/WebKit/commit/40f6e72b78becf0d3b952be200c82e1522079c88
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-02-01 (Sun, 01 Feb 2026)

  Changed paths:
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm

  Log Message:
  -----------
  [AutoFill Debugging] Client-specified node attributes are missing for nodes 
in same-origin subframes
https://bugs.webkit.org/show_bug.cgi?id=306713
rdar://169303458

Reviewed by Richard Robinson.

Fix a bug that was causing client node attributes to not appear in text 
extractions, when the node
is inside a same-origin subframe.

Test: TextExtractionTests.SubframeInteractions

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItem):

Also avoid moving the custom attribute values here — this was causing us to add 
an empty string
value to `clientNodeAttributes`, if the same attribute/value pair appears in 
multiple nodes.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(jsHandleIdentifierInFrame):

This function tries to return either `nullopt` if the given JS handle is 
irrelevant to the root
frame that's being targeted for text extraction, and otherwise returns the 
handle's identifier.
However, in the case where the JS handle corresponds to a node inside a 
same-origin subframe, we
return `nullopt` because the frame IDs don't match, even though the JS handle 
can be resolved when
traversing the given frame.

To fix this, pass the `JSHandleIdentifier` through as long as the processes of 
both the handle's
frame and the target extraction frame match.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, SubframeInteractions)):

Adjust an existing API test to exercise this fix.

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



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

Reply via email to