Title: [176698] trunk
Revision
176698
Author
[email protected]
Date
2014-12-02 16:33:29 -0800 (Tue, 02 Dec 2014)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176697 => 176698)


--- trunk/Source/WebCore/ChangeLog	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/ChangeLog	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1,3 +1,23 @@
+2014-12-02  Alexey Proskuryakov  <[email protected]>
+
+        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.
+
+        * 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.
+
 2014-12-02  Tim Horton  <[email protected]>
 
         Remove a SnowLeopard-era quirk for QuickLook

Modified: trunk/Source/WebCore/WebCore.exp.in (176697 => 176698)


--- trunk/Source/WebCore/WebCore.exp.in	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-12-03 00:33:29 UTC (rev 176698)
@@ -680,6 +680,7 @@
 __ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi
 __ZN7WebCore15visitedLinkHashEPKtj
 __ZN7WebCore15visitedLinkHashERKN3WTF6StringE
+__ZN7WebCore16ApplicationCache15deleteAllCachesEv
 __ZN7WebCore16ApplicationCache18diskUsageForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16ApplicationCache20deleteCacheForOriginEPNS_14SecurityOriginE
 __ZN7WebCore16CSSParserContextC1ERNS_8DocumentERKNS_3URLERKN3WTF6StringE

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp (176697 => 176698)


--- trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2014-12-03 00:33:29 UTC (rev 176698)
@@ -193,7 +193,7 @@
 void ApplicationCache::deleteCacheForOrigin(SecurityOrigin* origin)
 {
     Vector<URL> urls;
-    if (!cacheStorage().manifestURLs(&urls)) {
+    if (!cacheStorage().getManifestURLs(&urls)) {
         LOG_ERROR("Failed to retrieve ApplicationCache manifest URLs");
         return;
     }
@@ -212,6 +212,17 @@
     }
 }
 
+void ApplicationCache::deleteAllCaches()
+{
+    HashSet<RefPtr<SecurityOrigin>> origins;
+
+    cacheStorage().getOriginsWithCache(origins);
+    for (auto& origin : origins)
+        deleteCacheForOrigin(origin.get());
+
+    cacheStorage().vacuumDatabaseFile();
+}
+
 int64_t ApplicationCache::diskUsageForOrigin(SecurityOrigin* origin)
 {
     int64_t usage = 0;

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.h (176697 => 176698)


--- trunk/Source/WebCore/loader/appcache/ApplicationCache.h	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.h	2014-12-03 00:33:29 UTC (rev 176698)
@@ -49,7 +49,8 @@
     static PassRefPtr<ApplicationCache> create() { return adoptRef(new ApplicationCache); }
     
     WEBCORE_EXPORT static void deleteCacheForOrigin(SecurityOrigin*);
-    
+    WEBCORE_EXPORT static void deleteAllCaches();
+
     ~ApplicationCache();
 
     void addResource(PassRefPtr<ApplicationCacheResource> resource);

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (176697 => 176698)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1372,7 +1372,7 @@
     return copyStorage.storeNewestCache(groupCopy.get());
 }
 
-bool ApplicationCacheStorage::manifestURLs(Vector<URL>* urls)
+bool ApplicationCacheStorage::getManifestURLs(Vector<URL>* urls)
 {
     SQLiteTransactionInProgressAutoCounter transactionCounter;
 
@@ -1562,10 +1562,7 @@
 void ApplicationCacheStorage::getOriginsWithCache(HashSet<RefPtr<SecurityOrigin>>& origins)
 {
     Vector<URL> urls;
-    if (!manifestURLs(&urls)) {
-        LOG_ERROR("Failed to retrieve ApplicationCache manifest URLs");
-        return;
-    }
+    getManifestURLs(&urls);
 
     // Multiple manifest URLs might share the same SecurityOrigin, so we might be creating extra, wasted origins here.
     // The current schema doesn't allow for a more efficient way of building this list.
@@ -1582,7 +1579,7 @@
     vacuumDatabaseFile();
 }
 
-ApplicationCacheStorage::ApplicationCacheStorage() 
+ApplicationCacheStorage::ApplicationCacheStorage()
     : m_maximumSize(ApplicationCacheStorage::noQuota())
     , m_isMaximumSizeReached(false)
     , m_defaultOriginQuota(ApplicationCacheStorage::noQuota())

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h (176697 => 176698)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2014-12-03 00:33:29 UTC (rev 176698)
@@ -89,7 +89,7 @@
     
     static bool WEBCORE_EXPORT storeCopyOfCache(const String& cacheDirectory, ApplicationCacheHost*);
 
-    bool manifestURLs(Vector<URL>* urls);
+    bool getManifestURLs(Vector<URL>* urls);
     bool cacheGroupSize(const String& manifestURL, int64_t* size);
     bool deleteCacheGroup(const String& manifestURL);
     WEBCORE_EXPORT void vacuumDatabaseFile();

Modified: trunk/Source/WebKit/mac/ChangeLog (176697 => 176698)


--- trunk/Source/WebKit/mac/ChangeLog	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1,3 +1,21 @@
+2014-12-02  Alexey Proskuryakov  <[email protected]>
+
+        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.
+
+        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.
+
 2014-12-02  Tim Horton  <[email protected]>
 
         Remove a SnowLeopard-era quirk for QuickLook

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm (176697 => 176698)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2014-12-03 00:33:29 UTC (rev 176698)
@@ -66,7 +66,7 @@
 
 + (void)setMaximumSize:(long long)size
 {
-    [WebApplicationCache deleteAllApplicationCaches];
+    cacheStorage().deleteAllEntries();
     cacheStorage().setMaximumSize(size);
 }
 
@@ -87,7 +87,7 @@
 
 + (void)deleteAllApplicationCaches
 {
-    cacheStorage().deleteAllEntries();
+    ApplicationCache::deleteAllCaches();
 }
 
 + (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin

Modified: trunk/Source/WebKit2/ChangeLog (176697 => 176698)


--- trunk/Source/WebKit2/ChangeLog	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1,3 +1,19 @@
+2014-12-02  Alexey Proskuryakov  <[email protected]>
+
+        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.
+
+        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.
+
 2014-12-02  Tim Horton  <[email protected]>
 
         Remove a SnowLeopard-era quirk for QuickLook

Modified: trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp (176697 => 176698)


--- trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp	2014-12-03 00:33:29 UTC (rev 176698)
@@ -87,7 +87,7 @@
 
 void WebApplicationCacheManager::deleteAllEntries()
 {
-    cacheStorage().deleteAllEntries();
+    ApplicationCache::deleteAllCaches();
 }
 
 void WebApplicationCacheManager::setAppCacheMaximumSize(uint64_t size)

Modified: trunk/Tools/ChangeLog (176697 => 176698)


--- trunk/Tools/ChangeLog	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Tools/ChangeLog	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1,3 +1,21 @@
+2014-12-02  Alexey Proskuryakov  <[email protected]>
+
+        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.
+
+        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.
+
 2014-12-02  Gavin Barraclough  <[email protected]>
 
         Generalize PageActivityAssertionToken

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (176697 => 176698)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1870,6 +1870,7 @@
 
     sizeWebViewForCurrentTest();
     gTestRunner->setIconDatabaseEnabled(false);
+    gTestRunner->clearAllApplicationCaches();
 
     if (disallowedURLs)
         CFSetRemoveAllValues(disallowedURLs);

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (176697 => 176698)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2014-12-03 00:33:29 UTC (rev 176698)
@@ -1019,6 +1019,7 @@
 
     sizeWebViewForCurrentTest();
     gTestRunner->setIconDatabaseEnabled(false);
+    gTestRunner->clearAllApplicationCaches();
 
     if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
         gTestRunner->setDumpFrameLoadCallbacks(true);

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (176697 => 176698)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2014-12-03 00:32:33 UTC (rev 176697)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2014-12-03 00:33:29 UTC (rev 176698)
@@ -750,7 +750,7 @@
 
 void TestRunner::clearAllApplicationCaches()
 {
-    // FIXME: Implement to support application cache quotas.
+    // FIXME: Implement to support application cache quotas, and to make testing more reliable (see <https://bugs.webkit.org/show_bug.cgi?id=139149>).
 }
 
 void TestRunner::clearApplicationCacheForOrigin(JSStringRef origin)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to