Title: [184727] trunk/Source/WebKit2
Revision
184727
Author
ander...@apple.com
Date
2015-05-21 12:12:17 -0700 (Thu, 21 May 2015)

Log Message

WKWebsiteDataStore doesn't track and remove iOS Safari's offline application cache entries
https://bugs.webkit.org/show_bug.cgi?id=145279
rdar://problem/20657912

Reviewed by Dan Bernstein.

Special-case iOS Safari and WebApp when computing the default application cache directory.

* UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
(API::applicationCacheDirectory):
(API::WebsiteDataStore::defaultDataStoreConfiguration):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (184726 => 184727)


--- trunk/Source/WebKit2/ChangeLog	2015-05-21 18:54:13 UTC (rev 184726)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-21 19:12:17 UTC (rev 184727)
@@ -1,3 +1,17 @@
+2015-05-21  Anders Carlsson  <ander...@apple.com>
+
+        WKWebsiteDataStore doesn't track and remove iOS Safari's offline application cache entries
+        https://bugs.webkit.org/show_bug.cgi?id=145279
+        rdar://problem/20657912
+
+        Reviewed by Dan Bernstein.
+
+        Special-case iOS Safari and WebApp when computing the default application cache directory.
+
+        * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
+        (API::applicationCacheDirectory):
+        (API::WebsiteDataStore::defaultDataStoreConfiguration):
+
 2015-05-21  Brian Weinstein  <bweinst...@apple.com>
 
         Add a _WKWebKitContentExtensionStore initializer that takes a path.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm (184726 => 184727)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2015-05-21 18:54:13 UTC (rev 184726)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2015-05-21 19:12:17 UTC (rev 184727)
@@ -26,8 +26,13 @@
 #include "config.h"
 #include "APIWebsiteDataStore.h"
 
+#include "SandboxExtension.h"
 #include "SandboxUtilities.h"
 
+#if PLATFORM(IOS)
+#import <WebCore/RuntimeApplicationChecksIOS.h>
+#endif
+
 namespace API {
 
 String WebsiteDataStore::cacheDirectoryFileSystemRepresentation(const String& directoryName)
@@ -86,12 +91,29 @@
     return url.absoluteURL.path.fileSystemRepresentation;
 }
 
+static String applicationCacheDirectory()
+{
+#if PLATFORM(IOS)
+    // This quirk used to make these apps share application cache storage, but doesn't accomplish that any more.
+    // Preserving it avoids the need to migrate data when upgrading.
+    // FIXME: Ideally we should just have Safari and WebApp create a data store with
+    // this application cache path, but that's not supported as of right now.
+    if (WebCore::applicationIsMobileSafari() || WebCore::applicationIsWebApp()) {
+        NSString *cachePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches/com.apple.WebAppCache"];
+
+        return WebKit::stringByResolvingSymlinksInPath(cachePath.stringByStandardizingPath);
+    }
+#endif
+
+    return WebsiteDataStore::cacheDirectoryFileSystemRepresentation("OfflineWebApplicationCache");
+}
+
 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration()
 {
     WebKit::WebsiteDataStore::Configuration configuration;
 
     configuration.networkCacheDirectory = cacheDirectoryFileSystemRepresentation("NetworkCache");
-    configuration.applicationCacheDirectory = cacheDirectoryFileSystemRepresentation("OfflineWebApplicationCache");
+    configuration.applicationCacheDirectory = applicationCacheDirectory();
 
     configuration.webSQLDatabaseDirectory = websiteDataDirectoryFileSystemRepresentation("WebSQL");
     configuration.localStorageDirectory = websiteDataDirectoryFileSystemRepresentation("LocalStorage");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to