Title: [227029] branches/safari-605-branch
- Revision
- 227029
- Author
- [email protected]
- Date
- 2018-01-16 21:04:28 -0800 (Tue, 16 Jan 2018)
Log Message
Cherry-pick r226929. rdar://problem/36567962
Modified Paths
Diff
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227028 => 227029)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-17 05:04:25 UTC (rev 227028)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-17 05:04:28 UTC (rev 227029)
@@ -1,5 +1,31 @@
2018-01-16 Jason Marcell <[email protected]>
+ Cherry-pick r226929. rdar://problem/36567962
+
+ 2018-01-12 Alex Christensen <[email protected]>
+
+ History state should be updated during client redirects with asynchronous policy decisions
+ https://bugs.webkit.org/show_bug.cgi?id=181358
+ <rdar://problem/35547689>
+
+ Reviewed by Andy Estes.
+
+ When decidePolicyForNavigationAction is responded to asynchronously during a client redirect,
+ HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
+ the document loader has not been marked as a client redirect because the FrameLoader only looks
+ at its provisional document loader to mark it as a client redirect. When decidePolicyForNavigationAction
+ is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to
+ its policy document loader. To get both asynchronous and synchronous cases, let's just mark the document
+ loader as a client redirect whether it's the provisional or policy document loader.
+
+ Covered by a new API test.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadURL):
+ (WebCore::FrameLoader::loadPostRequest):
+
+2018-01-16 Jason Marcell <[email protected]>
+
Cherry-pick r226919. rdar://problem/36567968
2018-01-12 Myles C. Maxfield <[email protected]>
Modified: branches/safari-605-branch/Source/WebCore/loader/FrameLoader.cpp (227028 => 227029)
--- branches/safari-605-branch/Source/WebCore/loader/FrameLoader.cpp 2018-01-17 05:04:25 UTC (rev 227028)
+++ branches/safari-605-branch/Source/WebCore/loader/FrameLoader.cpp 2018-01-17 05:04:28 UTC (rev 227029)
@@ -1342,6 +1342,8 @@
m_quickRedirectComing = false;
if (m_provisionalDocumentLoader)
m_provisionalDocumentLoader->setIsClientRedirect(true);
+ else if (m_policyDocumentLoader)
+ m_policyDocumentLoader->setIsClientRedirect(true);
} else if (sameURL && !isReload(newLoadType)) {
// Example of this case are sites that reload the same URL with a different cookie
// driving the generated content, or a master frame with links that drive a target
@@ -2775,6 +2777,8 @@
m_quickRedirectComing = false;
if (m_provisionalDocumentLoader)
m_provisionalDocumentLoader->setIsClientRedirect(true);
+ else if (m_policyDocumentLoader)
+ m_policyDocumentLoader->setIsClientRedirect(true);
}
}
Modified: branches/safari-605-branch/Tools/ChangeLog (227028 => 227029)
--- branches/safari-605-branch/Tools/ChangeLog 2018-01-17 05:04:25 UTC (rev 227028)
+++ branches/safari-605-branch/Tools/ChangeLog 2018-01-17 05:04:28 UTC (rev 227029)
@@ -1,3 +1,20 @@
+2018-01-16 Jason Marcell <[email protected]>
+
+ Cherry-pick r226929. rdar://problem/36567962
+
+ 2018-01-12 Alex Christensen <[email protected]>
+
+ History state should be updated during client redirects with asynchronous policy decisions
+ https://bugs.webkit.org/show_bug.cgi?id=181358
+ <rdar://problem/35547689>
+
+ Reviewed by Andy Estes.
+
+ * TestWebKitAPI/Tests/WebKit/WKBackForwardList.mm:
+ (-[AsyncPolicyDecisionDelegate webView:didFinishNavigation:]):
+ (-[AsyncPolicyDecisionDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
+ (TEST):
+
2018-01-12 Jason Marcell <[email protected]>
Cherry-pick r226838. rdar://problem/36480711
Modified: branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardList.mm (227028 => 227029)
--- branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardList.mm 2018-01-17 05:04:25 UTC (rev 227028)
+++ branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKit/WKBackForwardList.mm 2018-01-17 05:04:28 UTC (rev 227029)
@@ -103,4 +103,39 @@
EXPECT_EQ((NSUInteger)0, newList.forwardList.count);
}
+static bool done;
+static size_t navigations;
+
+@interface AsyncPolicyDecisionDelegate : NSObject <WKNavigationDelegate, WKUIDelegate>
+@end
+
+@implementation AsyncPolicyDecisionDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation
+{
+ if (navigations++)
+ done = true;
+}
+
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
+{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ decisionHandler(WKNavigationActionPolicyAllow);
+ });
+}
+
+@end
+
+TEST(WKBackForwardList, WindowLocationAsyncPolicyDecision)
+{
+ NSURL *simple = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ NSURL *simple2 = [[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ auto webView = adoptNS([[WKWebView alloc] init]);
+ auto delegate = adoptNS([[AsyncPolicyDecisionDelegate alloc] init]);
+ [webView setNavigationDelegate:delegate.get()];
+ [webView loadHTMLString:@"<script>window.location='simple.html'</script>" baseURL:simple2];
+ TestWebKitAPI::Util::run(&done);
+ EXPECT_STREQ(webView.get().backForwardList.currentItem.URL.absoluteString.UTF8String, simple.absoluteString.UTF8String);
+}
+
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes