Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e5306640f9d1bb69e9a4d301db80f21edbbeb428
      
https://github.com/WebKit/WebKit/commit/e5306640f9d1bb69e9a4d301db80f21edbbeb428
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-06-22 (Mon, 22 Jun 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/editing/markup.cpp
    M Source/WebCore/editing/markup.h
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.h
    A Source/WebCore/page/text-extraction/TextExtractionScriptFiltering.cpp
    A Source/WebCore/page/text-extraction/TextExtractionScriptFiltering.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm

  Log Message:
  -----------
  Refactor rule-based text extraction filtering so that scripts have no access 
to the DOM or network requests
https://bugs.webkit.org/show_bug.cgi?id=317505
rdar://167553900

Reviewed by Abrar Rahman Protyasha and Tim Horton.

Introduce a separate utility page (à la pasteboard sanitization or SVG 
rendering) where we can run
text extraction filtering JavaScript rules; this allows us to ensure that these 
scripts will never
get access to either the DOM or the network (by setting `allowedNetworkHosts` 
to the empty set).

No change in behavior, other than the fact that any attempt to access the 
network or DOM will now
fail when running filtering scripts.

Test: TextExtractionTests.FilteringRulesAreIsolated

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::filteringWorld): Deleted.
(WebCore::TextExtraction::applyRules): Deleted.

Additionally remove the container node from filtering callbacks (which should 
be outside the scope
of text extraction filtering rules).

* Source/WebCore/page/text-extraction/TextExtraction.h:
* Source/WebCore/page/text-extraction/TextExtractionScriptFiltering.cpp: Added.
(WebCore::TextExtraction::createScriptFilteringPage):
(WebCore::TextExtraction::applyScriptFilteringRules):
* Source/WebCore/page/text-extraction/TextExtractionScriptFiltering.h: Added.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
(WebKit::WebPage::updateTextExtractionFilterRules):
(WebKit::WebPage::applyTextExtractionFilter):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::FilteringRulesAreIsolated)):

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



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

Reply via email to