Modified: trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig (276905 => 276906)
--- trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig 2021-05-03 17:13:14 UTC (rev 276905)
+++ trunk/Source/_javascript_Core/Configurations/_javascript_Core.xcconfig 2021-05-03 17:23:25 UTC (rev 276906)
@@ -27,7 +27,7 @@
MODULEMAP_FILE = $(SRCROOT)/_javascript_Core.modulemap;
// Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols.
-OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol,__ZTISt9bad_alloc -Wl,-unexported_symbol,__ZTISt9exception -Wl,-unexported_symbol,__ZTSSt9bad_alloc -Wl,-unexported_symbol,__ZTSSt9exception -Wl,-unexported_symbol,__ZdlPvS_ -Wl,-unexported_symbol,__ZnwmPv -Wl,-unexported_symbol,__ZNKSt3__18functionIFvvEEclEv -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC1EOS2_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC2EOS2_ -Wl,-unexported_symbol,__ZNKSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEEclES3_S5_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED2Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED2Ev -Wl,-unexported_symbol,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE11__range_endES4
_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE13__range_beginES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceIPKcEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_;
+OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol,__ZTISt9bad_alloc -Wl,-unexported_symbol,__ZTISt9exception -Wl,-unexported_symbol,__ZTSSt9bad_alloc -Wl,-unexported_symbol,__ZTSSt9exception -Wl,-unexported_symbol,__ZdlPvS_ -Wl,-unexported_symbol,__ZnwmPv -Wl,-unexported_symbol,__ZNKSt3__18functionIFvvEEclEv -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC1EOS2_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC2EOS2_ -Wl,-unexported_symbol,__ZNKSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEEclES3_S5_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED2Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED2Ev -Wl,-unexported_symbol,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE11__range_endES4_
-Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIPKcS4_cLb1EE13__range_beginES4_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr27__is_cpp17_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceIPKcEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE14__append_rangeIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES8_S8_ -Wl,-unexported_symbol,__ZNKSt3__14__fs10filesystem18directory_iteratordeEv -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem18directory_iteratorppEv -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24__is_pathable_char_arrayIA10_cPccLb1EE11__range_endEPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem24
__is_pathable_char_arrayIA10_cPccLb1EE13__range_beginEPKc -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem4pathdVERKS2_ -Wl,-unexported_symbol,__ZNSt3__14__fs10filesystem8_PathCVTIcE15__append_sourceIA10_cEEvRNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKT_;
OTHER_LDFLAGS_BASE = $(OTHER_LDFLAGS_HIDE_SYMBOLS) -force_load "$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/libWTF.a";
OTHER_LDFLAGS[sdk=embedded*] = $(inherited) $(OTHER_LDFLAGS_BASE);
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp (276905 => 276906)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2021-05-03 17:13:14 UTC (rev 276905)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp 2021-05-03 17:23:25 UTC (rev 276906)
@@ -223,6 +223,13 @@
EXPECT_FALSE(FileSystem::deleteFile(tempFilePath()));
}
+TEST_F(FileSystemTest, deleteFileOnEmptyDirectory)
+{
+ EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
+ EXPECT_FALSE(FileSystem::deleteFile(tempEmptyFolderPath()));
+ EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
+}
+
TEST_F(FileSystemTest, deleteEmptyDirectory)
{
EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
@@ -231,6 +238,64 @@
EXPECT_FALSE(FileSystem::deleteEmptyDirectory(tempEmptyFolderPath()));
}
+#if PLATFORM(MAC)
+TEST_F(FileSystemTest, deleteEmptyDirectoryContainingDSStoreFile)
+{
+ EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
+
+ // Create .DSStore file.
+ auto dsStorePath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), ".DS_Store");
+ auto dsStoreHandle = FileSystem::openFile(dsStorePath, FileSystem::FileOpenMode::Write);
+ FileSystem::writeToFile(dsStoreHandle, FileSystemTestData, strlen(FileSystemTestData));
+ FileSystem::closeFile(dsStoreHandle);
+ EXPECT_TRUE(FileSystem::fileExists(dsStorePath));
+
+ EXPECT_TRUE(FileSystem::deleteEmptyDirectory(tempEmptyFolderPath()));
+ EXPECT_FALSE(FileSystem::fileExists(tempEmptyFolderPath()));
+}
+#endif
+
+TEST_F(FileSystemTest, deleteEmptyDirectoryOnNonEmptyDirectory)
+{
+ EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
+
+ // Create .DSStore file.
+ auto dsStorePath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), ".DS_Store");
+ auto dsStoreHandle = FileSystem::openFile(dsStorePath, FileSystem::FileOpenMode::Write);
+ FileSystem::writeToFile(dsStoreHandle, FileSystemTestData, strlen(FileSystemTestData));
+ FileSystem::closeFile(dsStoreHandle);
+ EXPECT_TRUE(FileSystem::fileExists(dsStorePath));
+
+ // Create a dummy file.
+ auto dummyFilePath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "dummyFile");
+ auto dummyFileHandle = FileSystem::openFile(dummyFilePath, FileSystem::FileOpenMode::Write);
+ FileSystem::writeToFile(dummyFileHandle, FileSystemTestData, strlen(FileSystemTestData));
+ FileSystem::closeFile(dummyFileHandle);
+ EXPECT_TRUE(FileSystem::fileExists(dummyFilePath));
+
+ EXPECT_FALSE(FileSystem::deleteEmptyDirectory(tempEmptyFolderPath()));
+ EXPECT_TRUE(FileSystem::fileExists(tempEmptyFolderPath()));
+ EXPECT_TRUE(FileSystem::fileExists(dsStorePath));
+ EXPECT_TRUE(FileSystem::fileExists(dummyFilePath));
+
+ EXPECT_TRUE(FileSystem::deleteNonEmptyDirectory(tempEmptyFolderPath()));
+ EXPECT_FALSE(FileSystem::fileExists(tempEmptyFolderPath()));
+}
+
+TEST_F(FileSystemTest, deleteEmptyDirectoryOnARegularFile)
+{
+ EXPECT_TRUE(FileSystem::fileExists(tempFilePath()));
+ EXPECT_FALSE(FileSystem::deleteEmptyDirectory(tempFilePath()));
+ EXPECT_TRUE(FileSystem::fileExists(tempFilePath()));
+}
+
+TEST_F(FileSystemTest, deleteEmptyDirectoryDoesNotExist)
+{
+ auto doesNotExistPath = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "does-not-exist");
+ EXPECT_FALSE(FileSystem::fileExists(doesNotExistPath));
+ EXPECT_FALSE(FileSystem::deleteEmptyDirectory(doesNotExistPath));
+}
+
TEST_F(FileSystemTest, moveFile)
{
auto destination = FileSystem::pathByAppendingComponent(tempEmptyFolderPath(), "tempFile-moved");