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

Changeset 248461 in webkit


Ignore:
Timestamp:
Aug 8, 2019, 10:01:29 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r248039. rdar://problem/54087592

[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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248039 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-608.1-branch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1-branch/Source/WebKit/ChangeLog

    r248460 r248461  
     12019-08-08  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r248039. rdar://problem/54087592
     4
     5    [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     6    https://bugs.webkit.org/show_bug.cgi?id=200291
     7    <rdar://problem/53717946>
     8   
     9    Reviewed by Megan Gardner.
     10   
     11    Source/WebKit:
     12   
     13    Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
     14    and there is no Connection object to use when waiting for a sync IPC response.
     15   
     16    Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
     17   
     18    * UIProcess/ios/WKContentViewInteraction.mm:
     19    (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
     20   
     21    Tools:
     22   
     23    Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
     24    after closing the web view, while the web view's content view isn't the first responder.
     25   
     26    * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
     27    * TestWebKitAPI/ios/UIKitSPI.h:
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     33
     34            [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     35            https://bugs.webkit.org/show_bug.cgi?id=200291
     36            <rdar://problem/53717946>
     37
     38            Reviewed by Megan Gardner.
     39
     40            Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
     41            and there is no Connection object to use when waiting for a sync IPC response.
     42
     43            Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
     44
     45            * UIProcess/ios/WKContentViewInteraction.mm:
     46            (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
     47
    1482019-08-08  Kocsen Chung  <kocsen_chung@apple.com>
    249
  • branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r248460 r248461  
    38863886#endif
    38873887
     3888    if (!_page->hasRunningProcess()) {
     3889        completionHandler(WKAutocorrectionContext.emptyAutocorrectionContext);
     3890        return;
     3891    }
     3892
    38883893    // FIXME: Remove the synchronous call when <rdar://problem/16207002> is fixed.
    38893894    const bool useSyncRequest = true;
     
    39003905        _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
    39013906        [self _cancelPendingAutocorrectionContextHandler];
    3902         return;
    39033907    }
    39043908}
  • branches/safari-608.1-branch/Tools/ChangeLog

    r248458 r248461  
     12019-08-08  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r248039. rdar://problem/54087592
     4
     5    [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     6    https://bugs.webkit.org/show_bug.cgi?id=200291
     7    <rdar://problem/53717946>
     8   
     9    Reviewed by Megan Gardner.
     10   
     11    Source/WebKit:
     12   
     13    Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
     14    and there is no Connection object to use when waiting for a sync IPC response.
     15   
     16    Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
     17   
     18    * UIProcess/ios/WKContentViewInteraction.mm:
     19    (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
     20   
     21    Tools:
     22   
     23    Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
     24    after closing the web view, while the web view's content view isn't the first responder.
     25   
     26    * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
     27    * TestWebKitAPI/ios/UIKitSPI.h:
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     33
     34            [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
     35            https://bugs.webkit.org/show_bug.cgi?id=200291
     36            <rdar://problem/53717946>
     37
     38            Reviewed by Megan Gardner.
     39
     40            Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
     41            after closing the web view, while the web view's content view isn't the first responder.
     42
     43            * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
     44            * TestWebKitAPI/ios/UIKitSPI.h:
     45
    1462019-08-08  Kocsen Chung  <kocsen_chung@apple.com>
    247
  • branches/safari-608.1-branch/Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm

    r248429 r248461  
    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)
  • branches/safari-608.1-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h

    r248429 r248461  
    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.