REGRESSION (r243240): Unable to swipe back in Safari
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 22:04:10 +0000 (22:04 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 22:04:10 +0000 (22:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199394
<rdar://problem/51137447>

Reviewed by Wenson Hsieh.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processDidExit]):
r243240 started nilling out the ViewGestureController, but we don't actually
expect that; the only time WKWebView's ViewGestureController goes away
is if the client turns off the gestures... and so nothing ever puts it back.
Instead, just always disconnect, don't nil it out.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
Make sure that we actually end up with swipe gesture recognizers installed
after process swap and crash.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

index f2bf93a..8deca8e 100644 (file)
@@ -1,3 +1,18 @@
+2019-07-02  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r243240): Unable to swipe back in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=199394
+        <rdar://problem/51137447>
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _processDidExit]):
+        r243240 started nilling out the ViewGestureController, but we don't actually
+        expect that; the only time WKWebView's ViewGestureController goes away
+        is if the client turns off the gestures... and so nothing ever puts it back.
+        Instead, just always disconnect, don't nil it out.
+
 2019-07-02  Chris Dumez  <cdumez@apple.com>
 
         Protect NetworkProcess::m_networkSessions against corruption
index 921fb01..9c247d6 100644 (file)
@@ -1848,6 +1848,9 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
     [self _hidePasswordView];
     [self _cancelAnimatedResize];
 
+    if (_gestureController)
+        _gestureController->disconnectFromProcess();
+
     _viewportMetaTagWidth = WebCore::ViewportArguments::ValueAuto;
     _initialScaleFactor = 1;
     _hasCommittedLoadForMainFrame = NO;
@@ -1883,8 +1886,6 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
 {
     RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processWillSwap]", self);
     [self _processWillSwapOrDidExit];
-    if (_gestureController)
-        _gestureController->disconnectFromProcess();
 }
 
 - (void)_processDidExit
@@ -1897,7 +1898,6 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
     [_scrollView setBackgroundColor:[_contentView backgroundColor]];
     [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];
     [_scrollView setZoomScale:1];
-    _gestureController = nullptr;
 }
 
 - (void)_didRelaunchProcess
index d7fe391..2b7058f 100644 (file)
@@ -1,3 +1,15 @@
+2019-07-02  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r243240): Unable to swipe back in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=199394
+        <rdar://problem/51137447>
+
+        Reviewed by Wenson Hsieh.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+        Make sure that we actually end up with swipe gesture recognizers installed
+        after process swap and crash.
+
 2019-07-02  Andres Gonzalez  <andresg_22@apple.com>
 
         Enhance support of aria-haspopup per ARIA 1.1 specification.
index b532a6d..7872eb6 100644 (file)
@@ -5350,6 +5350,19 @@ TEST(ProcessSwap, TerminateProcessAfterProcessSwap)
     done = false;
 }
 
+#if PLATFORM(IOS_FAMILY)
+static bool viewHasSwipeGestures(UIView *view)
+{
+    unsigned swipeGestureCount = 0;
+    for (UIGestureRecognizer *recognizer in view.gestureRecognizers) {
+        if ([recognizer isKindOfClass:NSClassFromString(@"UIScreenEdgePanGestureRecognizer")])
+            swipeGestureCount++;
+    }
+
+    return swipeGestureCount == 2;
+}
+#endif
+
 TEST(ProcessSwap, SwapWithGestureController)
 {
     @autoreleasepool {
@@ -5383,6 +5396,10 @@ TEST(ProcessSwap, SwapWithGestureController)
 
         TestWebKitAPI::Util::run(&done);
         done = false;
+
+#if PLATFORM(IOS_FAMILY)
+        EXPECT_TRUE(viewHasSwipeGestures(webView.get()));
+#endif
     }
 }
 
@@ -5431,6 +5448,10 @@ TEST(ProcessSwap, CrashWithGestureController)
         [webView reload];
         TestWebKitAPI::Util::run(&done);
         done = false;
+
+#if PLATFORM(IOS_FAMILY)
+        EXPECT_TRUE(viewHasSwipeGestures(webView.get()));
+#endif
     }
 }