Title: [211525] tags/Safari-603.1.23.1

Diff

Modified: tags/Safari-603.1.23.1/Source/WebCore/ChangeLog (211524 => 211525)


--- tags/Safari-603.1.23.1/Source/WebCore/ChangeLog	2017-02-01 21:49:50 UTC (rev 211524)
+++ tags/Safari-603.1.23.1/Source/WebCore/ChangeLog	2017-02-01 21:49:53 UTC (rev 211525)
@@ -1,3 +1,26 @@
+2017-02-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211502. rdar://problem/30298722
+
+    2017-02-01  Brent Fulgham  <bfulg...@apple.com>
+
+            Correct "filesHaveSameVolume" predicate
+            https://bugs.webkit.org/show_bug.cgi?id=167696
+            <rdar://problem/30298722>
+
+            Reviewed by David Kilzer.
+
+            We are passing %-encoded strings to the underlying operating system's file system APIs.
+            This doesn't work. Instead, we need to present a decoded version of the file path
+            that matches what the system APIs expect.
+
+            Tested by new TestWebKitAPI Test.
+
+            * platform/FileSystem.cpp:
+            (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
+            operating system are not percent encoded.
+            * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
+
 2017-01-27  Ryan Haddad  <ryanhad...@apple.com>
 
         Merge r211285.

Modified: tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.cpp (211524 => 211525)


--- tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.cpp	2017-02-01 21:49:50 UTC (rev 211524)
+++ tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.cpp	2017-02-01 21:49:53 UTC (rev 211525)
@@ -28,6 +28,7 @@
 #include "FileSystem.h"
 
 #include "ScopeGuard.h"
+#include "URL.h"
 #include <wtf/HexNumber.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
@@ -236,8 +237,8 @@
     
 bool filesHaveSameVolume(const String& fileA, const String& fileB)
 {
-    auto fsRepFileA = fileSystemRepresentation(fileA);
-    auto fsRepFileB = fileSystemRepresentation(fileB);
+    auto fsRepFileA = fileSystemRepresentation(decodeURLEscapeSequences(fileA));
+    auto fsRepFileB = fileSystemRepresentation(decodeURLEscapeSequences(fileB));
     
     if (fsRepFileA.isNull() || fsRepFileB.isNull())
         return false;

Modified: tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.h (211524 => 211525)


--- tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.h	2017-02-01 21:49:50 UTC (rev 211524)
+++ tags/Safari-603.1.23.1/Source/WebCore/platform/FileSystem.h	2017-02-01 21:49:53 UTC (rev 211525)
@@ -194,7 +194,7 @@
 WEBCORE_EXPORT String encodeForFileName(const String&);
 String decodeFromFilename(const String&);
 
-bool filesHaveSameVolume(const String&, const String&);
+WEBCORE_EXPORT bool filesHaveSameVolume(const String&, const String&);
 
 #if USE(CF)
 RetainPtr<CFURLRef> pathAsURL(const String&);

Modified: tags/Safari-603.1.23.1/Tools/ChangeLog (211524 => 211525)


--- tags/Safari-603.1.23.1/Tools/ChangeLog	2017-02-01 21:49:50 UTC (rev 211524)
+++ tags/Safari-603.1.23.1/Tools/ChangeLog	2017-02-01 21:49:53 UTC (rev 211525)
@@ -1,3 +1,24 @@
+2017-02-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r211502. rdar://problem/30298722
+
+    2017-02-01  Brent Fulgham  <bfulg...@apple.com>
+
+            Correct "filesHaveSameVolume" predicate
+            https://bugs.webkit.org/show_bug.cgi?id=167696
+            <rdar://problem/30298722>
+
+            Reviewed by David Kilzer.
+
+            Add new tests that confirm that the 'filesHaveSamePath' predicate properly handles
+            percent-escaped path inputs.
+
+            * TestWebKitAPI/Tests/WebCore/FileSystem.cpp:
+            (TestWebKitAPI::FileSystemTest::spaceContainingFilePath):
+            (TestWebKitAPI::FileSystemTest::bangContainingFilePath):
+            (TestWebKitAPI::FileSystemTest::quoteContainingFilePath):
+            (TestWebKitAPI::TEST_F):
+
 2017-01-25  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r211137. rdar://problem/29896656

Modified: tags/Safari-603.1.23.1/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp (211524 => 211525)


--- tags/Safari-603.1.23.1/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp	2017-02-01 21:49:50 UTC (rev 211524)
+++ tags/Safari-603.1.23.1/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp	2017-02-01 21:49:53 UTC (rev 211525)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 Canon Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +28,7 @@
 
 #include "Test.h"
 #include <WebCore/FileSystem.h>
+#include <WebCore/URL.h>
 #include <wtf/MainThread.h>
 #include <wtf/StringExtras.h>
 
@@ -50,21 +52,39 @@
         closeFile(handle); 
 
         m_tempEmptyFilePath = openTemporaryFile("tempEmptyTestFile", handle);
-        closeFile(handle); 
-    }
+        closeFile(handle);
 
+        m_spaceContainingFilePath = encodeWithURLEscapeSequences(openTemporaryFile("temp Empty Test File", handle));
+        closeFile(handle);
+
+        m_bangContainingFilePath = encodeWithURLEscapeSequences(openTemporaryFile("temp!Empty!Test!File", handle));
+        closeFile(handle);
+
+        m_quoteContainingFilePath = encodeWithURLEscapeSequences(openTemporaryFile("temp\"Empty\"TestFile", handle));
+        closeFile(handle);
+}
+
     void TearDown() override
     {
         deleteFile(m_tempFilePath);
         deleteFile(m_tempEmptyFilePath);
+        deleteFile(m_spaceContainingFilePath);
+        deleteFile(m_bangContainingFilePath);
+        deleteFile(m_quoteContainingFilePath);
     }
 
     const String& tempFilePath() { return m_tempFilePath; }
     const String& tempEmptyFilePath() { return m_tempEmptyFilePath; }
+    const String& spaceContainingFilePath() { return m_spaceContainingFilePath; }
+    const String& bangContainingFilePath() { return m_bangContainingFilePath; }
+    const String& quoteContainingFilePath() { return m_quoteContainingFilePath; }
 
 private:
     String m_tempFilePath;
     String m_tempEmptyFilePath;
+    String m_spaceContainingFilePath;
+    String m_bangContainingFilePath;
+    String m_quoteContainingFilePath;
 };
 
 TEST_F(FileSystemTest, MappingMissingFile)
@@ -93,4 +113,11 @@
     EXPECT_TRUE(!mappedFileData);
 }
 
+TEST_F(FileSystemTest, FilesHaveSameVolume)
+{
+    EXPECT_TRUE(filesHaveSameVolume(tempFilePath(), spaceContainingFilePath()));
+    EXPECT_TRUE(filesHaveSameVolume(spaceContainingFilePath(), bangContainingFilePath()));
+    EXPECT_TRUE(filesHaveSameVolume(bangContainingFilePath(), quoteContainingFilePath()));
 }
+
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to