Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b56d0c9b157522fba900fc8b8b009b4729fd42de
      
https://github.com/WebKit/WebKit/commit/b56d0c9b157522fba900fc8b8b009b4729fd42de
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-08-17 (Mon, 17 Aug 2026)

  Changed paths:
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.h
    M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.messages.in
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm

  Log Message:
  -----------
  [Text Extraction] Interaction `summary` strings should not bypass 
client-specified `replacementStrings`
https://bugs.webkit.org/show_bug.cgi?id=321881
rdar://185061955

Reviewed by Aditya Keerthi and Pascoe.

The `summary` returned after performing an interaction was built from the raw 
description, so page-
derived text bypassed the `replacementStrings` sanitization that 316548@main 
added for interaction
descriptions. Fix this by splitting the summary string off into the structured 
(non-hard-coded)
portion, and `stringsToValidate` (which are filtered through 
`replacementStrings`).

Test: TextExtractionTests.ReplacementStringsAppliedToInteractionDescription

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::redirectToLargeScrollableContainerIfNeeded):
(WebCore::TextExtraction::scrollBy):
(WebCore::TextExtraction::scrollToNextPage):
(WebCore::TextExtraction::dispatchInteraction):
(WebCore::TextExtraction::handleInteraction):
* Source/WebCore/page/text-extraction/TextExtraction.h:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::applyReplacements): Avoid copying each key/value pair while matching.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView+TextExtraction.mm:
(applyReplacementsToDescription): Factor out of `-_describeInteraction:...`.
(-[WKWebView 
_performInteraction:inFrame:actionType:nodeIdentifier:staleNodeNote:shouldResolveStaleNodeIdentifier:completionHandler:]):
(-[WKWebView 
_describeInteraction:inFrame:nodeIdentifier:staleNodeNote:shouldResolveStaleNodeIdentifier:completionHandler:]):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::handleTextExtractionInteraction):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::handleTextExtractionInteraction):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.messages.in:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, 
ReplacementStringsAppliedToInteractionDescription)):
(TestWebKitAPI::TEST(TextExtractionTests, 
ReplacementStringsAppliedToScrollFallbackSummary)):

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



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

Reply via email to