[webkit-changes] [WebKit/WebKit] b33075: Occasional crash in `WebViewImpl::setMarkedText` (...

Richard Robinson noreply at github.com
Tue May 14 20:52:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b33075ac6c0e3bc0177339797b1ae644ec8faf2f
      https://github.com/WebKit/WebKit/commit/b33075ac6c0e3bc0177339797b1ae644ec8faf2f
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-05-14 (Tue, 14 May 2024)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm

  Log Message:
  -----------
  Occasional crash in `WebViewImpl::setMarkedText` (`com.apple.WebKit: _ZN6WebKit11WebViewImpl13setMarkedTextEP11objc_object8_NSRangeS3_`)
https://bugs.webkit.org/show_bug.cgi?id=274186
rdar://127658062

Reviewed by Abrar Rahman Protyasha.

The existing logic to ensure that `setWritingSuggestions` only gets called when `string` is an
`NSAttributedString` was flawed in some cases (when `m_isHandlingAcceptedCandidate == true` and `hasTextCompletion == false`).
This resulted in `-[NSAttributedString string]` being called on an `NSString`, causing a crash.

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::setMarkedText):
* Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm:
(-[SetMarkedTextWithNoAttributedStringTestCandidate initWithReplacementString:inRange:]):
(-[SetMarkedTextWithNoAttributedStringTestCandidate replacementString]):
(-[SetMarkedTextWithNoAttributedStringTestCandidate resultType]):
(-[SetMarkedTextWithNoAttributedStringTestCandidate range]):
(TEST(WKWebViewMacEditingTests, SetMarkedTextWithNoAttributedString)):

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



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


More information about the webkit-changes mailing list