Title: [219952] trunk/Source/WebKit
Revision
219952
Author
[email protected]
Date
2017-07-26 11:32:45 -0700 (Wed, 26 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.

In the previous change I forgot to hoist the HandleArray and message-send out of the
loop, so the code wasn't actually sending fewer messages. That's fixed now.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
(WebKit::WebPageProxy::didChooseFilesForOpenPanel):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (219951 => 219952)


--- trunk/Source/WebKit/ChangeLog	2017-07-26 18:31:02 UTC (rev 219951)
+++ trunk/Source/WebKit/ChangeLog	2017-07-26 18:32:45 UTC (rev 219952)
@@ -1,3 +1,17 @@
+2017-07-26  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.
+
+        In the previous change I forgot to hoist the HandleArray and message-send out of the
+        loop, so the code wasn't actually sending fewer messages. That's fixed now.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
+        (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
+
 2017-07-26  Zan Dobersek  <[email protected]>
 
         Unreviewed. Fix a compiler warning that springs up when

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (219951 => 219952)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-07-26 18:31:02 UTC (rev 219951)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-07-26 18:32:45 UTC (rev 219952)
@@ -4689,12 +4689,12 @@
         return;
 
 #if ENABLE(SANDBOX_EXTENSIONS)
-    for (size_t i = 0; i < fileURLs.size(); ++i) {
-        SandboxExtension::HandleArray sandboxExtensionHandles;
-        sandboxExtensionHandles.allocate(fileURLs.size());
+    SandboxExtension::HandleArray sandboxExtensionHandles;
+    sandboxExtensionHandles.allocate(fileURLs.size());
+    for (size_t i = 0; i < fileURLs.size(); ++i)
         SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandles[i]);
-        m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
-    }
+
+    m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
 #endif
 
     m_process->send(Messages::WebPage::DidChooseFilesForOpenPanelWithDisplayStringAndIcon(fileURLs, displayString, iconData ? iconData->dataReference() : IPC::DataReference()), m_pageID);
@@ -4710,9 +4710,9 @@
         return;
 
 #if ENABLE(SANDBOX_EXTENSIONS)
+    SandboxExtension::HandleArray sandboxExtensionHandles;
+    sandboxExtensionHandles.allocate(fileURLs.size());
     for (size_t i = 0; i < fileURLs.size(); ++i) {
-        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.
@@ -4720,8 +4720,9 @@
             WTFLogAlways("WebPageProxy::didChooseFilesForOpenPanel: could not create a sandbox extension for '%s'\n", fileURLs[i].utf8().data());
             continue;
         }
-        m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
     }
+
+    m_process->send(Messages::WebPage::ExtendSandboxForFilesFromOpenPanel(sandboxExtensionHandles), m_pageID);
 #endif
 
     m_process->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to