Changeset 225657 in webkit


Ignore:
Timestamp:
Dec 7, 2017 4:59:02 PM (6 years ago)
Author:
achristensen@apple.com
Message:

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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r225656 r225657  
     12017-12-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Fix API test after r225645.
     4        https://bugs.webkit.org/show_bug.cgi?id=180544
     5
     6        * loader/FrameLoader.cpp:
     7        (WebCore::FrameLoader::loadURL):
     8        (WebCore::FrameLoader::loadWithDocumentLoader):
     9        The API test WebKitLegacy.FragmentNavigation started failing after r225645.
     10        It does call the completion handler with ignore to cancel fragment navigation.
     11        To make this work and increase compatibility, only synchronously continue with
     12        fragment navigations if we haven't received a synchronous answer to the
     13        decidePolicyForNavigationAction callback.
     14
    1152017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
    216
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r225645 r225657  
    12531253}
    12541254
     1255struct SharedBool : public RefCounted<SharedBool> {
     1256    bool value { false };
     1257};
     1258
    12551259void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& referrer, FrameLoadType newLoadType, Event* event, FormState* formState)
    12561260{
     
    13161320        policyChecker().stopCheck();
    13171321        policyChecker().setLoadType(newLoadType);
    1318         continueFragmentScrollAfterNavigationPolicy(request, true);
    1319         policyChecker().checkNavigationPolicy(WTFMove(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { });
     1322        auto completionHandlerCalled = adoptRef(*new SharedBool);
     1323        policyChecker().checkNavigationPolicy(ResourceRequest(request), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this, completionHandlerCalled = completionHandlerCalled.copyRef()] (const ResourceRequest& request, FormState*, bool shouldContinue) {
     1324            if (!completionHandlerCalled->value) {
     1325                completionHandlerCalled->value = true;
     1326                continueFragmentScrollAfterNavigationPolicy(request, shouldContinue);
     1327            }
     1328        });
     1329            if (!completionHandlerCalled->value) {
     1330            completionHandlerCalled->value = true;
     1331            continueFragmentScrollAfterNavigationPolicy(WTFMove(request), true);
     1332        }
    13201333        return;
    13211334    }
     
    14751488        oldDocumentLoader->setLastCheckedRequest(ResourceRequest());
    14761489        policyChecker().stopCheck();
    1477         continueFragmentScrollAfterNavigationPolicy(loader->request(), true);
    1478         policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [] (const ResourceRequest&, FormState*, bool) { });
     1490        auto completionHandlerCalled = adoptRef(*new SharedBool);
     1491        policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), false /* didReceiveRedirectResponse */, oldDocumentLoader.get(), formState, [this, completionHandlerCalled = completionHandlerCalled.copyRef()] (const ResourceRequest& request, FormState*, bool shouldContinue) {
     1492            if (!completionHandlerCalled->value) {
     1493                completionHandlerCalled->value = true;
     1494                continueFragmentScrollAfterNavigationPolicy(request, shouldContinue);
     1495            }
     1496        });
     1497        if (!completionHandlerCalled->value) {
     1498            completionHandlerCalled->value = true;
     1499            continueFragmentScrollAfterNavigationPolicy(loader->request(), true);
     1500        }
    14791501        return;
    14801502    }
Note: See TracChangeset for help on using the changeset viewer.