Title: [219887] trunk/Source/WebKit
- Revision
- 219887
- Author
- [email protected]
- Date
- 2017-07-25 14:22:29 -0700 (Tue, 25 Jul 2017)
Log Message
Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
https://bugs.webkit.org/show_bug.cgi?id=174828
Reviewed by Tim Horton.
Send all of the sandbox extension handles in a single message, rather than
one message per extension. Update message name and parameter types to match.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
(WebKit::WebPageProxy::didChooseFilesForOpenPanel):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::extendSandboxForFilesFromOpenPanel):
(WebKit::WebPage::extendSandboxForFileFromOpenPanel): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (219886 => 219887)
--- trunk/Source/WebKit/ChangeLog 2017-07-25 21:12:13 UTC (rev 219886)
+++ trunk/Source/WebKit/ChangeLog 2017-07-25 21:22:29 UTC (rev 219887)
@@ -1,3 +1,22 @@
+2017-07-25 Brian Burg <[email protected]>
+
+ Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
+ https://bugs.webkit.org/show_bug.cgi?id=174828
+
+ Reviewed by Tim Horton.
+
+ Send all of the sandbox extension handles in a single message, rather than
+ one message per extension. Update message name and parameter types to match.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
+ (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::extendSandboxForFilesFromOpenPanel):
+ (WebKit::WebPage::extendSandboxForFileFromOpenPanel): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2017-07-25 Alex Christensen <[email protected]>
Fix API tests after r219871.
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (219886 => 219887)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-07-25 21:12:13 UTC (rev 219886)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-07-25 21:22:29 UTC (rev 219887)
@@ -4689,12 +4689,11 @@
return;
#if ENABLE(SANDBOX_EXTENSIONS)
- // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
- // is gated on a way of passing SandboxExtension::Handles in a Vector.
for (size_t i = 0; i < fileURLs.size(); ++i) {
- SandboxExtension::Handle sandboxExtensionHandle;
- SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
- m_process->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
+ SandboxExtension::HandleArray sandboxExtensionHandles;
+ sandboxExtensionHandles.allocate(fileURLs.size());
+ SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandles[i]);
+ m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
}
#endif
@@ -4711,11 +4710,10 @@
return;
#if ENABLE(SANDBOX_EXTENSIONS)
- // FIXME: The sandbox extensions should be sent with the DidChooseFilesForOpenPanel message. This
- // is gated on a way of passing SandboxExtension::Handles in a Vector.
for (size_t i = 0; i < fileURLs.size(); ++i) {
- SandboxExtension::Handle sandboxExtensionHandle;
- bool createdExtension = SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle);
+ SandboxExtension::HandleArray sandboxExtensionHandles;
+ sandboxExtensionHandles.allocate(fileURLs.size());
+ bool createdExtension = SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandles[i]);
if (!createdExtension) {
// This can legitimately fail if a directory containing the file is deleted after the file was chosen.
// We also have reports of cases where this likely fails for some unknown reason, <rdar://problem/10156710>.
@@ -4722,7 +4720,7 @@
WTFLogAlways("WebPageProxy::didChooseFilesForOpenPanel: could not create a sandbox extension for '%s'\n", fileURLs[i].utf8().data());
continue;
}
- m_process->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID);
+ m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (219886 => 219887)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-07-25 21:12:13 UTC (rev 219886)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-07-25 21:22:29 UTC (rev 219887)
@@ -3836,12 +3836,14 @@
}
#if ENABLE(SANDBOX_EXTENSIONS)
-void WebPage::extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle& handle)
+void WebPage::extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&& handles)
{
- bool result = SandboxExtension::consumePermanently(handle);
- if (!result) {
- // We have reports of cases where this fails for some unknown reason, <rdar://problem/10156710>.
- WTFLogAlways("WebPage::extendSandboxForFileFromOpenPanel(): Could not consume a sandbox extension");
+ for (size_t i = 0; i < handles.size(); ++i) {
+ bool result = SandboxExtension::consumePermanently(handles[i]);
+ if (!result) {
+ // We have reports of cases where this fails for some unknown reason, <rdar://problem/10156710>.
+ WTFLogAlways("WebPage::extendSandboxForFileFromOpenPanel(): Could not consume a sandbox extension");
+ }
}
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (219886 => 219887)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-07-25 21:12:13 UTC (rev 219886)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-07-25 21:22:29 UTC (rev 219887)
@@ -1178,7 +1178,7 @@
void didChooseFilesForOpenPanel(const Vector<String>&);
void didCancelForOpenPanel();
#if ENABLE(SANDBOX_EXTENSIONS)
- void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
+ void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
#endif
void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (219886 => 219887)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2017-07-25 21:12:13 UTC (rev 219886)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2017-07-25 21:22:29 UTC (rev 219887)
@@ -274,7 +274,7 @@
DidChooseFilesForOpenPanel(Vector<String> fileURLs)
DidCancelForOpenPanel()
#if ENABLE(SANDBOX_EXTENSIONS)
- ExtendSandboxForFileFromOpenPanel(WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+ ExtendSandboxForFilesFromOpenPanel(WebKit::SandboxExtension::HandleArray sandboxExtensions)
#endif
# Spelling and grammar.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes