⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 248039 in webkit


Ignore:
Timestamp:
Jul 31, 2019, 7:41:16 AM (7 years ago)
Author:
Wenson Hsieh
Message:

[iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
https://bugs.webkit.org/show_bug.cgi?id=200291
<rdar://problem/53717946>

Reviewed by Megan Gardner.

Source/WebKit:

Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
and there is no Connection object to use when waiting for a sync IPC response.

Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):

Tools:

Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
after closing the web view, while the web view's content view isn't the first responder.

  • TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
  • TestWebKitAPI/ios/UIKitSPI.h:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248038 r248039  
     12019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     4        https://bugs.webkit.org/show_bug.cgi?id=200291
     5        <rdar://problem/53717946>
     6
     7        Reviewed by Megan Gardner.
     8
     9        Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
     10        and there is no Connection object to use when waiting for a sync IPC response.
     11
     12        Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
     13
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
     16
    1172019-07-31  Chris Fleizach  <cfleizach@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r247936 r248039  
    38913891#endif
    38923892
     3893    if (!_page->hasRunningProcess()) {
     3894        completionHandler(WKAutocorrectionContext.emptyAutocorrectionContext);
     3895        return;
     3896    }
     3897
    38933898    // FIXME: Remove the synchronous call when <rdar://problem/16207002> is fixed.
    38943899    const bool useSyncRequest = true;
     
    39053910        _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
    39063911        [self _cancelPendingAutocorrectionContextHandler];
    3907         return;
    39083912    }
    39093913}
  • trunk/Tools/ChangeLog

    r248033 r248039  
     12019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     4        https://bugs.webkit.org/show_bug.cgi?id=200291
     5        <rdar://problem/53717946>
     6
     7        Reviewed by Megan Gardner.
     8
     9        Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
     10        after closing the web view, while the web view's content view isn't the first responder.
     11
     12        * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
     13        * TestWebKitAPI/ios/UIKitSPI.h:
     14
    1152019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm

    r245998 r248039  
    9595}
    9696
     97TEST(AutocorrectionTests, RequestAutocorrectionContextAfterClosingPage)
     98{
     99    auto webView = adoptNS([[TestWKWebView alloc] init]);
     100    [webView synchronouslyLoadTestPageNamed:@"autofocused-text-input"];
     101
     102    auto contentView = [webView textInputContentView];
     103    [contentView resignFirstResponder];
     104    [webView _close];
     105
     106    bool done = false;
     107    [contentView requestAutocorrectionContextWithCompletionHandler:[&] (UIWKAutocorrectionContext *) {
     108        done = true;
     109    }];
     110    TestWebKitAPI::Util::run(&done);
     111}
     112
    97113#endif // PLATFORM(IOS_FAMILY)
  • trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h

    r247702 r248039  
    157157@end
    158158
     159@interface UIWKAutocorrectionContext : NSObject
     160@end
     161
    159162@protocol UIWKInteractionViewProtocol
    160163- (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
     164- (void)requestAutocorrectionContextWithCompletionHandler:(void (^)(UIWKAutocorrectionContext *autocorrectionContext))completionHandler;
    161165@end
    162166
Note: See TracChangeset for help on using the changeset viewer.