Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ce481c4cfedb670a0d26b50a5e0fe4b0051368e0
https://github.com/WebKit/WebKit/commit/ce481c4cfedb670a0d26b50a5e0fe4b0051368e0
Author: Cole Carley <[email protected]>
Date: 2026-06-29 (Mon, 29 Jun 2026)
Changed paths:
A
LayoutTests/editing/find/ios/find-interaction-ignorable-character-expected.txt
A LayoutTests/editing/find/ios/find-interaction-ignorable-character.html
M LayoutTests/resources/ui-helper.js
M Source/WebCore/editing/CachedMatchFinder.cpp
M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Log Message:
-----------
Fix Find in Page crash on iOS
https://bugs.webkit.org/show_bug.cgi?id=318169
rdar://170649898
Reviewed by David Kilzer.
A search string that folds to an all-ignorable collation key
produces a zero-length match at every offset.
In WebFoundTextRangeController::findTextRangesForStringMatches() a
zero-length match at the start of the main frame becomes a WebFoundTextRange
equal to the HashMap empty value. Inserting it into m_cachedFoundRanges trips
the HashMap key-validation RELEASE_ASSERT, crashing the Web Content process.
To fix this, we stop the search when the match length is zero. An all-ignorable
target matches nothing meaningful, so reporting no matches is correct.
Tests: editing/find/ios/find-interaction-ignorable-character.html
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm
*
LayoutTests/editing/find/ios/find-interaction-ignorable-character-expected.txt:
Added.
* LayoutTests/editing/find/ios/find-interaction-ignorable-character.html: Added.
* LayoutTests/resources/ui-helper.js:
(window.UIHelper.findStringMatchesUsingFindInteraction.return.new.Promise):
(window.UIHelper.findStringMatchesUsingFindInteraction):
* Source/WebCore/editing/CachedMatchFinder.cpp:
(WebCore::CachedMatchFinder::performSearch):
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::findStringMatchesUsingFindInteraction):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindInPage.mm:
(TEST(WebKit, FindInPageIgnorableCharacterDoesNotCrash)):
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(-[WTRTextSearchAggregator initWithCompletionHandler:]):
(-[WTRTextSearchAggregator allFoundRanges]):
(-[WTRTextSearchAggregator foundRange:forSearchString:inDocument:]):
(-[WTRTextSearchAggregator finishedSearching]):
(-[WTRTextSearchAggregator invalidateFoundRange:inDocument:]):
(-[WTRTextSearchAggregator invalidate]):
(WTR::UIScriptControllerIOS::findStringMatchesUsingFindInteraction):
Canonical link: https://commits.webkit.org/316114@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications