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

Changeset 243240 in webkit


Ignore:
Timestamp:
Mar 20, 2019, 2:26:01 PM (7 years ago)
Author:
Chris Dumez
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:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243231 r243240  
     12019-03-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=196029
     5        <rdar://problem/48954651>
     6
     7        Reviewed by Tim Horton.
     8
     9        If there is a ViewGestureController when process swapping, make sure we disconnect it
     10        from the old process and reconnect it to the new one. This matches what is done in
     11        WebViewImpl for macOS (see r238356).
     12
     13        * UIProcess/API/Cocoa/WKWebView.mm:
     14        (-[WKWebView _processWillSwap]):
     15        (-[WKWebView _processDidExit]):
     16        (-[WKWebView _didRelaunchProcess]):
     17
    1182019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r243094 r243240  
    18411841    RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processWillSwap]", self);
    18421842    [self _processWillSwapOrDidExit];
     1843    if (_gestureController)
     1844        _gestureController->disconnectFromProcess();
    18431845}
    18441846
     
    18531855    [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];
    18541856    [_scrollView setZoomScale:1];
    1855    
     1857    _gestureController = nullptr;
    18561858}
    18571859
     
    18611863    _hasScheduledVisibleRectUpdate = NO;
    18621864    _visibleContentRectUpdateScheduledFromScrollViewInStableState = YES;
     1865    if (_gestureController)
     1866        _gestureController->connectToProcess();
    18631867}
    18641868
  • trunk/Tools/ChangeLog

    r243217 r243240  
     12019-03-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=196029
     5        <rdar://problem/48954651>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add API test coverage.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     12
    1132019-03-20  Aakash Jain  <aakash_jain@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r243094 r243240  
    49584958}
    49594959
    4960 #if PLATFORM(MAC)
    4961 
    49624960TEST(ProcessSwap, TerminateProcessAfterProcessSwap)
    49634961{
     
    49844982
    49854983    // Make sure there is a gesture controller.
     4984#if PLATFORM(MAC)
    49864985    [webView _setCustomSwipeViewsTopContentInset:2.];
     4986#endif
    49874987
    49884988    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     
    50125012    done = false;
    50135013}
     5014
     5015TEST(ProcessSwap, SwapWithGestureController)
     5016{
     5017    @autoreleasepool {
     5018        auto processPoolConfiguration = psonProcessPoolConfiguration();
     5019        auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     5020
     5021        auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     5022        [webViewConfiguration setProcessPool:processPool.get()];
     5023        auto handler = adoptNS([[PSONScheme alloc] init]);
     5024        [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     5025
     5026        auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     5027
     5028        auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     5029        [webView setNavigationDelegate:delegate.get()];
     5030
     5031        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
     5032        [webView loadRequest:request];
     5033
     5034        TestWebKitAPI::Util::run(&done);
     5035        done = false;
     5036
     5037        // Ensure a ViewGestureController is created.
     5038        [webView setAllowsBackForwardNavigationGestures:YES];
     5039#if PLATFORM(MAC)
     5040        [webView _setCustomSwipeViewsTopContentInset:2.];
     5041#endif
     5042
     5043        request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.google.com/main.html"]];
     5044        [webView loadRequest:request];
     5045
     5046        TestWebKitAPI::Util::run(&done);
     5047        done = false;
     5048    }
     5049}
     5050
     5051TEST(ProcessSwap, CrashWithGestureController)
     5052{
     5053    @autoreleasepool {
     5054        auto processPoolConfiguration = psonProcessPoolConfiguration();
     5055        auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     5056
     5057        auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     5058        [webViewConfiguration setProcessPool:processPool.get()];
     5059        auto handler = adoptNS([[PSONScheme alloc] init]);
     5060        [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     5061
     5062        auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     5063
     5064        auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
     5065        [webView setNavigationDelegate:navigationDelegate.get()];
     5066        __block bool webProcessTerminated = false;
     5067        [navigationDelegate setWebContentProcessDidTerminate:^(WKWebView *) {
     5068            webProcessTerminated = true;
     5069        }];
     5070        [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) {
     5071            done = true;
     5072        }];
     5073
     5074        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
     5075        [webView loadRequest:request];
     5076
     5077        TestWebKitAPI::Util::run(&done);
     5078        done = false;
     5079
     5080        // Ensure a ViewGestureController is created.
     5081        [webView setAllowsBackForwardNavigationGestures:YES];
     5082#if PLATFORM(MAC)
     5083        [webView _setCustomSwipeViewsTopContentInset:2.];
     5084#endif
     5085
     5086        webProcessTerminated = false;
     5087        kill([webView _webProcessIdentifier], 9);
     5088
     5089        TestWebKitAPI::Util::run(&webProcessTerminated);
     5090
     5091        TestWebKitAPI::Util::spinRunLoop(1);
     5092
     5093        [webView reload];
     5094        TestWebKitAPI::Util::run(&done);
     5095        done = false;
     5096    }
     5097}
     5098
     5099#if PLATFORM(MAC)
    50145100
    50155101TEST(ProcessSwap, NavigateCrossOriginWithOpenee)
Note: See TracChangeset for help on using the changeset viewer.