Title: [182932] trunk/Source
Revision
182932
Author
beid...@apple.com
Date
2015-04-16 17:53:19 -0700 (Thu, 16 Apr 2015)

Log Message

Compiling a content extension fails when user's home directory is on a different volume from /var/tmp.
https://bugs.webkit.org/show_bug.cgi?id=143834

Reviewed by Anders Carlsson.

Source/WebCore:

- Add moveFile() for a WK2 call site to use.
- Remove renameFile() as it is now dead code.

* platform/FileSystem.h:

* platform/gtk/FileSystemGtk.cpp:
(WebCore::renameFile): Deleted.

* platform/mac/FileSystemMac.mm:
(WebCore::moveFile):

* platform/posix/FileSystemPOSIX.cpp:
(WebCore::renameFile): Deleted.

* platform/win/FileSystemWin.cpp:
(WebCore::renameFile): Deleted.

Source/WebKit2:

* UIProcess/API/APIUserContentExtensionStore.cpp:
(API::compiledToFile): Use moveFile() instead of renameFile()

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (182931 => 182932)


--- trunk/Source/WebCore/ChangeLog	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/ChangeLog	2015-04-17 00:53:19 UTC (rev 182932)
@@ -1,3 +1,27 @@
+2015-04-16  Brady Eidson  <beid...@apple.com>
+
+        Compiling a content extension fails when user's home directory is on a different volume from /var/tmp.
+        https://bugs.webkit.org/show_bug.cgi?id=143834
+
+        Reviewed by Anders Carlsson.
+
+        - Add moveFile() for a WK2 call site to use.
+        - Remove renameFile() as it is now dead code.
+
+        * platform/FileSystem.h:
+
+        * platform/gtk/FileSystemGtk.cpp:
+        (WebCore::renameFile): Deleted.
+
+        * platform/mac/FileSystemMac.mm:
+        (WebCore::moveFile):
+
+        * platform/posix/FileSystemPOSIX.cpp:
+        (WebCore::renameFile): Deleted.
+
+        * platform/win/FileSystemWin.cpp:
+        (WebCore::renameFile): Deleted.
+
 2015-04-16  Roger Fong  <roger_f...@apple.com>
 
         Media element time displays shouldn't wrap.

Modified: trunk/Source/WebCore/platform/FileSystem.h (182931 => 182932)


--- trunk/Source/WebCore/platform/FileSystem.h	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/platform/FileSystem.h	2015-04-17 00:53:19 UTC (rev 182932)
@@ -137,7 +137,7 @@
 WEBCORE_EXPORT bool fileExists(const String&);
 WEBCORE_EXPORT bool deleteFile(const String&);
 WEBCORE_EXPORT bool deleteEmptyDirectory(const String&);
-WEBCORE_EXPORT bool renameFile(const String& oldPath, const String& newPath);
+WEBCORE_EXPORT bool moveFile(const String& oldPath, const String& newPath);
 WEBCORE_EXPORT bool getFileSize(const String&, long long& result);
 WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result);
 WEBCORE_EXPORT bool getFileModificationTime(const String&, time_t& result);

Modified: trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp (182931 => 182932)


--- trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp	2015-04-17 00:53:19 UTC (rev 182932)
@@ -111,12 +111,6 @@
     return filename ? g_rmdir(filename.get()) != -1 : false;
 }
 
-bool renameFile(const String&, const String&)
-{
-    notImplemented();
-    return false;
-}
-
 static bool getFileStat(const String& path, GStatBuf* statBuffer)
 {
     GUniquePtr<gchar> filename = unescapedFilename(path);

Modified: trunk/Source/WebCore/platform/mac/FileSystemMac.mm (182931 => 182932)


--- trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2015-04-17 00:53:19 UTC (rev 182932)
@@ -67,6 +67,11 @@
     return String::fromUTF8(temporaryFilePath.data());
 }
 
+bool moveFile(const String& oldPath, const String& newPath)
+{
+    return [[NSFileManager defaultManager] moveItemAtURL:[NSURL fileURLWithPath:oldPath] toURL:[NSURL fileURLWithPath:newPath] error:nil];
+}
+
 #if !PLATFORM(IOS)
 
 void setMetadataURL(String& URLString, const String& referrer, const String& path)

Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (182931 => 182932)


--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp	2015-04-17 00:53:19 UTC (rev 182932)
@@ -71,19 +71,6 @@
     return !unlink(fsRep.data());
 }
 
-bool renameFile(const String& oldPath, const String& newPath)
-{
-    CString oldPathFsRep = fileSystemRepresentation(oldPath);
-    if (!oldPathFsRep.data() || oldPathFsRep.data()[0] == '\0')
-        return false;
-
-    CString newPathFsRep = fileSystemRepresentation(newPath);
-    if (!newPathFsRep.data() || newPathFsRep.data()[0] == '\0')
-        return false;
-
-    return !rename(oldPathFsRep.data(), newPathFsRep.data());
-}
-
 PlatformFileHandle openFile(const String& path, FileOpenMode mode)
 {
     CString fsRep = fileSystemRepresentation(path);

Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (182931 => 182932)


--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp	2015-04-17 00:53:19 UTC (rev 182932)
@@ -176,19 +176,6 @@
     return !!RemoveDirectoryW(filename.charactersWithNullTermination().data());
 }
 
-bool renameFile(const String& oldPath, const String& newPath)
-{
-    CString oldPathFsRep = fileSystemRepresentation(oldPath);
-    if (!oldPathFsRep.data() || oldPathFsRep.data()[0] == '\0')
-        return false;
-
-    CString newPathFsRep = fileSystemRepresentation(newPath);
-    if (!newPathFsRep.data() || newPathFsRep.data()[0] == '\0')
-        return false;
-
-    return ::MoveFileA(oldPathFsRep.data(), newPathFsRep.data());
-}
-
 String pathByAppendingComponent(const String& path, const String& component)
 {
     Vector<UChar> buffer(MAX_PATH);

Modified: trunk/Source/WebKit2/ChangeLog (182931 => 182932)


--- trunk/Source/WebKit2/ChangeLog	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-17 00:53:19 UTC (rev 182932)
@@ -1,3 +1,13 @@
+2015-04-16  Brady Eidson  <beid...@apple.com>
+
+        Compiling a content extension fails when user's home directory is on a different volume from /var/tmp.
+        https://bugs.webkit.org/show_bug.cgi?id=143834
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/APIUserContentExtensionStore.cpp:
+        (API::compiledToFile): Use moveFile() instead of renameFile()
+
 2015-04-16  Anders Carlsson  <ander...@apple.com>
 
         Deprecate _WKWebsiteDataStore in favor of WKWebsiteDataStore

Modified: trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp (182931 => 182932)


--- trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp	2015-04-17 00:49:11 UTC (rev 182931)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp	2015-04-17 00:53:19 UTC (rev 182932)
@@ -225,7 +225,7 @@
     if (mappedData.isNull())
         return UserContentExtensionStore::Error::CompileFailed;
 
-    if (!WebCore::renameFile(temporaryFilePath, finalFilePath))
+    if (!WebCore::moveFile(temporaryFilePath, finalFilePath))
         return UserContentExtensionStore::Error::CompileFailed;
 
     return { };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to