Changeset 176698 in webkit


Ignore:
Timestamp:
Dec 2, 2014 4:33:29 PM (10 years ago)
Author:
ap@apple.com
Message:

http/tests/appcache/main-resource-fallback-for-network-error-crash.html can break subsequent tests
https://bugs.webkit.org/show_bug.cgi?id=139149

Reviewed by Anders Carlsson.

Source/WebCore:

  • WebCore.exp.in: Added ApplicationCache::deleteAllCaches.
  • loader/appcache/ApplicationCache.h:
  • loader/appcache/ApplicationCache.cpp:

(WebCore::ApplicationCache::deleteAllCaches): Added.

  • loader/appcache/ApplicationCacheStorage.cpp:

(WebCore::ApplicationCacheStorage::getManifestURLs): Removed logging. It is OK to
have this function called when there is no database file.

  • loader/appcache/ApplicationCacheStorage.h: Renamed manifestURLs to getManifestURLs,

because WebKit style.

Source/WebKit/mac:

This changes API behavior. I think that it's OK, because existing behavior made no sense.
We used to delete caches from disk, but they were still active in memory. Now we also
obsolete them in memory, so documents that use a cache still work, but new ones don't
pick one up.

  • WebCoreSupport/WebApplicationCache.mm:

(+[WebApplicationCache setMaximumSize:]): Changing maximum on-disk size doesn't
need to delete in-momry caches too. Keep existing behavior.
(+[WebApplicationCache deleteAllApplicationCaches]): Use the new WebCore function
that properly deletes caches.

Source/WebKit2:

This changes API behavior. I think that it's OK, because existing behavior made no sense.
We used to delete caches from disk, but they were still active in memory. Now we also
obsolete them in memory, so documents that use a cache still work, but new ones don't
pick one up.

  • WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:

(WebKit::WebApplicationCacheManager::deleteAllEntries): Use the new WebCore function
that properly deletes caches.

Tools:

WebKit2 already cleared application caches between runs (although it wasn't entirely
effective without WebCore changes in this patch).

  • DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Clear applicaiton caches between runs.
  • DumpRenderTree/win/DumpRenderTree.cpp: (runTest): Ditto (unfortunately, this

function is not implemented on Windows, see below).

  • DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::clearAllApplicationCaches):

Ameded a FIXME.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r176697 r176698  
     12014-12-02  Alexey Proskuryakov  <ap@apple.com>
     2
     3        http/tests/appcache/main-resource-fallback-for-network-error-crash.html can break subsequent tests
     4        https://bugs.webkit.org/show_bug.cgi?id=139149
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * WebCore.exp.in: Added ApplicationCache::deleteAllCaches.
     9
     10        * loader/appcache/ApplicationCache.h:
     11        * loader/appcache/ApplicationCache.cpp:
     12        (WebCore::ApplicationCache::deleteAllCaches): Added.
     13
     14        * loader/appcache/ApplicationCacheStorage.cpp:
     15        (WebCore::ApplicationCacheStorage::getManifestURLs): Removed logging. It is OK to
     16        have this function called when there is no database file.
     17
     18        * loader/appcache/ApplicationCacheStorage.h: Renamed manifestURLs to getManifestURLs,
     19        because WebKit style.
     20
    1212014-12-02  Tim Horton  <timothy_horton@apple.com>
    222
  • trunk/Source/WebCore/WebCore.exp.in

    r176697 r176698  
    681681__ZN7WebCore15visitedLinkHashEPKtj
    682682__ZN7WebCore15visitedLinkHashERKN3WTF6StringE
     683__ZN7WebCore16ApplicationCache15deleteAllCachesEv
    683684__ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
    684685__ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp

    r170113 r176698  
    194194{
    195195    Vector<URL> urls;
    196     if (!cacheStorage().manifestURLs(&urls)) {
     196    if (!cacheStorage().getManifestURLs(&urls)) {
    197197        LOG_ERROR("Failed to retrieve ApplicationCache manifest URLs");
    198198        return;
     
    213213}
    214214
     215void ApplicationCache::deleteAllCaches()
     216{
     217    HashSet<RefPtr<SecurityOrigin>> origins;
     218
     219    cacheStorage().getOriginsWithCache(origins);
     220    for (auto& origin : origins)
     221        deleteCacheForOrigin(origin.get());
     222
     223    cacheStorage().vacuumDatabaseFile();
     224}
     225
    215226int64_t ApplicationCache::diskUsageForOrigin(SecurityOrigin* origin)
    216227{
  • trunk/Source/WebCore/loader/appcache/ApplicationCache.h

    r172814 r176698  
    5050   
    5151    WEBCORE_EXPORT static void deleteCacheForOrigin(SecurityOrigin*);
    52    
     52    WEBCORE_EXPORT static void deleteAllCaches();
     53
    5354    ~ApplicationCache();
    5455
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp

    r176172 r176698  
    13731373}
    13741374
    1375 bool ApplicationCacheStorage::manifestURLs(Vector<URL>* urls)
     1375bool ApplicationCacheStorage::getManifestURLs(Vector<URL>* urls)
    13761376{
    13771377    SQLiteTransactionInProgressAutoCounter transactionCounter;
     
    15631563{
    15641564    Vector<URL> urls;
    1565     if (!manifestURLs(&urls)) {
    1566         LOG_ERROR("Failed to retrieve ApplicationCache manifest URLs");
    1567         return;
    1568     }
     1565    getManifestURLs(&urls);
    15691566
    15701567    // Multiple manifest URLs might share the same SecurityOrigin, so we might be creating extra, wasted origins here.
     
    15831580}
    15841581
    1585 ApplicationCacheStorage::ApplicationCacheStorage() 
     1582ApplicationCacheStorage::ApplicationCacheStorage()
    15861583    : m_maximumSize(ApplicationCacheStorage::noQuota())
    15871584    , m_isMaximumSizeReached(false)
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h

    r172849 r176698  
    9090    static bool WEBCORE_EXPORT storeCopyOfCache(const String& cacheDirectory, ApplicationCacheHost*);
    9191
    92     bool manifestURLs(Vector<URL>* urls);
     92    bool getManifestURLs(Vector<URL>* urls);
    9393    bool cacheGroupSize(const String& manifestURL, int64_t* size);
    9494    bool deleteCacheGroup(const String& manifestURL);
  • trunk/Source/WebKit/mac/ChangeLog

    r176697 r176698  
     12014-12-02  Alexey Proskuryakov  <ap@apple.com>
     2
     3        http/tests/appcache/main-resource-fallback-for-network-error-crash.html can break subsequent tests
     4        https://bugs.webkit.org/show_bug.cgi?id=139149
     5
     6        Reviewed by Anders Carlsson.
     7
     8        This changes API behavior. I think that it's OK, because existing behavior made no sense.
     9        We used to delete caches from disk, but they were still active in memory. Now we also
     10        obsolete them in memory, so documents that use a cache still work, but new ones don't
     11        pick one up.
     12
     13        * WebCoreSupport/WebApplicationCache.mm:
     14        (+[WebApplicationCache setMaximumSize:]): Changing maximum on-disk size doesn't
     15        need to delete in-momry caches too. Keep existing behavior.
     16        (+[WebApplicationCache deleteAllApplicationCaches]): Use the new WebCore function
     17        that properly deletes caches.
     18
    1192014-12-02  Tim Horton  <timothy_horton@apple.com>
    220
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm

    r161185 r176698  
    6767+ (void)setMaximumSize:(long long)size
    6868{
    69     [WebApplicationCache deleteAllApplicationCaches];
     69    cacheStorage().deleteAllEntries();
    7070    cacheStorage().setMaximumSize(size);
    7171}
     
    8888+ (void)deleteAllApplicationCaches
    8989{
    90     cacheStorage().deleteAllEntries();
     90    ApplicationCache::deleteAllCaches();
    9191}
    9292
  • trunk/Source/WebKit2/ChangeLog

    r176697 r176698  
     12014-12-02  Alexey Proskuryakov  <ap@apple.com>
     2
     3        http/tests/appcache/main-resource-fallback-for-network-error-crash.html can break subsequent tests
     4        https://bugs.webkit.org/show_bug.cgi?id=139149
     5
     6        Reviewed by Anders Carlsson.
     7
     8        This changes API behavior. I think that it's OK, because existing behavior made no sense.
     9        We used to delete caches from disk, but they were still active in memory. Now we also
     10        obsolete them in memory, so documents that use a cache still work, but new ones don't
     11        pick one up.
     12
     13        * WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:
     14        (WebKit::WebApplicationCacheManager::deleteAllEntries): Use the new WebCore function
     15        that properly deletes caches.
     16
    1172014-12-02  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp

    r160464 r176698  
    8888void WebApplicationCacheManager::deleteAllEntries()
    8989{
    90     cacheStorage().deleteAllEntries();
     90    ApplicationCache::deleteAllCaches();
    9191}
    9292
  • trunk/Tools/ChangeLog

    r176683 r176698  
     12014-12-02  Alexey Proskuryakov  <ap@apple.com>
     2
     3        http/tests/appcache/main-resource-fallback-for-network-error-crash.html can break subsequent tests
     4        https://bugs.webkit.org/show_bug.cgi?id=139149
     5
     6        Reviewed by Anders Carlsson.
     7
     8        WebKit2 already cleared application caches between runs (although it wasn't entirely
     9        effective without WebCore changes in this patch).
     10
     11        * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Clear applicaiton caches between runs.
     12
     13        * DumpRenderTree/win/DumpRenderTree.cpp: (runTest): Ditto (unfortunately, this
     14        function is not implemented on Windows, see below).
     15
     16        * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::clearAllApplicationCaches):
     17        Ameded a FIXME.
     18
    1192014-12-02  Gavin Barraclough  <barraclough@apple.com>
    220
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r176677 r176698  
    18711871    sizeWebViewForCurrentTest();
    18721872    gTestRunner->setIconDatabaseEnabled(false);
     1873    gTestRunner->clearAllApplicationCaches();
    18731874
    18741875    if (disallowedURLs)
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r176677 r176698  
    10201020    sizeWebViewForCurrentTest();
    10211021    gTestRunner->setIconDatabaseEnabled(false);
     1022    gTestRunner->clearAllApplicationCaches();
    10221023
    10231024    if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
  • trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp

    r172977 r176698  
    751751void TestRunner::clearAllApplicationCaches()
    752752{
    753     // FIXME: Implement to support application cache quotas.
     753    // FIXME: Implement to support application cache quotas, and to make testing more reliable (see <https://bugs.webkit.org/show_bug.cgi?id=139149>).
    754754}
    755755
Note: See TracChangeset for help on using the changeset viewer.