Changeset 178937 in webkit


Ignore:
Timestamp:
Jan 22, 2015 1:04:39 PM (9 years ago)
Author:
ap@apple.com
Message:

Crash in URL::protocol() after appcache load fails
https://bugs.webkit.org/show_bug.cgi?id=140755
rdar://problem/7881290

Reviewed by Dan Bates.

Source/WebCore:

Test: http/tests/appcache/404-resource-with-slow-main-resource.php

Not every cache that isn't being updated is complete. It could also be in a zombie
state after failing to load. We get rid of the cache once the main resource finishes
loading, but while it's being loaded, the zombie still looks like a regular
candidate application cache.

  • loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::isComplete):
  • loader/appcache/ApplicationCache.h:

Removed const from isComplete(), because otherwise we couldn't use ApplicationCacheGroup::m_caches.contains().
Constness doesn't make a lot of sense for these objects anyway.

  • loader/appcache/ApplicationCacheGroup.cpp:

(WebCore::ApplicationCacheGroup::failedLoadingMainResource): Toned down an assertion.
We can fail a main resource load when the document has a zombie appcache, too.

  • loader/appcache/ApplicationCacheGroup.h:

(WebCore::ApplicationCacheGroup::cacheIsComplete):
(WebCore::ApplicationCacheGroup::cacheIsBeingUpdated): Deleted.
These functions are only used in ApplicationCache::isComplete().

LayoutTests:

  • http/tests/appcache/404-resource-with-slow-main-resource-expected.txt: Added.
  • http/tests/appcache/404-resource-with-slow-main-resource.php: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178928 r178937  
     12015-01-22  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Crash in URL::protocol() after appcache load fails
     4        https://bugs.webkit.org/show_bug.cgi?id=140755
     5        rdar://problem/7881290
     6
     7        Reviewed by Dan Bates.
     8
     9        * http/tests/appcache/404-resource-with-slow-main-resource-expected.txt: Added.
     10        * http/tests/appcache/404-resource-with-slow-main-resource.php: Added.
     11
    1122015-01-22  Commit Queue  <commit-queue@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r178930 r178937  
     12015-01-22  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Crash in URL::protocol() after appcache load fails
     4        https://bugs.webkit.org/show_bug.cgi?id=140755
     5        rdar://problem/7881290
     6
     7        Reviewed by Dan Bates.
     8
     9        Test: http/tests/appcache/404-resource-with-slow-main-resource.php
     10
     11        Not every cache that isn't being updated is complete. It could also be in a zombie
     12        state after failing to load. We get rid of the cache once the main resource finishes
     13        loading, but while it's being loaded, the zombie still looks like a regular
     14        candidate application cache.
     15
     16        * loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::isComplete):
     17        * loader/appcache/ApplicationCache.h:
     18        Removed const from isComplete(), because otherwise we couldn't use ApplicationCacheGroup::m_caches.contains().
     19        Constness doesn't make a lot of sense for these objects anyway.
     20
     21        * loader/appcache/ApplicationCacheGroup.cpp:
     22        (WebCore::ApplicationCacheGroup::failedLoadingMainResource): Toned down an assertion.
     23        We can fail a main resource load when the document has a zombie appcache, too.
     24
     25        * loader/appcache/ApplicationCacheGroup.h:
     26        (WebCore::ApplicationCacheGroup::cacheIsComplete):
     27        (WebCore::ApplicationCacheGroup::cacheIsBeingUpdated): Deleted.
     28        These functions are only used in ApplicationCache::isComplete().
     29
    1302015-01-22  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
    231
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp

    r176698 r178937  
    6363}
    6464
    65 bool ApplicationCache::isComplete() const
    66 {
    67     return !m_group->cacheIsBeingUpdated(this);
     65bool ApplicationCache::isComplete()
     66{
     67    return m_group && m_group->cacheIsComplete(this);
    6868}
    6969
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.h

    r177733 r178937  
    6363    ApplicationCacheGroup* group() const { return m_group; }
    6464
    65     bool isComplete() const;
     65    bool isComplete();
    6666
    6767    ApplicationCacheResource* resourceForRequest(const ResourceRequest&);
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r178820 r178937  
    301301        // Cache update failed, too.
    302302        ASSERT(!m_cacheBeingUpdated); // Already cleared out by stopLoading().
    303         ASSERT(!loader->applicationCacheHost()->applicationCache() || loader->applicationCacheHost()->applicationCache() == m_cacheBeingUpdated);
     303        ASSERT(!loader->applicationCacheHost()->applicationCache() || loader->applicationCacheHost()->applicationCache()->group() == this);
    304304
    305305        loader->applicationCacheHost()->setApplicationCache(0); // Will unset candidate, too.
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h

    r178177 r178937  
    7878    void abort(Frame*);
    7979
    80     bool cacheIsBeingUpdated(const ApplicationCache* cache) const { return cache == m_cacheBeingUpdated; }
     80    bool cacheIsComplete(ApplicationCache* cache) { return m_caches.contains(cache); }
    8181
    8282    void stopLoadingInFrame(Frame*);
Note: See TracChangeset for help on using the changeset viewer.