Changeset 225645 in webkit
- Timestamp:
- Dec 7, 2017 1:59:48 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225644 r225645 1 2017-12-07 Alex Christensen <achristensen@webkit.org> 2 3 Always synchronously continue with fragment navigations 4 https://bugs.webkit.org/show_bug.cgi?id=180544 5 <rdar://problem/34815986> and <rdar://problem/35126690> 6 7 Reviewed by Geoffrey Garen. 8 9 * http/tests/dom/document-fragment-expected.txt: Added. 10 * http/tests/dom/document-fragment.html: Added. 11 Add a test that verifies that the fragment of the document is set immediately during a fragment navigation, 12 even if decidePolicyForNavigationAction is called asynchronously. Also verify the order of various events 13 associated with the navigation. 14 1 15 2017-12-07 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r225644 r225645 1 2017-12-07 Alex Christensen <achristensen@webkit.org> 2 3 Always synchronously continue with fragment navigations 4 https://bugs.webkit.org/show_bug.cgi?id=180544 5 <rdar://problem/34815986> and <rdar://problem/35126690> 6 7 Reviewed by Geoffrey Garen. 8 9 Test: http/tests/dom/document-fragment.html 10 11 When a decidePolicyForNavigationAction completionHandler is called asynchronously, 12 the document's URL has not changed yet when JavaScript execution continues. This causes 13 significant web incompatibility because all browsers change the document's URL immediately 14 during fragment navigations. In order to make WebKit applications more web compatible, 15 we now immediately continue to have the state consistent. To keep compatibility with any 16 WebView, UIWebView, or WKWebView applications that use these delegate callbacks to update 17 state, we still call decidePolicyForNavigationAction. This would break a theoretical app 18 that would cancel fragment navigations, but it fixes apps that continue fragment navigations 19 asynchronously. 20 21 * loader/FrameLoader.cpp: 22 (WebCore::FrameLoader::loadURL): 23 (WebCore::FrameLoader::loadWithDocumentLoader): 24 1 25 2017-12-07 Youenn Fablet <youenn@apple.com> 2 26 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r225449 r225645 1316 1316 policyChecker().stopCheck(); 1317 1317 policyChecker().setLoadType(newLoadType); 1318 policyChecker().checkNavigationPolicy(WTFMove(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this] (const ResourceRequest& request, FormState*, bool shouldContinue) { 1319 continueFragmentScrollAfterNavigationPolicy(request, shouldContinue); 1320 }); 1318 continueFragmentScrollAfterNavigationPolicy(request, true); 1319 policyChecker().checkNavigationPolicy(WTFMove(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { }); 1321 1320 return; 1322 1321 } … … 1476 1475 oldDocumentLoader->setLastCheckedRequest(ResourceRequest()); 1477 1476 policyChecker().stopCheck(); 1478 policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this] (const ResourceRequest& request, FormState*, bool shouldContinue) { 1479 continueFragmentScrollAfterNavigationPolicy(request, shouldContinue); 1480 }); 1477 continueFragmentScrollAfterNavigationPolicy(loader->request(), true); 1478 policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { }); 1481 1479 return; 1482 1480 } -
trunk/Tools/ChangeLog
r225641 r225645 1 2017-12-07 Alex Christensen <achristensen@webkit.org> 2 3 Always synchronously continue with fragment navigations 4 https://bugs.webkit.org/show_bug.cgi?id=180544 5 <rdar://problem/34815986> and <rdar://problem/35126690> 6 7 Reviewed by Geoffrey Garen. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm: 10 (-[DecidePolicyForNavigationActionFragmentDelegate webView:decidePolicyForNavigationAction:decisionHandler:]): 11 (TEST): 12 Add a test that verifies that decidePolicyForNavigationAction is called for fragment navigations. 13 1 14 2017-12-07 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm
r221505 r225645 527 527 } 528 528 529 static size_t calls; 530 static bool done; 531 532 @interface DecidePolicyForNavigationActionFragmentDelegate : NSObject <WKNavigationDelegate> 533 @end 534 535 @implementation DecidePolicyForNavigationActionFragmentDelegate 536 537 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler 538 { 539 decisionHandler(WKNavigationActionPolicyAllow); 540 const char* url = navigationAction.request.URL.absoluteString.UTF8String; 541 switch (calls++) { 542 case 0: 543 EXPECT_STREQ(url, "http://webkit.org/"); 544 return; 545 case 1: 546 EXPECT_STREQ(url, "http://webkit.org/#fragment"); 547 done = true; 548 return; 549 } 550 ASSERT_NOT_REACHED(); 551 } 552 553 @end 554 555 TEST(WebKit, DecidePolicyForNavigationActionFragment) 556 { 557 auto webView = adoptNS([[WKWebView alloc] init]); 558 auto delegate = adoptNS([[DecidePolicyForNavigationActionFragmentDelegate alloc] init]); 559 [webView setNavigationDelegate:delegate.get()]; 560 [webView loadHTMLString:@"<script>window.location.href='#fragment';</script>" baseURL:[NSURL URLWithString:@"http://webkit.org"]]; 561 TestWebKitAPI::Util::run(&done); 562 } 563 529 564 #endif 530 565
Note: See TracChangeset
for help on using the changeset viewer.