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