Title: [243240] trunk
Revision
243240
Author
[email protected]
Date
2019-03-20 14:26:01 -0700 (Wed, 20 Mar 2019)

Log Message

Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
https://bugs.webkit.org/show_bug.cgi?id=196029
<rdar://problem/48954651>

Reviewed by Tim Horton.

Source/WebKit:

If there is a ViewGestureController when process swapping, make sure we disconnect it
from the old process and reconnect it to the new one. This matches what is done in
WebViewImpl for macOS (see r238356).

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processWillSwap]):
(-[WKWebView _processDidExit]):
(-[WKWebView _didRelaunchProcess]):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243239 => 243240)


--- trunk/Source/WebKit/ChangeLog	2019-03-20 21:23:02 UTC (rev 243239)
+++ trunk/Source/WebKit/ChangeLog	2019-03-20 21:26:01 UTC (rev 243240)
@@ -1,3 +1,20 @@
+2019-03-20  Chris Dumez  <[email protected]>
+
+        Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=196029
+        <rdar://problem/48954651>
+
+        Reviewed by Tim Horton.
+
+        If there is a ViewGestureController when process swapping, make sure we disconnect it
+        from the old process and reconnect it to the new one. This matches what is done in
+        WebViewImpl for macOS (see r238356).
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _processWillSwap]):
+        (-[WKWebView _processDidExit]):
+        (-[WKWebView _didRelaunchProcess]):
+
 2019-03-20  Carlos Garcia Campos  <[email protected]>
 
         [GTK] REGRESSION(r243094): crash when launching minibrowser

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (243239 => 243240)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-03-20 21:23:02 UTC (rev 243239)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-03-20 21:26:01 UTC (rev 243240)
@@ -1840,6 +1840,8 @@
 {
     RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processWillSwap]", self);
     [self _processWillSwapOrDidExit];
+    if (_gestureController)
+        _gestureController->disconnectFromProcess();
 }
 
 - (void)_processDidExit
@@ -1852,7 +1854,7 @@
     [_scrollView setBackgroundColor:[UIColor whiteColor]];
     [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];
     [_scrollView setZoomScale:1];
-    
+    _gestureController = nullptr;
 }
 
 - (void)_didRelaunchProcess
@@ -1860,6 +1862,8 @@
     RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _didRelaunchProcess]", self);
     _hasScheduledVisibleRectUpdate = NO;
     _visibleContentRectUpdateScheduledFromScrollViewInStableState = YES;
+    if (_gestureController)
+        _gestureController->connectToProcess();
 }
 
 - (void)_didCommitLoadForMainFrame

Modified: trunk/Tools/ChangeLog (243239 => 243240)


--- trunk/Tools/ChangeLog	2019-03-20 21:23:02 UTC (rev 243239)
+++ trunk/Tools/ChangeLog	2019-03-20 21:26:01 UTC (rev 243240)
@@ -1,3 +1,15 @@
+2019-03-20  Chris Dumez  <[email protected]>
+
+        Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=196029
+        <rdar://problem/48954651>
+
+        Reviewed by Tim Horton.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2019-03-20  Aakash Jain  <[email protected]>
 
         [ews-build] Improve failure summary string for ApplyPatch step

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (243239 => 243240)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-03-20 21:23:02 UTC (rev 243239)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-03-20 21:26:01 UTC (rev 243240)
@@ -4957,8 +4957,6 @@
     EXPECT_NE(applePID, webkitPID);
 }
 
-#if PLATFORM(MAC)
-
 TEST(ProcessSwap, TerminateProcessAfterProcessSwap)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
@@ -4983,7 +4981,9 @@
     }];
 
     // Make sure there is a gesture controller.
+#if PLATFORM(MAC)
     [webView _setCustomSwipeViewsTopContentInset:2.];
+#endif
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     [webView loadRequest:request];
@@ -5012,6 +5012,92 @@
     done = false;
 }
 
+TEST(ProcessSwap, SwapWithGestureController)
+{
+    @autoreleasepool {
+        auto processPoolConfiguration = psonProcessPoolConfiguration();
+        auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+        auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+        [webViewConfiguration setProcessPool:processPool.get()];
+        auto handler = adoptNS([[PSONScheme alloc] init]);
+        [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
+
+        auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+
+        auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+        [webView setNavigationDelegate:delegate.get()];
+
+        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
+        [webView loadRequest:request];
+
+        TestWebKitAPI::Util::run(&done);
+        done = false;
+
+        // Ensure a ViewGestureController is created.
+        [webView setAllowsBackForwardNavigationGestures:YES];
+#if PLATFORM(MAC)
+        [webView _setCustomSwipeViewsTopContentInset:2.];
+#endif
+
+        request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.google.com/main.html"]];
+        [webView loadRequest:request];
+
+        TestWebKitAPI::Util::run(&done);
+        done = false;
+    }
+}
+
+TEST(ProcessSwap, CrashWithGestureController)
+{
+    @autoreleasepool {
+        auto processPoolConfiguration = psonProcessPoolConfiguration();
+        auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+        auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+        [webViewConfiguration setProcessPool:processPool.get()];
+        auto handler = adoptNS([[PSONScheme alloc] init]);
+        [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
+
+        auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+
+        auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
+        [webView setNavigationDelegate:navigationDelegate.get()];
+        __block bool webProcessTerminated = false;
+        [navigationDelegate setWebContentProcessDidTerminate:^(WKWebView *) {
+            webProcessTerminated = true;
+        }];
+        [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) {
+            done = true;
+        }];
+
+        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
+        [webView loadRequest:request];
+
+        TestWebKitAPI::Util::run(&done);
+        done = false;
+
+        // Ensure a ViewGestureController is created.
+        [webView setAllowsBackForwardNavigationGestures:YES];
+#if PLATFORM(MAC)
+        [webView _setCustomSwipeViewsTopContentInset:2.];
+#endif
+
+        webProcessTerminated = false;
+        kill([webView _webProcessIdentifier], 9);
+
+        TestWebKitAPI::Util::run(&webProcessTerminated);
+
+        TestWebKitAPI::Util::spinRunLoop(1);
+
+        [webView reload];
+        TestWebKitAPI::Util::run(&done);
+        done = false;
+    }
+}
+
+#if PLATFORM(MAC)
+
 TEST(ProcessSwap, NavigateCrossOriginWithOpenee)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to