Modified: trunk/Source/WebCore/ChangeLog (225656 => 225657)
--- trunk/Source/WebCore/ChangeLog 2017-12-08 00:56:18 UTC (rev 225656)
+++ trunk/Source/WebCore/ChangeLog 2017-12-08 00:59:02 UTC (rev 225657)
@@ -1,3 +1,17 @@
+2017-12-07 Alex Christensen <achristen...@webkit.org>
+
+ Fix API test after r225645.
+ https://bugs.webkit.org/show_bug.cgi?id=180544
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadURL):
+ (WebCore::FrameLoader::loadWithDocumentLoader):
+ The API test WebKitLegacy.FragmentNavigation started failing after r225645.
+ It does call the completion handler with ignore to cancel fragment navigation.
+ To make this work and increase compatibility, only synchronously continue with
+ fragment navigations if we haven't received a synchronous answer to the
+ decidePolicyForNavigationAction callback.
+
2017-12-07 Oleksandr Skachkov <gskach...@gmail.com>
WebAssembly: sending module to iframe fails
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (225656 => 225657)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2017-12-08 00:56:18 UTC (rev 225656)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2017-12-08 00:59:02 UTC (rev 225657)
@@ -1252,6 +1252,10 @@
return m_pageDismissalEventBeingDispatched == PageDismissalType::None && NavigationDisabler::isNavigationAllowed(m_frame);
}
+struct SharedBool : public RefCounted<SharedBool> {
+ bool value { false };
+};
+
void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& referrer, FrameLoadType newLoadType, Event* event, FormState* formState)
{
if (m_inStopAllLoaders)
@@ -1315,8 +1319,17 @@
oldDocumentLoader->setLastCheckedRequest(ResourceRequest());
policyChecker().stopCheck();
policyChecker().setLoadType(newLoadType);
- continueFragmentScrollAfterNavigationPolicy(request, true);
- policyChecker().checkNavigationPolicy(WTFMove(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { });
+ auto completionHandlerCalled = adoptRef(*new SharedBool);
+ policyChecker().checkNavigationPolicy(ResourceRequest(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this, completionHandlerCalled = completionHandlerCalled.copyRef()] (const ResourceRequest& request, FormState*, bool shouldContinue) {
+ if (!completionHandlerCalled->value) {
+ completionHandlerCalled->value = true;
+ continueFragmentScrollAfterNavigationPolicy(request, shouldContinue);
+ }
+ });
+ if (!completionHandlerCalled->value) {
+ completionHandlerCalled->value = true;
+ continueFragmentScrollAfterNavigationPolicy(WTFMove(request), true);
+ }
return;
}
@@ -1474,8 +1487,17 @@
oldDocumentLoader->setTriggeringAction(action);
oldDocumentLoader->setLastCheckedRequest(ResourceRequest());
policyChecker().stopCheck();
- continueFragmentScrollAfterNavigationPolicy(loader->request(), true);
- policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { });
+ auto completionHandlerCalled = adoptRef(*new SharedBool);
+ policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this, completionHandlerCalled = completionHandlerCalled.copyRef()] (const ResourceRequest& request, FormState*, bool shouldContinue) {
+ if (!completionHandlerCalled->value) {
+ completionHandlerCalled->value = true;
+ continueFragmentScrollAfterNavigationPolicy(request, shouldContinue);
+ }
+ });
+ if (!completionHandlerCalled->value) {
+ completionHandlerCalled->value = true;
+ continueFragmentScrollAfterNavigationPolicy(loader->request(), true);
+ }
return;
}