Skip to content
  • enrica@apple.com's avatar
    WebKit2: create sandbox extensions for files that are dropped in an input control. · 4fbcba29
    enrica@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@111276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    4fbcba29