Title: [217923] trunk
- Revision
- 217923
- Author
- [email protected]
- Date
- 2017-06-07 22:02:48 -0700 (Wed, 07 Jun 2017)
Log Message
Source/WebKit2:
[Cocoa] additionalReadAccessAllowedURLs doesn’t preserve non-Latin-1 paths
https://bugs.webkit.org/show_bug.cgi?id=173086
Reviewed by Andy Estes.
We were incorrectly passing the fileSystemRepresentation of an NSURL into the WTF::String
constructor that expects a Latin-1 string. However, in general, fileSystemRepresentation is
not Latin-1.
* UIProcess/API/APIProcessPoolConfiguration.h: Changed m_additionalReadAccessAllowedPaths
from a Vector<WTF::String> into a Vector<WTF::CString>.
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): Updated for the change.
(-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): Ditto.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Ditto.
Tools:
[Cocoa] additionalReadAccessAllowedURLs doesn’t preserve non-Latin1 paths
https://bugs.webkit.org/show_bug.cgi?id=173086
Reviewed by Andy Estes.
* TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (217922 => 217923)
--- trunk/Source/WebKit2/ChangeLog 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-08 05:02:48 UTC (rev 217923)
@@ -1,3 +1,24 @@
+2017-06-07 Dan Bernstein <[email protected]>
+
+ [Cocoa] additionalReadAccessAllowedURLs doesn’t preserve non-Latin-1 paths
+ https://bugs.webkit.org/show_bug.cgi?id=173086
+
+ Reviewed by Andy Estes.
+
+ We were incorrectly passing the fileSystemRepresentation of an NSURL into the WTF::String
+ constructor that expects a Latin-1 string. However, in general, fileSystemRepresentation is
+ not Latin-1.
+
+ * UIProcess/API/APIProcessPoolConfiguration.h: Changed m_additionalReadAccessAllowedPaths
+ from a Vector<WTF::String> into a Vector<WTF::CString>.
+
+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+ (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): Updated for the change.
+ (-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): Ditto.
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Ditto.
+
2017-06-07 Ryosuke Niwa <[email protected]>
Crash inside WebKit::PluginView::getAuthenticationInfo
Modified: trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h (217922 => 217923)
--- trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h 2017-06-08 05:02:48 UTC (rev 217923)
@@ -31,6 +31,7 @@
#include "WebsiteDataStore.h"
#include <wtf/Ref.h>
#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
namespace API {
@@ -99,8 +100,8 @@
const Vector<WTF::String>& alwaysRevalidatedURLSchemes() { return m_alwaysRevalidatedURLSchemes; }
void setAlwaysRevalidatedURLSchemes(Vector<WTF::String>&& alwaysRevalidatedURLSchemes) { m_alwaysRevalidatedURLSchemes = WTFMove(alwaysRevalidatedURLSchemes); }
- const Vector<WTF::String>& additionalReadAccessAllowedPaths() { return m_additionalReadAccessAllowedPaths; }
- void setAdditionalReadAccessAllowedPaths(Vector<WTF::String>&& additionalReadAccessAllowedPaths) { m_additionalReadAccessAllowedPaths = additionalReadAccessAllowedPaths; }
+ const Vector<WTF::CString>& additionalReadAccessAllowedPaths() { return m_additionalReadAccessAllowedPaths; }
+ void setAdditionalReadAccessAllowedPaths(Vector<WTF::CString>&& additionalReadAccessAllowedPaths) { m_additionalReadAccessAllowedPaths = additionalReadAccessAllowedPaths; }
bool fullySynchronousModeIsAllowedForTesting() const { return m_fullySynchronousModeIsAllowedForTesting; }
void setFullySynchronousModeIsAllowedForTesting(bool allowed) { m_fullySynchronousModeIsAllowedForTesting = allowed; }
@@ -158,7 +159,7 @@
WTF::String m_javaScriptConfigurationDirectory;
Vector<WTF::String> m_cachePartitionedURLSchemes;
Vector<WTF::String> m_alwaysRevalidatedURLSchemes;
- Vector<WTF::String> m_additionalReadAccessAllowedPaths;
+ Vector<WTF::CString> m_additionalReadAccessAllowedPaths;
bool m_fullySynchronousModeIsAllowedForTesting { false };
bool m_ignoreSynchronousMessagingTimeoutsForTesting { false };
Vector<WTF::String> m_overrideLanguages;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (217922 => 217923)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm 2017-06-08 05:02:48 UTC (rev 217923)
@@ -110,7 +110,7 @@
NSMutableArray *urls = [NSMutableArray arrayWithCapacity:paths.size()];
for (const auto& path : paths)
- [urls addObject:[NSURL fileURLWithPath:path]];
+ [urls addObject:[NSURL fileURLWithFileSystemRepresentation:path.data() isDirectory:NO relativeToURL:nil]];
return urls;
}
@@ -117,7 +117,7 @@
- (void)setAdditionalReadAccessAllowedURLs:(NSArray<NSURL *> *)additionalReadAccessAllowedURLs
{
- Vector<String> paths;
+ Vector<CString> paths;
paths.reserveInitialCapacity(additionalReadAccessAllowedURLs.count);
for (NSURL *url in additionalReadAccessAllowedURLs) {
if (!url.isFileURL)
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (217922 => 217923)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2017-06-08 05:02:48 UTC (rev 217923)
@@ -625,7 +625,7 @@
m_resolvedPaths.additionalWebProcessSandboxExtensionPaths.reserveCapacity(m_configuration->additionalReadAccessAllowedPaths().size());
for (const auto& path : m_configuration->additionalReadAccessAllowedPaths())
- m_resolvedPaths.additionalWebProcessSandboxExtensionPaths.uncheckedAppend(resolvePathForSandboxExtension(path));
+ m_resolvedPaths.additionalWebProcessSandboxExtensionPaths.uncheckedAppend(resolvePathForSandboxExtension(path.data()));
platformResolvePathsForSandboxExtensions();
}
Modified: trunk/Tools/ChangeLog (217922 => 217923)
--- trunk/Tools/ChangeLog 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Tools/ChangeLog 2017-06-08 05:02:48 UTC (rev 217923)
@@ -1,3 +1,13 @@
+2017-06-07 Dan Bernstein <[email protected]>
+
+ [Cocoa] additionalReadAccessAllowedURLs doesn’t preserve non-Latin1 paths
+ https://bugs.webkit.org/show_bug.cgi?id=173086
+
+ Reviewed by Andy Estes.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm:
+ (TEST):
+
2017-06-07 Alexey Proskuryakov <[email protected]>
Add High Sierra support to WebKit tools
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm (217922 => 217923)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm 2017-06-08 04:46:34 UTC (rev 217922)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm 2017-06-08 05:02:48 UTC (rev 217923)
@@ -56,6 +56,10 @@
}
EXPECT_TRUE(exceptionRaised);
+ NSURL *fileURLWithNonLatin1Path = [NSURL fileURLWithPath:@"/这是中文"];
+ processPoolConfiguration.additionalReadAccessAllowedURLs = @[ fileURLWithNonLatin1Path ];
+ EXPECT_TRUE([processPoolConfiguration.additionalReadAccessAllowedURLs.firstObject isEqual:fileURLWithNonLatin1Path]);
+
char temporaryDirectory[PATH_MAX];
confstr(_CS_DARWIN_USER_TEMP_DIR, temporaryDirectory, sizeof(temporaryDirectory));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes