Changeset 262085 in webkit


Ignore:
Timestamp:
May 22, 2020 3:50:50 PM (4 years ago)
Author:
Chris Dumez
Message:

Revoking an object URL immediately after triggering navigation causes navigation to fail
https://bugs.webkit.org/show_bug.cgi?id=212279
<rdar://problem/63553090>

Reviewed by Geoffrey Garen.

Source/WebCore:

When doing a policy check for a Blob URL, we clone the blob and create a new temporary Blob URL
that stays alive for the duration of the policy check. We made sure to update the ResourceRequest
URL with the new Blob URL, however, we were failing to update the DocumentLoader's request.
As a result, if the client responded with Policy USE, the DocumentLoader would still attempt to
navigate to the old Blob URL.

Test: fast/loader/revoke-blob-url-after-navigation.html

  • loader/PolicyChecker.cpp:

(WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
(WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
(WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):

  • loader/PolicyChecker.h:

LayoutTests:

Add layout test coverage.

  • fast/loader/revoke-blob-url-after-navigation-expected.txt: Added.
  • fast/loader/revoke-blob-url-after-navigation.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r262078 r262085  
     12020-05-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Revoking an object URL immediately after triggering navigation causes navigation to fail
     4        https://bugs.webkit.org/show_bug.cgi?id=212279
     5        <rdar://problem/63553090>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Add layout test coverage.
     10
     11        * fast/loader/revoke-blob-url-after-navigation-expected.txt: Added.
     12        * fast/loader/revoke-blob-url-after-navigation.html: Added.
     13
    1142020-05-22  Jason Lawrence  <lawrence.j@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r262076 r262085  
     12020-05-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Revoking an object URL immediately after triggering navigation causes navigation to fail
     4        https://bugs.webkit.org/show_bug.cgi?id=212279
     5        <rdar://problem/63553090>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        When doing a policy check for a Blob URL, we clone the blob and create a new temporary Blob URL
     10        that stays alive for the duration of the policy check. We made sure to update the ResourceRequest
     11        URL with the new Blob URL, however, we were failing to update the DocumentLoader's request.
     12        As a result, if the client responded with Policy USE, the DocumentLoader would still attempt to
     13        navigate to the old Blob URL.
     14
     15        Test: fast/loader/revoke-blob-url-after-navigation.html
     16
     17        * loader/PolicyChecker.cpp:
     18        (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
     19        (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
     20        (WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):
     21        * loader/PolicyChecker.h:
     22
    1232020-05-22  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/Source/WebCore/loader/PolicyChecker.cpp

    r260890 r262085  
    105105}
    106106
    107 CompletionHandlerCallingScope FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary(ResourceRequest& request) const
     107CompletionHandlerCallingScope FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary(ResourceRequest& request, DocumentLoader* loader) const
    108108{
    109109    if (!request.url().protocolIsBlob())
     
    114114    blobRegistry().registerBlobURL(temporaryBlobURL, request.url());
    115115    request.setURL(temporaryBlobURL);
     116    if (loader)
     117        loader->request().setURL(temporaryBlobURL);
    116118    return CompletionHandler<void()>([temporaryBlobURL = WTFMove(temporaryBlobURL)] {
    117119        blobRegistry().unregisterBlobURL(temporaryBlobURL);
     
    198200    m_frame.loader().clearProvisionalLoadForPolicyCheck();
    199201
    200     auto blobURLLifetimeExtension = policyDecisionMode == PolicyDecisionMode::Asynchronous ? extendBlobURLLifetimeIfNecessary(request) : CompletionHandlerCallingScope { };
     202    auto blobURLLifetimeExtension = policyDecisionMode == PolicyDecisionMode::Asynchronous ? extendBlobURLLifetimeIfNecessary(request, loader) : CompletionHandlerCallingScope { };
    201203
    202204    bool isInitialEmptyDocumentLoad = !m_frame.loader().stateMachine().committedFirstRealDocumentLoad() && request.url().protocolIsAbout() && !substituteData.isValid();
     
    256258        return function({ }, nullptr, { }, { }, ShouldContinuePolicyCheck::No);
    257259
    258     auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request);
     260    auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request, nullptr);
    259261
    260262    auto requestIdentifier = PolicyCheckIdentifier::create();
  • trunk/Source/WebCore/loader/PolicyChecker.h

    r260890 r262085  
    9090private:
    9191    void handleUnimplementablePolicy(const ResourceError&);
    92     WTF::CompletionHandlerCallingScope extendBlobURLLifetimeIfNecessary(ResourceRequest&) const;
     92    WTF::CompletionHandlerCallingScope extendBlobURLLifetimeIfNecessary(ResourceRequest&, DocumentLoader*) const;
    9393
    9494    Frame& m_frame;
Note: See TracChangeset for help on using the changeset viewer.