Title: [248089] branches/safari-608-branch
Revision
248089
Author
[email protected]
Date
2019-07-31 18:22:57 -0700 (Wed, 31 Jul 2019)

Log Message

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

    [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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (248088 => 248089)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-01 01:17:09 UTC (rev 248088)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-01 01:22:57 UTC (rev 248089)
@@ -1,5 +1,52 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r248039. rdar://problem/53788996
+
+    [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
+
+    2019-07-31  Wenson Hsieh  <[email protected]>
+
+            [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.
+
+            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:]):
+
+2019-07-31  Alan Coon  <[email protected]>
+
         Cherry-pick r247700. rdar://problem/53456055
 
     WebKit SPI fix for [ClickyOrb] Audio continues playing after dismissing a video preview in Safari

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (248088 => 248089)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-08-01 01:17:09 UTC (rev 248088)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-08-01 01:22:57 UTC (rev 248089)
@@ -3900,6 +3900,11 @@
     }
 #endif
 
+    if (!_page->hasRunningProcess()) {
+        completionHandler(WKAutocorrectionContext.emptyAutocorrectionContext);
+        return;
+    }
+
     // FIXME: Remove the synchronous call when <rdar://problem/16207002> is fixed.
     const bool useSyncRequest = true;
 
@@ -3911,7 +3916,6 @@
     if (useSyncRequest) {
         _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
         [self _cancelPendingAutocorrectionContextHandler];
-        return;
     }
 }
 

Modified: branches/safari-608-branch/Tools/ChangeLog (248088 => 248089)


--- branches/safari-608-branch/Tools/ChangeLog	2019-08-01 01:17:09 UTC (rev 248088)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-08-01 01:22:57 UTC (rev 248089)
@@ -1,3 +1,48 @@
+2019-07-31  Alan Coon  <[email protected]>
+
+        Cherry-pick r248039. rdar://problem/53788996
+
+    [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
+
+    2019-07-31  Wenson Hsieh  <[email protected]>
+
+            [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.
+
+            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:
+
 2019-07-29  Alan Coon  <[email protected]>
 
         Cherry-pick r247673. rdar://problem/53449723

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm (248088 => 248089)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm	2019-08-01 01:17:09 UTC (rev 248088)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm	2019-08-01 01:22:57 UTC (rev 248089)
@@ -94,4 +94,20 @@
     EXPECT_EQ(32, fontAfterScaling.pointSize);
 }
 
+TEST(AutocorrectionTests, RequestAutocorrectionContextAfterClosingPage)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] init]);
+    [webView synchronouslyLoadTestPageNamed:@"autofocused-text-input"];
+
+    auto contentView = [webView textInputContentView];
+    [contentView resignFirstResponder];
+    [webView _close];
+
+    bool done = false;
+    [contentView requestAutocorrectionContextWithCompletionHandler:[&] (UIWKAutocorrectionContext *) {
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+}
+
 #endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h (248088 => 248089)


--- branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h	2019-08-01 01:17:09 UTC (rev 248088)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/ios/UIKitSPI.h	2019-08-01 01:22:57 UTC (rev 248089)
@@ -156,8 +156,12 @@
 @property (nonatomic) CGRect lastRect;
 @end
 
+@interface UIWKAutocorrectionContext : NSObject
+@end
+
 @protocol UIWKInteractionViewProtocol
 - (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
+- (void)requestAutocorrectionContextWithCompletionHandler:(void (^)(UIWKAutocorrectionContext *autocorrectionContext))completionHandler;
 @end
 
 IGNORE_WARNINGS_BEGIN("deprecated-implementations")
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to