Title: [274014] branches/safari-612.1.5-branch
Revision
274014
Author
repst...@apple.com
Date
2021-03-05 15:47:15 -0800 (Fri, 05 Mar 2021)

Log Message

Cherry-pick r273997. rdar://problem/75115235

    Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate
    https://bugs.webkit.org/show_bug.cgi?id=222809

    Reviewed by Michael Catanzaro.

    Source/WebKit:

    There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that
    was previously making sure we would not clear the WebView's URL before calling the
    processDidTerminate client delegate. Now that we call the client delegate in a
    separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move
    the PageLoadState::Transaction to the caller in
    WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers
    both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls.

    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::resetStateAfterProcessTermination):
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):

    Tools:

    Add API test coverage.

    * TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
    (TEST):

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

Modified Paths

Diff

Modified: branches/safari-612.1.5-branch/Source/WebKit/ChangeLog (274013 => 274014)


--- branches/safari-612.1.5-branch/Source/WebKit/ChangeLog	2021-03-05 23:47:11 UTC (rev 274013)
+++ branches/safari-612.1.5-branch/Source/WebKit/ChangeLog	2021-03-05 23:47:15 UTC (rev 274014)
@@ -1,3 +1,56 @@
+2021-03-05  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r273997. rdar://problem/75115235
+
+    Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate
+    https://bugs.webkit.org/show_bug.cgi?id=222809
+    
+    Reviewed by Michael Catanzaro.
+    
+    Source/WebKit:
+    
+    There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that
+    was previously making sure we would not clear the WebView's URL before calling the
+    processDidTerminate client delegate. Now that we call the client delegate in a
+    separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move
+    the PageLoadState::Transaction to the caller in
+    WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers
+    both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::resetStateAfterProcessTermination):
+    * UIProcess/WebProcessProxy.cpp:
+    (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
+    
+    Tools:
+    
+    Add API test coverage.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
+    (TEST):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-05  Chris Dumez  <cdu...@apple.com>
+
+            Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate
+            https://bugs.webkit.org/show_bug.cgi?id=222809
+
+            Reviewed by Michael Catanzaro.
+
+            There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that
+            was previously making sure we would not clear the WebView's URL before calling the
+            processDidTerminate client delegate. Now that we call the client delegate in a
+            separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move
+            the PageLoadState::Transaction to the caller in
+            WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers
+            both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::resetStateAfterProcessTermination):
+            * UIProcess/WebProcessProxy.cpp:
+            (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
+
 2021-03-05  Ruben Turcios  <rubent...@apple.com>
 
         Cherry-pick r273543. rdar://problem/75101709

Modified: branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (274013 => 274014)


--- branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-05 23:47:11 UTC (rev 274013)
+++ branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-05 23:47:15 UTC (rev 274014)
@@ -7339,9 +7339,6 @@
     }
 #endif
 
-    // There is a nested transaction in resetStateAfterProcessExited() that we don't want to commit before the client call.
-    PageLoadState::Transaction transaction = m_pageLoadState.transaction();
-
     resetStateAfterProcessExited(reason);
     stopAllURLSchemeTasks(m_process.ptr());
 #if ENABLE(UI_PROCESS_PDF_HUD)

Modified: branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (274013 => 274014)


--- branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-03-05 23:47:11 UTC (rev 274013)
+++ branches/safari-612.1.5-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-03-05 23:47:15 UTC (rev 274014)
@@ -888,8 +888,12 @@
     m_routingArbitrator->processDidTerminate();
 #endif
 
-    for (auto& page : pages)
+    // There is a nested transaction in WebPageProxy::resetStateAfterProcessExited() that we don't want to commit before the client call below (dispatchProcessDidTerminate).
+    Vector<PageLoadState::Transaction> pageLoadStateTransactions;
+    for (auto& page : pages) {
+        pageLoadStateTransactions.append(page->pageLoadState().transaction());
         page->resetStateAfterProcessTermination(ProcessTerminationReason::Crash);
+    }
 
     for (auto& provisionalPage : provisionalPages) {
         if (provisionalPage)

Modified: branches/safari-612.1.5-branch/Tools/ChangeLog (274013 => 274014)


--- branches/safari-612.1.5-branch/Tools/ChangeLog	2021-03-05 23:47:11 UTC (rev 274013)
+++ branches/safari-612.1.5-branch/Tools/ChangeLog	2021-03-05 23:47:15 UTC (rev 274014)
@@ -1,3 +1,48 @@
+2021-03-05  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r273997. rdar://problem/75115235
+
+    Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate
+    https://bugs.webkit.org/show_bug.cgi?id=222809
+    
+    Reviewed by Michael Catanzaro.
+    
+    Source/WebKit:
+    
+    There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that
+    was previously making sure we would not clear the WebView's URL before calling the
+    processDidTerminate client delegate. Now that we call the client delegate in a
+    separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move
+    the PageLoadState::Transaction to the caller in
+    WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers
+    both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::resetStateAfterProcessTermination):
+    * UIProcess/WebProcessProxy.cpp:
+    (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
+    
+    Tools:
+    
+    Add API test coverage.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
+    (TEST):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-05  Chris Dumez  <cdu...@apple.com>
+
+            Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate
+            https://bugs.webkit.org/show_bug.cgi?id=222809
+
+            Reviewed by Michael Catanzaro.
+
+            Add API test coverage.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
+            (TEST):
+
 2021-03-04  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r273784. rdar://problem/75059445

Modified: branches/safari-612.1.5-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm (274013 => 274014)


--- branches/safari-612.1.5-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm	2021-03-05 23:47:11 UTC (rev 274013)
+++ branches/safari-612.1.5-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm	2021-03-05 23:47:15 UTC (rev 274014)
@@ -27,6 +27,8 @@
 
 #import "PlatformUtilities.h"
 #import "Test.h"
+#import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
 #import <WebKit/WKNavigationDelegatePrivate.h>
 #import <WebKit/WKNavigationPrivate.h>
 #import <WebKit/WKProcessPoolPrivate.h>
@@ -352,3 +354,25 @@
     for (auto& webView : webViews)
         EXPECT_EQ(pidAfter, [webView _webProcessIdentifier]);
 }
+
+TEST(WKNavigation, WebViewURLInProcessDidTerminate)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    NSString *viewURL = [webView URL].absoluteString;
+    EXPECT_TRUE(!!viewURL);
+
+    auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:navigationDelegate.get()];
+
+    __block bool done = false;
+    navigationDelegate.get().webContentProcessDidTerminate = ^(WKWebView *view) {
+        EXPECT_EQ(view, webView.get());
+        EXPECT_WK_STREQ(view.URL.absoluteString, viewURL);
+        done = true;
+    };
+    kill([webView _webProcessIdentifier], 9);
+    TestWebKitAPI::Util::run(&done);
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to