[webkit-changes] [WebKit/WebKit] 3dc084: _getTextFragmentMatchWithCompletionHandler returns...

Tim Horton noreply at github.com
Wed Sep 11 00:15:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3dc0842188b37a5261d7732440526e83b38962f7
      https://github.com/WebKit/WebKit/commit/3dc0842188b37a5261d7732440526e83b38962f7
  Author: Tim Horton <thorton at apple.com>
  Date:   2024-09-11 (Wed, 11 Sep 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextFragments.mm

  Log Message:
  -----------
  _getTextFragmentMatchWithCompletionHandler returns an empty string instead of nil when there is no text fragment match
https://bugs.webkit.org/show_bug.cgi?id=279488
rdar://135775793

Reviewed by Richard Robinson.

The intent of _getTextFragmentMatchWithCompletionHandler is that it returns nil
if there is no text fragment match, but String -> NSString conversion coalesces
the null String to an empty NSString instead of nil. Fix this.

Sadly, while I added a test for this, EXPECT_WK_STREQ *also* does coalescing that
made the test falsely pass. Add an extra test condition for actually-nil.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _getTextFragmentMatchWithCompletionHandler:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextFragments.mm:
(TEST(WebKit, GetTextFragmentMatch)):

Canonical link: https://commits.webkit.org/283471@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