Changeset 187466 in webkit


Ignore:
Timestamp:
Jul 27, 2015 5:06:32 PM (9 years ago)
Author:
beidson@apple.com
Message:

Crash in WebCore::DocumentLoader::willSendRequest() with ContentFilter and AppCache.
<rdar://problem/21960398> and https://bugs.webkit.org/show_bug.cgi?id=147339

Reviewed by Alexey Proskuryakov.

No new tests (Not yet proven to be possible to test this).

  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::willSendRequest): Grab the identifier from the CachedResource directly, not from the null ResourceLoader.
(WebCore::DocumentLoader::continueAfterNavigationPolicy): Null check the ResourceLoader, as it can definitely be gone by this point.

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::clearLoader): Save off the identifier for later use.

  • loader/cache/CachedResource.h:

(WebCore::CachedResource::identifierForLoadWithoutResourceLoader): Expose the identifier that the ResourceLoader had when it went away.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r187463 r187466  
     12015-07-27  Brady Eidson  <beidson@apple.com>
     2
     3        Crash in WebCore::DocumentLoader::willSendRequest() with ContentFilter and AppCache.
     4        <rdar://problem/21960398> and https://bugs.webkit.org/show_bug.cgi?id=147339
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        No new tests (Not yet proven to be possible to test this).
     9
     10        * loader/DocumentLoader.cpp:
     11        (WebCore::DocumentLoader::willSendRequest): Grab the identifier from the CachedResource directly, not from the null ResourceLoader.
     12        (WebCore::DocumentLoader::continueAfterNavigationPolicy): Null check the ResourceLoader, as it can definitely be gone by this point.
     13
     14        * loader/cache/CachedResource.cpp:
     15        (WebCore::CachedResource::clearLoader): Save off the identifier for later use.
     16        * loader/cache/CachedResource.h:
     17        (WebCore::CachedResource::identifierForLoadWithoutResourceLoader): Expose the identifier that the ResourceLoader had when it went away.
     18
    1192015-07-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
    220
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r186957 r187466  
    551551        ASSERT(!m_substituteData.isValid());
    552552        m_applicationCacheHost->maybeLoadMainResourceForRedirect(newRequest, m_substituteData);
    553         if (m_substituteData.isValid())
    554             m_identifierForLoadWithoutResourceLoader = mainResourceLoader()->identifier();
     553        if (m_substituteData.isValid()) {
     554            RELEASE_ASSERT(m_mainResource);
     555            m_identifierForLoadWithoutResourceLoader = m_mainResource->identifierForLoadWithoutResourceLoader();
     556        }
    555557    }
    556558
     
    582584        // but prevent the ResourceLoader from sending ResourceLoadNotifier callbacks.
    583585        RefPtr<ResourceLoader> resourceLoader = mainResourceLoader();
    584         ASSERT(resourceLoader->shouldSendResourceLoadCallbacks());
    585         resourceLoader->setSendCallbackPolicy(DoNotSendCallbacks);
     586        if (resourceLoader) {
     587            ASSERT(resourceLoader->shouldSendResourceLoadCallbacks());
     588            resourceLoader->setSendCallbackPolicy(DoNotSendCallbacks);
     589        }
     590
    586591        clearMainResource();
    587         resourceLoader->setSendCallbackPolicy(SendCallbacks);
     592
     593        if (resourceLoader)
     594            resourceLoader->setSendCallbackPolicy(SendCallbacks);
    588595        handleSubstituteDataLoadSoon();
    589596    }
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r186279 r187466  
    406406{
    407407    ASSERT(m_loader);
     408    m_identifierForLoadWithoutResourceLoader = m_loader->identifier();
    408409    m_loader = nullptr;
    409410    deleteIfPossible();
  • trunk/Source/WebCore/loader/cache/CachedResource.h

    r186272 r187466  
    261261#endif
    262262
     263    unsigned long identifierForLoadWithoutResourceLoader() const { return m_identifierForLoadWithoutResourceLoader; }
     264
    263265protected:
    264266    void setEncodedSize(unsigned);
     
    342344
    343345    RedirectChainCacheStatus m_redirectChainCacheStatus;
     346
     347    unsigned long m_identifierForLoadWithoutResourceLoader { 0 };
    344348};
    345349
Note: See TracChangeset for help on using the changeset viewer.