NSURLCache fallback does not work on iOS due to sandboxing
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jul 2015 23:31:55 +0000 (23:31 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jul 2015 23:31:55 +0000 (23:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146314
<rdar://problem/21433691>

Reviewed by Anders Carlsson.

This broke with earlier cache path computation changes.

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):

    NSURLCache path is relative to the container cache path so "." is sufficient.
    This puts the cache files under
    <container>/Library/Caches/com.apple.WebKit.Networking/

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187045 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm

index 90126ce..1abd7e7 100644 (file)
@@ -1,3 +1,20 @@
+2015-07-20  Antti Koivisto  <antti@apple.com>
+
+        NSURLCache fallback does not work on iOS due to sandboxing
+        https://bugs.webkit.org/show_bug.cgi?id=146314
+        <rdar://problem/21433691>
+
+        Reviewed by Anders Carlsson.
+
+        This broke with earlier cache path computation changes.
+
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+
+            NSURLCache path is relative to the container cache path so "." is sufficient.
+            This puts the cache files under
+            <container>/Library/Caches/com.apple.WebKit.Networking/
+
 2015-07-20  Jeremy Jones  <jeremyj@apple.com>
 
         Adopt AVPlayerLayerView
index 767d1f3..8abf1c8 100644 (file)
@@ -101,17 +101,16 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC
             return;
         }
 #endif
+        String nsURLCacheDirectory = m_diskCacheDirectory;
 #if PLATFORM(IOS)
-        [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
-            _initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
-            diskCapacity:parameters.nsURLCacheDiskCapacity
-            relativePath:parameters.uiProcessBundleIdentifier]).get()];
-#else
+        // NSURLCache path is relative to network process cache directory.
+        // This puts cache files under <container>/Library/Caches/com.apple.WebKit.Networking/
+        nsURLCacheDirectory = ".";
+#endif
         [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
             initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
             diskCapacity:parameters.nsURLCacheDiskCapacity
-            diskPath:parameters.diskCacheDirectory]).get()];
-#endif
+            diskPath:nsURLCacheDirectory]).get()];
     }
 
     RetainPtr<CFURLCacheRef> cache = adoptCF(CFURLCacheCopySharedURLCache());