forked from mirrors/gecko-dev
Backed out changeset a7ac9f64f6ea (bug 1561056) for build bustage at widget/gtk/nsDragService. On a CLOSED TREE
This commit is contained in:
parent
5ff7943b7d
commit
95ce40b8d4
21 changed files with 59 additions and 144 deletions
|
|
@ -751,7 +751,7 @@
|
|||
let replace = !!targetTab;
|
||||
let newIndex = this._getDropIndex(event, true);
|
||||
let urls = links.map(link => link.url);
|
||||
let csp = browserDragAndDrop.getCSP(event);
|
||||
|
||||
let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal(
|
||||
event
|
||||
);
|
||||
|
|
@ -779,7 +779,6 @@
|
|||
newIndex,
|
||||
userContextId,
|
||||
triggeringPrincipal,
|
||||
csp,
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,10 +219,6 @@ ContentAreaDropListener.prototype = {
|
|||
|
||||
getCSP: function(aEvent) {
|
||||
let sourceNode = aEvent.dataTransfer.mozSourceNode;
|
||||
if (aEvent.dataTransfer.mozCSP !== null) {
|
||||
return aEvent.dataTransfer.mozCSP;
|
||||
}
|
||||
|
||||
if (
|
||||
sourceNode &&
|
||||
(sourceNode.localName !== "browser" ||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class MOZ_STACK_CLASS DragDataProducer {
|
|||
nsIContent* aSelectionTargetNode, bool aIsAltKeyPressed);
|
||||
nsresult Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
|
||||
Selection** aSelection, nsIContent** aDragNode,
|
||||
nsIPrincipal** aPrincipal, nsIContentSecurityPolicy** aCsp);
|
||||
nsIPrincipal** aPrincipal);
|
||||
|
||||
private:
|
||||
void AddString(DataTransfer* aDataTransfer, const nsAString& aFlavor,
|
||||
|
|
@ -110,8 +110,7 @@ nsresult nsContentAreaDragDrop::GetDragData(
|
|||
nsPIDOMWindowOuter* aWindow, nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode, bool aIsAltKeyPressed,
|
||||
DataTransfer* aDataTransfer, bool* aCanDrag, Selection** aSelection,
|
||||
nsIContent** aDragNode, nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp) {
|
||||
nsIContent** aDragNode, nsIPrincipal** aPrincipal) {
|
||||
NS_ENSURE_TRUE(aSelectionTargetNode, NS_ERROR_INVALID_ARG);
|
||||
|
||||
*aCanDrag = true;
|
||||
|
|
@ -119,7 +118,7 @@ nsresult nsContentAreaDragDrop::GetDragData(
|
|||
DragDataProducer provider(aWindow, aTarget, aSelectionTargetNode,
|
||||
aIsAltKeyPressed);
|
||||
return provider.Produce(aDataTransfer, aCanDrag, aSelection, aDragNode,
|
||||
aPrincipal, aCsp);
|
||||
aPrincipal);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsContentAreaDragDropDataProvider, nsIFlavorDataProvider)
|
||||
|
|
@ -492,8 +491,7 @@ nsresult DragDataProducer::GetImageData(imgIContainer* aImage,
|
|||
nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
|
||||
Selection** aSelection,
|
||||
nsIContent** aDragNode,
|
||||
nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp) {
|
||||
nsIPrincipal** aPrincipal) {
|
||||
MOZ_ASSERT(aCanDrag && aSelection && aDataTransfer && aDragNode,
|
||||
"null pointer passed to Produce");
|
||||
NS_ASSERTION(mWindow, "window not set");
|
||||
|
|
@ -722,11 +720,6 @@ nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
|
|||
nsCOMPtr<Document> doc = mWindow->GetDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = doc->GetCsp();
|
||||
if (csp) {
|
||||
NS_IF_ADDREF(*aCsp = csp);
|
||||
}
|
||||
|
||||
// if we have selected text, use it in preference to the node
|
||||
nsCOMPtr<nsITransferable> transferable;
|
||||
if (*aSelection) {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ class nsContentAreaDragDrop {
|
|||
* drag occurred on another element.
|
||||
* aPrincipal - [out] set to the triggering principal of the drag, or null if
|
||||
* it's from browser chrome or OS
|
||||
* aCSP - [out] set to the CSP of the Drag, or null if
|
||||
* it's from browser chrome or OS
|
||||
*/
|
||||
static nsresult GetDragData(nsPIDOMWindowOuter* aWindow, nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
|
|
@ -57,8 +55,8 @@ class nsContentAreaDragDrop {
|
|||
mozilla::dom::DataTransfer* aDataTransfer,
|
||||
bool* aCanDrag,
|
||||
mozilla::dom::Selection** aSelection,
|
||||
nsIContent** aDragNode, nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp);
|
||||
nsIContent** aDragNode,
|
||||
nsIPrincipal** aPrincipal);
|
||||
};
|
||||
|
||||
// this is used to save images to disk lazily when the image data is asked for
|
||||
|
|
|
|||
|
|
@ -318,16 +318,6 @@ void DataTransfer::GetMozTriggeringPrincipalURISpec(
|
|||
CopyUTF8toUTF16(spec, aPrincipalURISpec);
|
||||
}
|
||||
|
||||
nsIContentSecurityPolicy* DataTransfer::GetMozCSP() {
|
||||
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
|
||||
if (!dragSession) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
dragSession->GetCsp(getter_AddRefs(csp));
|
||||
return csp;
|
||||
}
|
||||
|
||||
already_AddRefed<FileList> DataTransfer::GetFiles(
|
||||
nsIPrincipal& aSubjectPrincipal) {
|
||||
return mItems->Files(&aSubjectPrincipal);
|
||||
|
|
|
|||
|
|
@ -274,8 +274,6 @@ class DataTransfer final : public nsISupports, public nsWrapperCache {
|
|||
|
||||
void GetMozTriggeringPrincipalURISpec(nsAString& aPrincipalURISpec);
|
||||
|
||||
nsIContentSecurityPolicy* GetMozCSP();
|
||||
|
||||
mozilla::dom::Element* GetDragTarget() const { return mDragTarget; }
|
||||
|
||||
nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
|
||||
|
|
|
|||
|
|
@ -1290,13 +1290,10 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
|||
uint32_t dropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
|
||||
uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
|
||||
if (dragSession) {
|
||||
dragSession->DragEventDispatchedToChildProcess();
|
||||
dragSession->GetDragAction(&action);
|
||||
dragSession->GetTriggeringPrincipal(getter_AddRefs(principal));
|
||||
dragSession->GetCsp(getter_AddRefs(csp));
|
||||
RefPtr<DataTransfer> initialDataTransfer =
|
||||
dragSession->GetDataTransfer();
|
||||
if (initialDataTransfer) {
|
||||
|
|
@ -1305,8 +1302,7 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
|||
}
|
||||
|
||||
browserParent->SendRealDragEvent(*aEvent->AsDragEvent(), action,
|
||||
dropEffect, IPC::Principal(principal),
|
||||
csp);
|
||||
dropEffect, IPC::Principal(principal));
|
||||
return;
|
||||
}
|
||||
case ePluginEventClass: {
|
||||
|
|
@ -1798,7 +1794,6 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
RefPtr<RemoteDragStartData> remoteDragStartData;
|
||||
nsCOMPtr<nsIContent> eventContent, targetContent;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(eventContent));
|
||||
if (eventContent) {
|
||||
// If the content is a text node in a password field, we shouldn't
|
||||
|
|
@ -1822,7 +1817,7 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
DetermineDragTargetAndDefaultData(
|
||||
window, eventContent, dataTransfer, getter_AddRefs(selection),
|
||||
getter_AddRefs(remoteDragStartData), getter_AddRefs(targetContent),
|
||||
getter_AddRefs(principal), getter_AddRefs(csp));
|
||||
getter_AddRefs(principal));
|
||||
}
|
||||
|
||||
// Stop tracking the drag gesture now. This should stop us from
|
||||
|
|
@ -1877,8 +1872,7 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
// Emit observer event to allow addons to modify the DataTransfer
|
||||
// object.
|
||||
// Emit observer event to allow addons to modify the DataTransfer object.
|
||||
if (observerService) {
|
||||
observerService->NotifyObservers(dataTransfer,
|
||||
"on-datatransfer-available", nullptr);
|
||||
|
|
@ -1887,7 +1881,7 @@ void EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
if (status != nsEventStatus_eConsumeNoDefault) {
|
||||
bool dragStarted =
|
||||
DoDefaultDragStart(aPresContext, event, dataTransfer, targetContent,
|
||||
selection, remoteDragStartData, principal, csp);
|
||||
selection, remoteDragStartData, principal);
|
||||
if (dragStarted) {
|
||||
sActiveESM = nullptr;
|
||||
MaybeFirePointerCancel(aEvent);
|
||||
|
|
@ -1909,7 +1903,7 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
nsPIDOMWindowOuter* aWindow, nsIContent* aSelectionTarget,
|
||||
DataTransfer* aDataTransfer, Selection** aSelection,
|
||||
RemoteDragStartData** aRemoteDragStartData, nsIContent** aTargetNode,
|
||||
nsIPrincipal** aPrincipal, nsIContentSecurityPolicy** aCsp) {
|
||||
nsIPrincipal** aPrincipal) {
|
||||
*aTargetNode = nullptr;
|
||||
|
||||
nsCOMPtr<nsIContent> dragDataNode;
|
||||
|
|
@ -1924,8 +1918,7 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
if (mGestureDownDragStartData) {
|
||||
// A child process started a drag so use any data it assigned for the dnd
|
||||
// session.
|
||||
mGestureDownDragStartData->AddInitialDnDDataTo(aDataTransfer, aPrincipal,
|
||||
aCsp);
|
||||
mGestureDownDragStartData->AddInitialDnDDataTo(aDataTransfer, aPrincipal);
|
||||
mGestureDownDragStartData.forget(aRemoteDragStartData);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1941,7 +1934,7 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
bool wasAlt = (mGestureModifiers & MODIFIER_ALT) != 0;
|
||||
nsresult rv = nsContentAreaDragDrop::GetDragData(
|
||||
aWindow, mGestureDownContent, aSelectionTarget, wasAlt, aDataTransfer,
|
||||
&canDrag, aSelection, getter_AddRefs(dragDataNode), aPrincipal, aCsp);
|
||||
&canDrag, aSelection, getter_AddRefs(dragDataNode), aPrincipal);
|
||||
if (NS_FAILED(rv) || !canDrag) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2003,8 +1996,7 @@ void EventStateManager::DetermineDragTargetAndDefaultData(
|
|||
bool EventStateManager::DoDefaultDragStart(
|
||||
nsPresContext* aPresContext, WidgetDragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer, nsIContent* aDragTarget, Selection* aSelection,
|
||||
RemoteDragStartData* aDragStartData, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) {
|
||||
RemoteDragStartData* aDragStartData, nsIPrincipal* aPrincipal) {
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
if (!dragService) return false;
|
||||
|
|
@ -2077,16 +2069,16 @@ bool EventStateManager::DoDefaultDragStart(
|
|||
// other than a selection is being dragged.
|
||||
if (!dragImage && aSelection) {
|
||||
dragService->InvokeDragSessionWithSelection(
|
||||
aSelection, aPrincipal, aCsp, transArray, action, event, dataTransfer);
|
||||
aSelection, aPrincipal, transArray, action, event, dataTransfer);
|
||||
} else if (aDragStartData) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
dragService->InvokeDragSessionWithRemoteImage(
|
||||
dragTarget, aPrincipal, aCsp, transArray, action, aDragStartData, event,
|
||||
dragTarget, aPrincipal, transArray, action, aDragStartData, event,
|
||||
dataTransfer);
|
||||
} else {
|
||||
dragService->InvokeDragSessionWithImage(
|
||||
dragTarget, aPrincipal, aCsp, transArray, action, dragImage, imageX,
|
||||
imageY, event, dataTransfer);
|
||||
dragService->InvokeDragSessionWithImage(dragTarget, aPrincipal, transArray,
|
||||
action, dragImage, imageX, imageY,
|
||||
event, dataTransfer);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
nsPIDOMWindowOuter* aWindow, nsIContent* aSelectionTarget,
|
||||
dom::DataTransfer* aDataTransfer, dom::Selection** aSelection,
|
||||
dom::RemoteDragStartData** aRemoteDragStartData, nsIContent** aTargetNode,
|
||||
nsIPrincipal** aPrincipal, nsIContentSecurityPolicy** aCsp);
|
||||
nsIPrincipal** aPrincipal);
|
||||
|
||||
/*
|
||||
* Perform the default handling for the dragstart event and set up a
|
||||
|
|
@ -1103,8 +1103,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
dom::DataTransfer* aDataTransfer,
|
||||
nsIContent* aDragTarget, dom::Selection* aSelection,
|
||||
dom::RemoteDragStartData* aDragStartData,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp);
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
bool IsTrackingDragGesture() const { return mGestureDownContent != nullptr; }
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,19 +19,15 @@ RemoteDragStartData::~RemoteDragStartData() {}
|
|||
|
||||
RemoteDragStartData::RemoteDragStartData(
|
||||
BrowserParent* aBrowserParent, nsTArray<IPCDataTransfer>&& aDataTransfer,
|
||||
const LayoutDeviceIntRect& aRect, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp)
|
||||
const LayoutDeviceIntRect& aRect, nsIPrincipal* aPrincipal)
|
||||
: mBrowserParent(aBrowserParent),
|
||||
mDataTransfer(aDataTransfer),
|
||||
mRect(aRect),
|
||||
mPrincipal(aPrincipal),
|
||||
mCsp(aCsp) {}
|
||||
mPrincipal(aPrincipal) {}
|
||||
|
||||
void RemoteDragStartData::AddInitialDnDDataTo(DataTransfer* aDataTransfer,
|
||||
nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp) {
|
||||
nsIPrincipal** aPrincipal) {
|
||||
NS_IF_ADDREF(*aPrincipal = mPrincipal);
|
||||
NS_IF_ADDREF(*aCsp = mCsp);
|
||||
|
||||
for (uint32_t i = 0; i < mDataTransfer.Length(); ++i) {
|
||||
nsTArray<IPCDataTransferItem>& itemArray = mDataTransfer[i].items();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class RemoteDragStartData {
|
|||
RemoteDragStartData(BrowserParent* aBrowserParent,
|
||||
nsTArray<IPCDataTransfer>&& aDataTransfer,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp);
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
void SetVisualization(
|
||||
already_AddRefed<gfx::DataSourceSurface> aVisualization) {
|
||||
|
|
@ -43,8 +43,7 @@ class RemoteDragStartData {
|
|||
}
|
||||
|
||||
void AddInitialDnDDataTo(DataTransfer* aDataTransfer,
|
||||
nsIPrincipal** aPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp);
|
||||
nsIPrincipal** aPrincipal);
|
||||
|
||||
private:
|
||||
virtual ~RemoteDragStartData();
|
||||
|
|
@ -53,7 +52,6 @@ class RemoteDragStartData {
|
|||
nsTArray<IPCDataTransfer> mDataTransfer;
|
||||
const LayoutDeviceIntRect mRect;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> mCsp;
|
||||
RefPtr<mozilla::gfx::SourceSurface> mVisualization;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1862,8 +1862,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvNormalPriorityRealTouchMoveEvent(
|
|||
|
||||
mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
|
||||
const WidgetDragEvent& aEvent, const uint32_t& aDragAction,
|
||||
const uint32_t& aDropEffect, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) {
|
||||
const uint32_t& aDropEffect, nsIPrincipal* aPrincipal) {
|
||||
WidgetDragEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
|
||||
|
|
@ -1871,7 +1870,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvRealDragEvent(
|
|||
if (dragSession) {
|
||||
dragSession->SetDragAction(aDragAction);
|
||||
dragSession->SetTriggeringPrincipal(aPrincipal);
|
||||
dragSession->SetCsp(aCsp);
|
||||
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
|
||||
if (initialDataTransfer) {
|
||||
initialDataTransfer->SetDropEffectInt(aDropEffect);
|
||||
|
|
|
|||
|
|
@ -324,8 +324,7 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||
mozilla::ipc::IPCResult RecvRealDragEvent(const WidgetDragEvent& aEvent,
|
||||
const uint32_t& aDragAction,
|
||||
const uint32_t& aDropEffect,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp);
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRealKeyEvent(
|
||||
const mozilla::WidgetKeyboardEvent& aEvent);
|
||||
|
|
|
|||
|
|
@ -1437,8 +1437,7 @@ bool BrowserParent::QueryDropLinksForVerification() {
|
|||
void BrowserParent::SendRealDragEvent(WidgetDragEvent& aEvent,
|
||||
uint32_t aDragAction,
|
||||
uint32_t aDropEffect,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) {
|
||||
nsIPrincipal* aPrincipal) {
|
||||
if (mIsDestroyed || !mIsReadyToHandleInputEvents) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1450,7 +1449,7 @@ void BrowserParent::SendRealDragEvent(WidgetDragEvent& aEvent,
|
|||
}
|
||||
}
|
||||
DebugOnly<bool> ret = PBrowserParent::SendRealDragEvent(
|
||||
aEvent, aDragAction, aDropEffect, aPrincipal, aCsp);
|
||||
aEvent, aDragAction, aDropEffect, aPrincipal);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendRealDragEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
|
@ -3613,7 +3612,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvInvokeDragSession(
|
|||
nsTArray<IPCDataTransfer>&& aTransfers, const uint32_t& aAction,
|
||||
Maybe<Shmem>&& aVisualDnDData, const uint32_t& aStride,
|
||||
const gfx::SurfaceFormat& aFormat, const LayoutDeviceIntRect& aDragRect,
|
||||
nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp) {
|
||||
nsIPrincipal* aPrincipal) {
|
||||
PresShell* presShell = mFrameElement->OwnerDoc()->GetPresShell();
|
||||
if (!presShell) {
|
||||
Unused << Manager()->SendEndDragSession(true, true, LayoutDeviceIntPoint(),
|
||||
|
|
@ -3625,7 +3624,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvInvokeDragSession(
|
|||
}
|
||||
|
||||
RefPtr<RemoteDragStartData> dragStartData = new RemoteDragStartData(
|
||||
this, std::move(aTransfers), aDragRect, aPrincipal, aCsp);
|
||||
this, std::move(aTransfers), aDragRect, aPrincipal);
|
||||
|
||||
if (!aVisualDnDData.isNothing() && aVisualDnDData.ref().IsReadable() &&
|
||||
aVisualDnDData.ref().Size<char>() >= aDragRect.height * aStride) {
|
||||
|
|
|
|||
|
|
@ -571,8 +571,7 @@ class BrowserParent final : public PBrowserParent,
|
|||
void SendRealMouseEvent(WidgetMouseEvent& aEvent);
|
||||
|
||||
void SendRealDragEvent(WidgetDragEvent& aEvent, uint32_t aDragAction,
|
||||
uint32_t aDropEffect, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp);
|
||||
uint32_t aDropEffect, nsIPrincipal* aPrincipal);
|
||||
|
||||
void SendMouseWheelEvent(WidgetWheelEvent& aEvent);
|
||||
|
||||
|
|
@ -682,7 +681,7 @@ class BrowserParent final : public PBrowserParent,
|
|||
nsTArray<IPCDataTransfer>&& aTransfers, const uint32_t& aAction,
|
||||
Maybe<Shmem>&& aVisualDnDData, const uint32_t& aStride,
|
||||
const gfx::SurfaceFormat& aFormat, const LayoutDeviceIntRect& aDragRect,
|
||||
nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp);
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
void AddInitialDnDDataTo(DataTransfer* aDataTransfer,
|
||||
nsIPrincipal** aPrincipal);
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ parent:
|
|||
Shmem? visualData,
|
||||
uint32_t stride, SurfaceFormat format,
|
||||
LayoutDeviceIntRect dragRect,
|
||||
nsIPrincipal principal, nsIContentSecurityPolicy csp);
|
||||
nsIPrincipal principal);
|
||||
|
||||
// After a compositor reset, it is necessary to reconnect each layers ID to
|
||||
// the compositor of the widget that will render those layers. Note that
|
||||
|
|
@ -823,8 +823,7 @@ child:
|
|||
* don't need support RealDragEvent with input priority.
|
||||
*/
|
||||
async RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction,
|
||||
uint32_t aDropEffect, nsIPrincipal aPrincipal,
|
||||
nsIContentSecurityPolicy csp);
|
||||
uint32_t aDropEffect, nsIPrincipal aPrincipal);
|
||||
|
||||
async PluginEvent(WidgetPluginEvent aEvent);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* The origin of this IDL file is:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#the-datatransfer-interface
|
||||
*/
|
||||
interface ContentSecurityPolicy;
|
||||
|
||||
[Constructor]
|
||||
interface DataTransfer {
|
||||
|
|
@ -165,9 +164,6 @@ partial interface DataTransfer {
|
|||
[ChromeOnly]
|
||||
readonly attribute DOMString mozTriggeringPrincipalURISpec;
|
||||
|
||||
[ChromeOnly]
|
||||
readonly attribute ContentSecurityPolicy? mozCSP;
|
||||
|
||||
/**
|
||||
* Copy the given DataTransfer for the given event. Used by testing code for
|
||||
* creating emulated Drag and Drop events in the UI.
|
||||
|
|
|
|||
|
|
@ -162,18 +162,6 @@ nsBaseDragService::SetTriggeringPrincipal(nsIPrincipal* aPrincipal) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::GetCsp(nsIContentSecurityPolicy** aCsp) {
|
||||
NS_IF_ADDREF(*aCsp = mCsp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::SetCsp(nsIContentSecurityPolicy* aCsp) {
|
||||
mCsp = aCsp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
@ -212,8 +200,8 @@ void nsBaseDragService::SetDataTransfer(DataTransfer* aDataTransfer) {
|
|||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::InvokeDragSession(
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||
nsIArray* aTransferableArray, uint32_t aActionType,
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIArray* aTransferableArray,
|
||||
uint32_t aActionType,
|
||||
nsContentPolicyType aContentPolicyType = nsIContentPolicy::TYPE_OTHER) {
|
||||
AUTO_PROFILER_LABEL("nsBaseDragService::InvokeDragSession", OTHER);
|
||||
|
||||
|
|
@ -240,7 +228,6 @@ nsBaseDragService::InvokeDragSession(
|
|||
// stash the document of the dom node
|
||||
mSourceDocument = aDOMNode->OwnerDoc();
|
||||
mTriggeringPrincipal = aPrincipal;
|
||||
mCsp = aCsp;
|
||||
mSourceNode = aDOMNode;
|
||||
mContentPolicyType = aContentPolicyType;
|
||||
mEndDragPoint = LayoutDeviceIntPoint(0, 0);
|
||||
|
|
@ -276,10 +263,9 @@ nsBaseDragService::InvokeDragSession(
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::InvokeDragSessionWithImage(
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||
nsIArray* aTransferableArray, uint32_t aActionType, nsINode* aImage,
|
||||
int32_t aImageX, int32_t aImageY, DragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer) {
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIArray* aTransferableArray,
|
||||
uint32_t aActionType, nsINode* aImage, int32_t aImageX, int32_t aImageY,
|
||||
DragEvent* aDragEvent, DataTransfer* aDataTransfer) {
|
||||
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aDataTransfer, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
|
||||
|
|
@ -316,18 +302,17 @@ nsBaseDragService::InvokeDragSessionWithImage(
|
|||
#endif
|
||||
|
||||
nsresult rv =
|
||||
InvokeDragSession(aDOMNode, aPrincipal, aCsp, aTransferableArray,
|
||||
aActionType, nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||
InvokeDragSession(aDOMNode, aPrincipal, aTransferableArray, aActionType,
|
||||
nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||
mRegion = Nothing();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::InvokeDragSessionWithRemoteImage(
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||
nsIArray* aTransferableArray, uint32_t aActionType,
|
||||
RemoteDragStartData* aDragStartData, DragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer) {
|
||||
nsINode* aDOMNode, nsIPrincipal* aPrincipal, nsIArray* aTransferableArray,
|
||||
uint32_t aActionType, RemoteDragStartData* aDragStartData,
|
||||
DragEvent* aDragEvent, DataTransfer* aDataTransfer) {
|
||||
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aDataTransfer, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
|
||||
|
|
@ -345,17 +330,19 @@ nsBaseDragService::InvokeDragSessionWithRemoteImage(
|
|||
mInputSource = aDragEvent->MozInputSource();
|
||||
|
||||
nsresult rv =
|
||||
InvokeDragSession(aDOMNode, aPrincipal, aCsp, aTransferableArray,
|
||||
aActionType, nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||
InvokeDragSession(aDOMNode, aPrincipal, aTransferableArray, aActionType,
|
||||
nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||
mRegion = Nothing();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseDragService::InvokeDragSessionWithSelection(
|
||||
Selection* aSelection, nsIPrincipal* aPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp, nsIArray* aTransferableArray,
|
||||
uint32_t aActionType, DragEvent* aDragEvent, DataTransfer* aDataTransfer) {
|
||||
nsBaseDragService::InvokeDragSessionWithSelection(Selection* aSelection,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIArray* aTransferableArray,
|
||||
uint32_t aActionType,
|
||||
DragEvent* aDragEvent,
|
||||
DataTransfer* aDataTransfer) {
|
||||
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aDragEvent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(mSuppressLevel == 0, NS_ERROR_FAILURE);
|
||||
|
|
@ -378,8 +365,8 @@ nsBaseDragService::InvokeDragSessionWithSelection(
|
|||
// endpoints of the selection
|
||||
nsCOMPtr<nsINode> node = aSelection->GetFocusNode();
|
||||
|
||||
return InvokeDragSession(node, aPrincipal, aCsp, aTransferableArray,
|
||||
aActionType, nsIContentPolicy::TYPE_OTHER);
|
||||
return InvokeDragSession(node, aPrincipal, aTransferableArray, aActionType,
|
||||
nsIContentPolicy::TYPE_OTHER);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -475,7 +462,6 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) {
|
|||
mSourceDocument = nullptr;
|
||||
mSourceNode = nullptr;
|
||||
mTriggeringPrincipal = nullptr;
|
||||
mCsp = nullptr;
|
||||
mSelection = nullptr;
|
||||
mDataTransfer = nullptr;
|
||||
mHasImage = false;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ class nsBaseDragService : public nsIDragService, public nsIDragSession {
|
|||
|
||||
nsCOMPtr<nsINode> mSourceNode;
|
||||
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> mCsp;
|
||||
|
||||
// the document at the drag source. will be null if it came from outside the
|
||||
// app.
|
||||
|
|
|
|||
|
|
@ -41,11 +41,6 @@ nsresult nsDragServiceProxy::InvokeDragSessionImpl(
|
|||
principal = mSourceNode->NodePrincipal();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
if (mSourceDocument) {
|
||||
csp = mSourceDocument->GetCsp();
|
||||
}
|
||||
|
||||
LayoutDeviceIntRect dragRect;
|
||||
if (mHasImage || mSelection) {
|
||||
nsPresContext* pc;
|
||||
|
|
@ -73,7 +68,7 @@ nsresult nsDragServiceProxy::InvokeDragSessionImpl(
|
|||
|
||||
mozilla::Unused << child->SendInvokeDragSession(
|
||||
dataTransfers, aActionType, Some(std::move(surfaceData)), stride,
|
||||
dataSurface->GetFormat(), dragRect, IPC::Principal(principal), csp);
|
||||
dataSurface->GetFormat(), dragRect, IPC::Principal(principal));
|
||||
StartDragSession();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -82,7 +77,7 @@ nsresult nsDragServiceProxy::InvokeDragSessionImpl(
|
|||
|
||||
mozilla::Unused << child->SendInvokeDragSession(
|
||||
dataTransfers, aActionType, Nothing(), 0, static_cast<SurfaceFormat>(0),
|
||||
dragRect, IPC::Principal(principal), csp);
|
||||
dragRect, IPC::Principal(principal));
|
||||
StartDragSession();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ interface nsIDragService : nsISupports
|
|||
*
|
||||
* @param aPrincipal - the triggering principal of the drag, or null if
|
||||
* it's from browser chrome or OS
|
||||
* @param aCsp - The csp of the triggering Document
|
||||
* @param aTransferables - an array of transferables to be dragged
|
||||
* @param aActionType - specified which of copy/move/link are allowed
|
||||
* @param aContentPolicyType - the contentPolicyType that will be
|
||||
|
|
@ -56,7 +55,6 @@ interface nsIDragService : nsISupports
|
|||
[can_run_script]
|
||||
void invokeDragSession (in Node aDOMNode,
|
||||
in nsIPrincipal aPrincipal,
|
||||
in nsIContentSecurityPolicy aCsp,
|
||||
in nsIArray aTransferables,
|
||||
in unsigned long aActionType,
|
||||
[optional] in nsContentPolicyType aContentPolicyType);
|
||||
|
|
@ -91,7 +89,6 @@ interface nsIDragService : nsISupports
|
|||
[noscript, can_run_script]
|
||||
void invokeDragSessionWithImage(in Node aDOMNode,
|
||||
in nsIPrincipal aPrincipal,
|
||||
in nsIContentSecurityPolicy aCsp,
|
||||
in nsIArray aTransferableArray,
|
||||
in unsigned long aActionType,
|
||||
in Node aImage,
|
||||
|
|
@ -106,7 +103,6 @@ interface nsIDragService : nsISupports
|
|||
[noscript, can_run_script]
|
||||
void invokeDragSessionWithRemoteImage(in Node aDOMNode,
|
||||
in nsIPrincipal aPrincipal,
|
||||
in nsIContentSecurityPolicy aCsp,
|
||||
in nsIArray aTransferableArray,
|
||||
in unsigned long aActionType,
|
||||
in RemoteDragStartDataPtr aDragStartData,
|
||||
|
|
@ -123,7 +119,6 @@ interface nsIDragService : nsISupports
|
|||
[can_run_script]
|
||||
void invokeDragSessionWithSelection(in Selection aSelection,
|
||||
in nsIPrincipal aPrincipal,
|
||||
in nsIContentSecurityPolicy aCsp,
|
||||
in nsIArray aTransferableArray,
|
||||
in unsigned long aActionType,
|
||||
in DragEvent aDragEvent,
|
||||
|
|
|
|||
|
|
@ -8,11 +8,9 @@
|
|||
#include "nsITransferable.idl"
|
||||
|
||||
|
||||
|
||||
%{ C++
|
||||
#include "nsSize.h"
|
||||
%}
|
||||
interface nsIContentSecurityPolicy;
|
||||
|
||||
native nsSize (nsSize);
|
||||
|
||||
|
|
@ -64,13 +62,6 @@ interface nsIDragSession : nsISupports
|
|||
*/
|
||||
attribute nsIPrincipal triggeringPrincipal;
|
||||
|
||||
/**
|
||||
* the triggering csp. This may be different than sourceNode's
|
||||
* csp when sourceNode is xul:browser and the drag is
|
||||
* triggered in a browsing context inside it.
|
||||
*/
|
||||
attribute nsIContentSecurityPolicy csp;
|
||||
|
||||
/**
|
||||
* The data transfer object for the current drag.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue