Changeset 248548 in webkit


Ignore:
Timestamp:
Aug 12, 2019 2:40:56 PM (5 years ago)
Author:
Megan Gardner
Message:

Fix Crash in Mail Search
https://bugs.webkit.org/show_bug.cgi?id=200589
Source/WebKit:

<rdar://problem/53666720>

Reviewed by Tim Horton.

If we search in Mail backwards first, for AppKit reasons
we get a -1 for the index of the found item.
Do not try and insert data in this case.

  • UIProcess/mac/WKTextFinderClient.mm:

Tools:

Reviewed by Tim Horton.

If you search backwards first in mail, we would crash,
this tests that codepath.

  • TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:

(TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248547 r248548  
     12019-08-12  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Fix Crash in Mail Search
     4        https://bugs.webkit.org/show_bug.cgi?id=200589
     5        <rdar://problem/53666720>
     6
     7        Reviewed by Tim Horton.
     8
     9        If we search in Mail backwards first, for AppKit reasons
     10        we get a -1 for the index of the found item.
     11        Do not try and insert data in this case.
     12
     13        * UIProcess/mac/WKTextFinderClient.mm:
     14
    1152019-08-12  Adrian Perez de Castro  <aperez@igalia.com>
    216
  • trunk/Source/WebKit/UIProcess/mac/WKTextFinderClient.mm

    r247490 r248548  
    8282            // that they at least exist.
    8383            allMatches.resize(matchCount);
    84             allMatches[matchIndex].appendVector(matchRects);
     84            // FIXME: Clean this up and figure out why we are getting a -1 index
     85            if (matchIndex >= 0 && static_cast<uint32_t>(matchIndex) < matchCount)
     86                allMatches[matchIndex].appendVector(matchRects);
    8587        }
    8688
  • trunk/Tools/ChangeLog

    r248541 r248548  
     12019-08-12  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Fix Crash in Mail Search
     4        https://bugs.webkit.org/show_bug.cgi?id=200589
     5
     6        Reviewed by Tim Horton.
     7
     8        If you search backwards first in mail, we would crash,
     9        this tests that codepath.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:
     12        (TEST):
     13
    1142019-08-12  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm

    r247490 r248548  
    225225}
    226226
     227TEST(WebKit, FindInPageBackwardsFirst)
     228{
     229    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]);
     230    [webView _setOverrideDeviceScaleFactor:2];
     231
     232    [webView loadHTMLString:@"word word" baseURL:nil];
     233    [webView _test_waitForDidFinishNavigation];
     234
     235    // Find one match, doing an incremental search.
     236    auto result = findMatches(webView.get(), @"word", wrapBackwardsFindOptions, 1);
     237    EXPECT_EQ((NSUInteger)1, [result.matches count]);
     238
     239    result = findMatches(webView.get(), @"word", wrapBackwardsFindOptions, 1);
     240    EXPECT_EQ((NSUInteger)1, [result.matches count]);
     241}
     242
    227243TEST(WebKit, FindInPageWrappingSubframe)
    228244{
Note: See TracChangeset for help on using the changeset viewer.