Diff
Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211521 => 211522)
--- branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:51 UTC (rev 211521)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:55 UTC (rev 211522)
@@ -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-31 Matthew Hanson <matthew_han...@apple.com>
Merge r211387. rdar://problem/29500273
Modified: branches/safari-603-branch/Source/WebCore/platform/FileSystem.cpp (211521 => 211522)
--- branches/safari-603-branch/Source/WebCore/platform/FileSystem.cpp 2017-02-01 21:26:51 UTC (rev 211521)
+++ branches/safari-603-branch/Source/WebCore/platform/FileSystem.cpp 2017-02-01 21:26:55 UTC (rev 211522)
@@ -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: branches/safari-603-branch/Source/WebCore/platform/FileSystem.h (211521 => 211522)
--- branches/safari-603-branch/Source/WebCore/platform/FileSystem.h 2017-02-01 21:26:51 UTC (rev 211521)
+++ branches/safari-603-branch/Source/WebCore/platform/FileSystem.h 2017-02-01 21:26:55 UTC (rev 211522)
@@ -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: branches/safari-603-branch/Tools/ChangeLog (211521 => 211522)
--- branches/safari-603-branch/Tools/ChangeLog 2017-02-01 21:26:51 UTC (rev 211521)
+++ branches/safari-603-branch/Tools/ChangeLog 2017-02-01 21:26:55 UTC (rev 211522)
@@ -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-31 Matthew Hanson <matthew_han...@apple.com>
Merge r211240. rdar://problem/30247467b
Modified: branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp (211521 => 211522)
--- branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp 2017-02-01 21:26:51 UTC (rev 211521)
+++ branches/safari-603-branch/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp 2017-02-01 21:26:55 UTC (rev 211522)
@@ -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()));
}
+
+}