Commit 4fbcba29 authored by enrica@apple.com's avatar enrica@apple.com

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: http://svn.webkit.org/repository/webkit/trunk@111276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 74b7ae6f
2012-03-19 Enrica Casucci <enrica@apple.com>
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.
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.
2012-03-19 Eric Seidel <eric@webkit.org>
Fix Chromium Win
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -36,6 +36,7 @@ namespace WebCore {
DragDestinationActionDHTML = 1,
DragDestinationActionEdit = 2,
DragDestinationActionLoad = 4,
DragDestinationActionUpload = 8, // This value is not part of WebDragDestinationAction. File upload is always allowed.
DragDestinationActionAny = UINT_MAX
} DragDestinationAction;
......
......@@ -470,6 +470,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
return false;
fileInput->receiveDroppedFiles(filenames);
m_client->willPerformDragDestinationAction(DragDestinationActionUpload, dragData);
return true;
}
......
2012-03-19 Enrica Casucci <enrica@apple.com>
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.
* 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.
2012-03-19 Emil A Eklund <eae@chromium.org>
[mac/chromium] Change platform code to use pixelSnappedRect methods
......
......@@ -70,6 +70,9 @@ WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(WebCore::DragDat
void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAction action, WebCore::DragData* dragData)
{
// This action is used only by WebKit2. We want to avoid any unwanted side effects for the WebKit clients, therefore we avoid the delegate call.
if (action == DragDestinationActionUpload)
return;
[[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:dragData->platformData()];
}
......
2012-03-19 Enrica Casucci <enrica@apple.com>
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.
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:
2012-03-19 Alexey Proskuryakov <ap@apple.com>
Make WebFrameLoaderClient::createFrame more like WebKit1 version.
......@@ -1422,7 +1480,6 @@
* Configurations/FeatureDefines.xcconfig:
>>>>>>> .r110352
2012-03-08 Jer Noble <jer.noble@apple.com>
Unreviewed Snow Leopard build fix.
......@@ -55,6 +55,12 @@ void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, C* o
(object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7);
}
template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
void callMemberFunction(const Arguments8<P1, P2, P3, P4, P5, P6, P7, P8>& args, C* object, MF function)
{
(object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, args.argument7, args.argument8);
}
template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10>
void callMemberFunction(const Arguments10<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>& args, C* object, MF function)
{
......
......@@ -68,6 +68,28 @@ public:
#endif
};
class HandleArray {
WTF_MAKE_NONCOPYABLE(HandleArray);
public:
HandleArray();
~HandleArray();
void allocate(size_t);
Handle& operator[](size_t i);
const Handle& operator[](size_t i) const;
size_t size() const;
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, HandleArray&);
private:
#if ENABLE(WEB_PROCESS_SANDBOX)
Handle* m_data;
#else
Handle m_emptyHandle;
#endif
size_t m_size;
};
static PassRefPtr<SandboxExtension> create(const Handle&);
static void createHandle(const String& path, Type type, Handle&);
static String createHandleForTemporaryFile(const String& prefix, Type type, Handle&);
......@@ -85,11 +107,20 @@ private:
#endif
};
#if !ENABLE(WEB_PROCESS_SANDBOX)
inline SandboxExtension::Handle::Handle() { }
inline SandboxExtension::Handle::~Handle() { }
inline void SandboxExtension::Handle::encode(CoreIPC::ArgumentEncoder*) const { }
inline bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder*, Handle&) { return true; }
inline SandboxExtension::HandleArray::HandleArray() { }
inline SandboxExtension::HandleArray::~HandleArray() { }
inline void SandboxExtension::HandleArray::allocate(size_t) { }
inline size_t SandboxExtension::HandleArray::size() const { return 0; }
inline const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) const { return m_emptyHandle; }
inline SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t) { return m_emptyHandle; }
inline void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder*) const { }
inline bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder*, HandleArray&) { return true; }
inline PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle&) { return 0; }
inline void SandboxExtension::createHandle(const String& path, Type type, Handle&) { }
inline String SandboxExtension::createHandleForTemporaryFile(const String& prefix, Type type, Handle&) {return String();}
......
......@@ -86,6 +86,66 @@ bool SandboxExtension::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle&
return true;
}
SandboxExtension::HandleArray::HandleArray()
: m_data(0)
, m_size(0)
{
}
SandboxExtension::HandleArray::~HandleArray()
{
if (m_data)
delete[] m_data;
}
void SandboxExtension::HandleArray::allocate(size_t size)
{
if (!size)
return;
ASSERT(!m_data);
m_data = new SandboxExtension::Handle[size];
m_size = size;
}
SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t i)
{
ASSERT(i < m_size);
return m_data[i];
}
const SandboxExtension::Handle& SandboxExtension::HandleArray::operator[](size_t i) const
{
ASSERT(i < m_size);
return m_data[i];
}
size_t SandboxExtension::HandleArray::size() const
{
return m_size;
}
void SandboxExtension::HandleArray::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encodeUInt64(size());
for (size_t i = 0; i < m_size; ++i)
encoder->encode(m_data[i]);
}
bool SandboxExtension::HandleArray::decode(CoreIPC::ArgumentDecoder* decoder, SandboxExtension::HandleArray& handles)
{
uint64_t size;
if (!decoder->decodeUInt64(size))
return false;
handles.allocate(size);
for (size_t i = 0; i < size; i++)
if (!decoder->decode(handles[i]))
return false;
return true;
}
PassRefPtr<SandboxExtension> SandboxExtension::create(const Handle& handle)
{
if (!handle.m_sandboxExtension)
......
......@@ -467,7 +467,8 @@ static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* con
return FALSE;
SandboxExtension::Handle handle;
webViewBase->priv->pageProxy->performDrag(dragData.get(), String(), handle);
SandboxExtension::HandleArray sandboxExtensionForUpload;
webViewBase->priv->pageProxy->performDrag(dragData.get(), String(), handle, sandboxExtensionForUpload);
gtk_drag_finish(context, TRUE, FALSE, time);
return TRUE;
}
......
......@@ -1686,6 +1686,23 @@ static bool maybeCreateSandboxExtensionFromPasteboard(NSPasteboard *pasteboard,
return true;
}
static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, SandboxExtension::HandleArray& handles)
{
NSArray *types = [pasteboard types];
if (![types containsObject:NSFilenamesPboardType])
return;
NSArray *files = [pasteboard propertyListForType:NSFilenamesPboardType];
handles.allocate([files count]);
for (unsigned i = 0; i < [files count]; i++) {
NSString *file = [files objectAtIndex:i];
if (![[NSFileManager defaultManager] fileExistsAtPath:file])
continue;
SandboxExtension::Handle handle;
SandboxExtension::createHandle(file, SandboxExtension::ReadOnly, handles[i]);
}
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)draggingInfo
{
IntPoint client([self convertPoint:[draggingInfo draggingLocation] fromView:nil]);
......@@ -1697,7 +1714,10 @@ static bool maybeCreateSandboxExtensionFromPasteboard(NSPasteboard *pasteboard,
if (createdExtension)
_data->_page->process()->willAcquireUniversalFileReadSandboxExtension();
_data->_page->performDrag(&dragData, [[draggingInfo draggingPasteboard] name], sandboxExtensionHandle);
SandboxExtension::HandleArray sandboxExtensionForUpload;
createSandboxExtensionsForFileUpload([draggingInfo draggingPasteboard], sandboxExtensionForUpload);
_data->_page->performDrag(&dragData, [[draggingInfo draggingPasteboard] name], sandboxExtensionHandle, sandboxExtensionForUpload);
return YES;
}
......
......@@ -864,27 +864,30 @@ void WebPageProxy::setViewportSize(const IntSize& size)
void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
{
SandboxExtension::Handle sandboxExtensionHandle;
performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle);
SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
performDragControllerAction(DragControllerActionEntered, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
}
void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
{
SandboxExtension::Handle sandboxExtensionHandle;
performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle);
SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
performDragControllerAction(DragControllerActionUpdated, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
}
void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
{
SandboxExtension::Handle sandboxExtensionHandle;
performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle);
SandboxExtension::HandleArray sandboxExtensionHandleEmptyArray;
performDragControllerAction(DragControllerActionExited, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionHandleEmptyArray);
}
void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle)
void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
{
performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle);
performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
}
void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle)
void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
{
if (!isValid())
return;
......@@ -895,7 +898,7 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag
#elif PLATFORM(QT) || PLATFORM(GTK)
process()->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
#else
process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle), m_pageID);
process()->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
#endif
}
......
......@@ -516,7 +516,7 @@ public:
void dragEntered(WebCore::DragData*, const String& dragStorageName = String());
void dragUpdated(WebCore::DragData*, const String& dragStorageName = String());
void dragExited(WebCore::DragData*, const String& dragStorageName = String());
void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
void didPerformDragControllerAction(WebCore::DragSession);
void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
......@@ -876,7 +876,7 @@ private:
void clearLoadDependentCallbacks();
void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
void updateBackingStoreDiscardableState();
......
......@@ -221,7 +221,8 @@ void QtWebPageEventHandler::handleDropEvent(QDropEvent* ev)
// FIXME: Should not use QCursor::pos()
DragData dragData(ev->mimeData(), fromItemTransform.map(ev->pos()), QCursor::pos(), dropActionToDragOperation(ev->possibleActions()));
SandboxExtension::Handle handle;
m_webPageProxy->performDrag(&dragData, String(), handle);
SandboxExtension::HandleArray sandboxExtensionForUpload;
m_webPageProxy->performDrag(&dragData, String(), handle, sandboxExtensionForUpload);
ev->setDropAction(dragOperationToDropAction(m_webPageProxy->dragSession().operation));
ev->accept();
......
......@@ -1738,7 +1738,8 @@ HRESULT STDMETHODCALLTYPE WebView::Drop(IDataObject* pDataObject, DWORD grfKeySt
bool createdExtension = maybeCreateSandboxExtensionFromDragData(data, sandboxExtensionHandle);
if (createdExtension)
m_page->process()->willAcquireUniversalFileReadSandboxExtension();
m_page->performDrag(&data, String(), sandboxExtensionHandle);
SandboxExtension::HandleArray sandboxExtensionForUpload;
m_page->performDrag(&data, String(), sandboxExtensionHandle, sandboxExtensionForUpload);
return S_OK;
}
......
......@@ -36,6 +36,8 @@ void WebDragClient::willPerformDragDestinationAction(DragDestinationAction actio
{
if (action == DragDestinationActionLoad)
m_page->willPerformLoadDragDestinationAction();
else if (action == DragDestinationActionUpload)
m_page->performUploadDragDestinationAction();
}
void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
......
......@@ -156,11 +156,8 @@ PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const Str
void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
{
// FIXME: this needs to be replaced with the code below, once we resolve the sandboxing issue.
// WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardPathnamesForType(pasteboardName, pasteboardType),
// Messages::WebContext::GetPasteboardPathnamesForType::Reply(pathnames), 0);
PlatformPasteboard(pasteboardName).getPathnamesForType(pathnames, pasteboardType);
WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardPathnamesForType(pasteboardName, pasteboardType),
Messages::WebContext::GetPasteboardPathnamesForType::Reply(pathnames), 0);
}
String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
......
......@@ -2103,7 +2103,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra
}
#else
void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags, const SandboxExtension::Handle& sandboxExtensionHandle)
void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsHandleArray)
{
if (!m_page) {
send(Messages::WebPageProxy::DidPerformDragControllerAction(WebCore::DragSession()));
......@@ -2128,6 +2128,8 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
ASSERT(!m_pendingDropSandboxExtension);
m_pendingDropSandboxExtension = SandboxExtension::create(sandboxExtensionHandle);
for (size_t i = 0; i < sandboxExtensionsHandleArray.size(); i++)
m_pendingDropExtensionsForFileUpload.append(SandboxExtension::create(sandboxExtensionsHandleArray[i]));
m_page->dragController()->performDrag(&dragData);
......@@ -2137,7 +2139,10 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
m_pendingDropSandboxExtension->invalidate();
m_pendingDropSandboxExtension = nullptr;
}
for (size_t i = 0; i < m_pendingDropExtensionsForFileUpload.size(); i++)
m_pendingDropExtensionsForFileUpload[i]->invalidate();
m_pendingDropExtensionsForFileUpload.clear();
break;
}
......@@ -2166,6 +2171,13 @@ void WebPage::willPerformLoadDragDestinationAction()
m_sandboxExtensionTracker.willPerformLoadDragDestinationAction(m_pendingDropSandboxExtension.release());
}
void WebPage::performUploadDragDestinationAction()
{
for (size_t i = 0; i < m_pendingDropExtensionsForFileUpload.size(); i++)
m_pendingDropExtensionsForFileUpload[i]->consumePermanently();
m_pendingDropExtensionsForFileUpload.clear();
}
WebUndoStep* WebPage::webUndoStep(uint64_t stepID)
{
return m_undoStepMap.get(stepID).get();
......
......@@ -439,11 +439,12 @@ public:
#elif PLATFORM(QT) || PLATFORM(GTK)
void performDragControllerAction(uint64_t action, WebCore::DragData);
#else
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&);
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
#endif
void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
void willPerformLoadDragDestinationAction();
void performUploadDragDestinationAction();
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
......@@ -765,6 +766,7 @@ private:
uint64_t m_pageID;
RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
Vector<RefPtr<SandboxExtension> > m_pendingDropExtensionsForFileUpload;
bool m_canRunBeforeUnloadConfirmPanel;
......
......@@ -147,7 +147,7 @@ messages -> WebPage {
PerformDragControllerAction(uint64_t action, WebCore::DragData dragData)
#endif
#if !PLATFORM(WIN) && !PLATFORM(QT) && !PLATFORM(GTK)
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::SandboxExtension::HandleArray sandboxExtensionsForUpload)
#endif
DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment