Diff
Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (241060 => 241061)
--- branches/safari-607-branch/Source/WebKit/ChangeLog 2019-02-06 22:16:28 UTC (rev 241060)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog 2019-02-06 22:16:32 UTC (rev 241061)
@@ -1,5 +1,50 @@
2019-02-05 Alan Coon <[email protected]>
+ Cherry-pick r240675. rdar://problem/47776350
+
+ Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest]
+ https://bugs.webkit.org/show_bug.cgi?id=193967
+ <rdar://problem/47635348>
+
+ Reviewed by Alex Christensen.
+
+ Source/WebKit:
+
+ Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to
+ the old process when the load is continuing in a new process due to PSON.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
+ (WebKit::WebPageProxy::receivedPolicyDecision):
+ * UIProcess/WebPageProxy.h:
+
+ Tools:
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+ (-[PSONLoadingObserver observeValueForKeyPath:ofObject:change:context:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-01-29 Chris Dumez <[email protected]>
+
+ Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest]
+ https://bugs.webkit.org/show_bug.cgi?id=193967
+ <rdar://problem/47635348>
+
+ Reviewed by Alex Christensen.
+
+ Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to
+ the old process when the load is continuing in a new process due to PSON.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
+ (WebKit::WebPageProxy::receivedPolicyDecision):
+ * UIProcess/WebPageProxy.h:
+
+2019-02-05 Alan Coon <[email protected]>
+
Cherry-pick r240663. rdar://problem/47774492
REGRESSION (PSON): Flash on link navigation on Mac
Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (241060 => 241061)
--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-06 22:16:28 UTC (rev 241060)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-06 22:16:32 UTC (rev 241061)
@@ -2716,7 +2716,7 @@
RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "decidePolicyForNavigationAction: keep using process %i for navigation, reason: %{public}s", processIdentifier(), reason.utf8().data());
bool shouldProcessSwap = processForNavigation.ptr() != &process();
- receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? WTF::nullopt : WTFMove(data), WTFMove(sender));
+ receivedPolicyDecision(policyAction, navigation.ptr(), shouldProcessSwap ? WTF::nullopt : WTFMove(data), WTFMove(sender), shouldProcessSwap ? WillContinueLoadInNewProcess::Yes : WillContinueLoadInNewProcess::No);
if (!shouldProcessSwap)
return;
@@ -2729,7 +2729,7 @@
});
}
-void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, Optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender)
+void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, Optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender, WillContinueLoadInNewProcess willContinueLoadInNewProcess)
{
if (!isValid()) {
sender->send(PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt);
@@ -2738,7 +2738,7 @@
auto transaction = m_pageLoadState.transaction();
- if (action == PolicyAction::Ignore)
+ if (action == PolicyAction::Ignore && willContinueLoadInNewProcess == WillContinueLoadInNewProcess::No)
m_pageLoadState.clearPendingAPIRequestURL(transaction);
DownloadID downloadID = { };
Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h (241060 => 241061)
--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-06 22:16:28 UTC (rev 241060)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-06 22:16:32 UTC (rev 241061)
@@ -969,7 +969,8 @@
#endif
class PolicyDecisionSender;
- void receivedPolicyDecision(WebCore::PolicyAction, API::Navigation*, Optional<WebsitePoliciesData>&&, Ref<PolicyDecisionSender>&&);
+ enum class WillContinueLoadInNewProcess : bool { No, Yes };
+ void receivedPolicyDecision(WebCore::PolicyAction, API::Navigation*, Optional<WebsitePoliciesData>&&, Ref<PolicyDecisionSender>&&, WillContinueLoadInNewProcess = WillContinueLoadInNewProcess::No);
void receivedNavigationPolicyDecision(WebCore::PolicyAction, API::Navigation*, ProcessSwapRequestedByClient, WebFrameProxy&, API::WebsitePolicies*, Ref<PolicyDecisionSender>&&);
void backForwardRemovedItem(const WebCore::BackForwardItemIdentifier&);
Modified: branches/safari-607-branch/Tools/ChangeLog (241060 => 241061)
--- branches/safari-607-branch/Tools/ChangeLog 2019-02-06 22:16:28 UTC (rev 241060)
+++ branches/safari-607-branch/Tools/ChangeLog 2019-02-06 22:16:32 UTC (rev 241061)
@@ -1,5 +1,47 @@
2019-02-05 Alan Coon <[email protected]>
+ Cherry-pick r240675. rdar://problem/47776350
+
+ Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest]
+ https://bugs.webkit.org/show_bug.cgi?id=193967
+ <rdar://problem/47635348>
+
+ Reviewed by Alex Christensen.
+
+ Source/WebKit:
+
+ Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to
+ the old process when the load is continuing in a new process due to PSON.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
+ (WebKit::WebPageProxy::receivedPolicyDecision):
+ * UIProcess/WebPageProxy.h:
+
+ Tools:
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+ (-[PSONLoadingObserver observeValueForKeyPath:ofObject:change:context:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-01-29 Chris Dumez <[email protected]>
+
+ Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest]
+ https://bugs.webkit.org/show_bug.cgi?id=193967
+ <rdar://problem/47635348>
+
+ Reviewed by Alex Christensen.
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+ (-[PSONLoadingObserver observeValueForKeyPath:ofObject:change:context:]):
+
+2019-02-05 Alan Coon <[email protected]>
+
Cherry-pick r240660. rdar://problem/47774552
REGRESSION (PSON): Twitter link gets stuck at t.co after navigating back in tab
Modified: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (241060 => 241061)
--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-02-06 22:16:28 UTC (rev 241060)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-02-06 22:16:32 UTC (rev 241061)
@@ -3464,6 +3464,98 @@
TestWebKitAPI::Util::sleep(0.5);
}
+static Vector<bool> loadingStateChanges;
+static unsigned urlChangeCount;
+
+@interface PSONLoadingObserver : NSObject
+@end
+
+@implementation PSONLoadingObserver
+
+-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ WKWebView *webView = (WKWebView *)context;
+
+ if ([keyPath isEqualToString:@"loading"])
+ loadingStateChanges.append([webView isLoading]);
+ else if ([keyPath isEqualToString:@"URL"])
+ ++urlChangeCount;
+
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+}
+
+@end
+
+TEST(ProcessSwap, LoadingStateAfterPolicyDecision)
+{
+ auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+ processPoolConfiguration.get().processSwapsOnNavigation = YES;
+ 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([[PSONNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:navigationDelegate.get()];
+
+ [webView configuration].preferences.safeBrowsingEnabled = NO;
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+
+ auto loadObserver = adoptNS([[PSONLoadingObserver alloc] init]);
+ [webView addObserver:loadObserver.get() forKeyPath:@"loading" options:0 context:webView.get()];
+ [webView addObserver:loadObserver.get() forKeyPath:@"URL" options:0 context:webView.get()];
+
+ urlChangeCount = 0;
+ didStartProvisionalLoad = false;
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]]];
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+ EXPECT_TRUE([webView isLoading]);
+
+ EXPECT_EQ(1U, loadingStateChanges.size());
+ EXPECT_TRUE(loadingStateChanges[0]);
+ EXPECT_EQ(1U, urlChangeCount);
+
+ navigationDelegate->decidePolicyForNavigationAction = ^(WKNavigationAction *, void (^decisionHandler)(WKNavigationActionPolicy)) {
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+ EXPECT_TRUE([webView isLoading]);
+
+ decisionHandler(WKNavigationActionPolicyAllow);
+
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+ EXPECT_TRUE([webView isLoading]);
+ };
+
+ EXPECT_EQ(1U, loadingStateChanges.size());
+
+ TestWebKitAPI::Util::run(&didStartProvisionalLoad);
+ didStartProvisionalLoad = false;
+
+ EXPECT_EQ(1U, loadingStateChanges.size());
+ EXPECT_EQ(1U, urlChangeCount);
+
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+ EXPECT_TRUE([webView isLoading]);
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+
+ EXPECT_WK_STREQ(@"pson://www.apple.com/main.html", [[webView URL] absoluteString]);
+ EXPECT_FALSE([webView isLoading]);
+
+ EXPECT_EQ(2U, loadingStateChanges.size());
+ EXPECT_FALSE(loadingStateChanges[1]);
+ EXPECT_EQ(1U, urlChangeCount);
+
+ [webView removeObserver:loadObserver.get() forKeyPath:@"loading" context:webView.get()];
+ [webView removeObserver:loadObserver.get() forKeyPath:@"URL" context:webView.get()];
+}
+
#if PLATFORM(MAC)
static const char* saveOpenerTestBytes = R"PSONRESOURCE(