Title: [87971] branches/safari-534-branch/Source/WebCore

Diff

Modified: branches/safari-534-branch/Source/WebCore/ChangeLog (87970 => 87971)


--- branches/safari-534-branch/Source/WebCore/ChangeLog	2011-06-03 00:42:10 UTC (rev 87970)
+++ branches/safari-534-branch/Source/WebCore/ChangeLog	2011-06-03 00:44:14 UTC (rev 87971)
@@ -1,5 +1,26 @@
 2011-06-02  Lucas Forschler  <[email protected]>
 
+    Merged 87704.
+
+    2011-05-30  Eric Carlson  <[email protected]>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Audio and video files saved to the Application Cache should preserve the original file extension
+        https://bugs.webkit.org/show_bug.cgi?id=61750
+        <rdar://9524922>
+
+        No new tests, it isn't possible to check the name of the file in the cache from within
+        DRT. Changes verified manually.
+
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::store): Append the original file extension to the cache
+            file name.
+        (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory): Add extension parameter.
+        * loader/appcache/ApplicationCacheStorage.h:
+
+2011-06-02  Lucas Forschler  <[email protected]>
+
     Merged 87703.
 
     2011-05-30  Jer Noble  <[email protected]>

Modified: branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (87970 => 87971)


--- branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2011-06-03 00:42:10 UTC (rev 87970)
+++ branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2011-06-03 00:44:14 UTC (rev 87971)
@@ -803,8 +803,16 @@
         
         String flatFileDirectory = pathByAppendingComponent(m_cacheDirectory, flatFileSubdirectory);
         makeAllDirectories(flatFileDirectory);
+
+        String extension;
+        
+        String fileName = resource->response().suggestedFilename();
+        size_t dotIndex = fileName.reverseFind('.');
+        if (dotIndex != notFound && dotIndex < (fileName.length() - 1))
+            extension = fileName.substring(dotIndex);
+
         String path;
-        if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path))
+        if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path, extension))
             return false;
         
         fullPath = pathByAppendingComponent(flatFileDirectory, path);
@@ -1231,12 +1239,12 @@
         || resource->response().mimeType().startsWith("video/", false);
 }
     
-bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path)
+bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path, const String& fileExtension)
 {
     String fullPath;
     
     do {
-        path = encodeForFileName(createCanonicalUUIDString());
+        path = encodeForFileName(createCanonicalUUIDString()) + fileExtension;
         // Guard against the above function being called on a platform which does not implement
         // createCanonicalUUIDString().
         ASSERT(!path.isEmpty());

Modified: branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.h (87970 => 87971)


--- branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2011-06-03 00:42:10 UTC (rev 87970)
+++ branches/safari-534-branch/Source/WebCore/loader/appcache/ApplicationCacheStorage.h	2011-06-03 00:44:14 UTC (rev 87971)
@@ -115,7 +115,7 @@
     bool ensureOriginRecord(const SecurityOrigin*);
     bool shouldStoreResourceAsFlatFile(ApplicationCacheResource*);
     void deleteTables();
-    bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename);
+    bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename, const String& fileExtension);
 
     void loadManifestHostHashes();
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to