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)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: enndeakin, Assigned: enndeakin)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

Attached patch add this (obsolete) — 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)
Blocks: 545714
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+
Attached patch return nullSplinter Review
Attachment #427123 - Attachment is obsolete: true
Attachment #428442 - Flags: superreview?(roc)
Attachment #428442 - Flags: superreview?(roc) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: