WebKit2: create sandbox extensions for files that are dropped in an input control.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 00:12:22 +0000 (00:12 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 00:12:22 +0000 (00:12 +0000)
commit422c39b4b08816f04d91faf7c0a758808b37efbf
treee9cea9a91bf3fc3474160ef00d61203e3c60a5ea
parent5e3fefedd553c8c56468d2a3e5e259bfefcaffd6
WebKit2: create sandbox extensions for files that are dropped in an input control.
https://bugs.webkit.org/show_bug.cgi?id=81153
<rdar://problem/11031207>

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Now the pasteboard access is performed only in the UI process, it is
necessary to create sandbox extensions for each file that is dropped into
an input type=file element. The extensions are created at the time the files
are dropped and consumed immediately.

* page/DragActions.h: Added new drag action to be used by the WebDragClient.
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag): Added call to the drag client with the new action.

Source/WebKit/mac:

* WebCoreSupport/WebDragClient.mm:
(WebDragClient::willPerformDragDestinationAction): Avoid calling the delegate with the new drag action.
We want to avoid any unwanted side effects for the WebKit clients.

Source/WebKit2:

Now the pasteboard access is performed only in the UI process, it is
necessary to create sandbox extensions for each file that is dropped into
an input type=file element. The extensions are created at the time the files
are dropped and consumed immediately.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction): Added template that takes 8 arguments.
* Shared/SandboxExtension.h:
(HandleArray): Added new class to handle an array of sandbox extension handles.
(WebKit::SandboxExtension::HandleArray::HandleArray):
(WebKit::SandboxExtension::HandleArray::~HandleArray):
(WebKit::SandboxExtension::HandleArray::resize):
(WebKit::SandboxExtension::HandleArray::operator[]):
(WebKit::SandboxExtension::HandleArray::size):
(WebKit::SandboxExtension::HandleArray::encode):
(WebKit::SandboxExtension::HandleArray::decode):
* Shared/mac/SandboxExtensionMac.mm: Added new class implementation.
(WebKit::SandboxExtension::HandleArray::HandleArray):
(WebKit::SandboxExtension::HandleArray::~HandleArray):
(WebKit::SandboxExtension::HandleArray::resize):
(WebKit::SandboxExtension::HandleArray::operator[]):
(WebKit::SandboxExtension::HandleArray::size):
(WebKit::SandboxExtension::HandleArray::encode):
(WebKit::SandboxExtension::HandleArray::decode):
* UIProcess/API/mac/WKView.mm:
(createSandboxExtensionsForFileUpload):
(-[WKView performDragOperation:]): Added logic to create the sandbox extensions for each
file/directory being dropped.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::dragEntered):
(WebKit::WebPageProxy::dragUpdated):
(WebKit::WebPageProxy::dragExited):
(WebKit::WebPageProxy::performDrag):
(WebKit::WebPageProxy::performDragControllerAction): Added the handle array parameter.
* UIProcess/WebPageProxy.h:
* UIProcess/qt/QtWebPageEventHandler.cpp:
(QtWebPageEventHandler::handleDropEvent):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::Drop):
* WebProcess/WebCoreSupport/WebDragClient.cpp:
(WebKit::WebDragClient::willPerformDragDestinationAction): Added handling of the new DragActionUpload.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getPathnamesForType): Implemented using message to the UI process.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):
(WebKit::WebPage::performUploadDragDestinationAction): Added method that consumes the received extensions.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/DragActions.h
Source/WebCore/page/DragController.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebDragClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/HandleMessage.h
Source/WebKit2/Shared/SandboxExtension.h
Source/WebKit2/Shared/mac/SandboxExtensionMac.mm
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
Source/WebKit2/UIProcess/win/WebView.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in