Closed
Bug 546425
Opened 15 years ago
Closed 15 years ago
allow access to source of drag from dataTransfer
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Core
DOM: Copy & Paste and Drag & Drop
Tracking
()
RESOLVED
FIXED
People
(Reporter: enndeakin, Assigned: enndeakin)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 1 obsolete file)
4.31 KB,
patch
|
roc
:
superreview+
|
Details | Diff | Splinter Review |
There are a number of cases where knowing the source of the drag (of available) would be useful. Currently, this is only available from the drag session. This patch adds a dataTransfer.mozSourceNode.
Attachment #427123 -
Flags: review?(jonas)
Comment on attachment 427123 [details] [diff] [review]
add this
>+nsDOMDataTransfer::GetMozSourceNode(nsIDOMNode** aSourceNode)
>+{
>+ *aSourceNode = nsnull;
>+
>+ nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
>+ if (!dragSession)
>+ return NS_OK;
>+
>+ nsCOMPtr<nsIDOMNode> sourceNode;
>+ dragSession->GetSourceNode(getter_AddRefs(sourceNode));
>+ if (sourceNode && !nsContentUtils::CanCallerAccess(sourceNode))
>+ return NS_ERROR_DOM_SECURITY_ERR;
It's probably better to simply return null rather than throwing an exception. That might cause fewer page scripts to break due to use dragging from an unexpected place.
r=me with that changed.
Attachment #427123 -
Flags: review?(jonas) → review+
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #427123 -
Attachment is obsolete: true
Attachment #428442 -
Flags: superreview?(roc)
Keywords: dev-doc-needed
Attachment #428442 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Comment 3•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 4•15 years ago
|
||
Documented here:
https://developer.mozilla.org/En/DragDrop/DataTransfer#mozSourceNode
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•