Closed Bug 939319 Opened 6 years ago Closed 6 years ago

Provide a drag-and-drop observer to allow event filtering

Categories

(Core :: Drag and Drop, defect)

24 Branch
x86
Windows 7
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: mikeperry, Assigned: gk)

References

(Blocks 1 open bug)

Details

(Whiteboard: [tor])

Attachments

(1 file, 2 obsolete files)

Many OS desktop environments sniff the contents of the drag and drop list and pre-fetch any URLs listed for mime types that they want to handle. These downloads happen outside of any proxy settings configured by the browser. Moreover, they happen instantaneously upon the *start* of a drag event, before the user has even selected a destination.

This has the effect that an action as simple as clicking for too long on an image can cause the OS to bypass the browser proxy settings to download that image.

In Tor Browser, we patched the drag service to create an observer event that is emitted during drag and drop and handled from Torbutton. Torbutton then uses the observer data to remove out all mime types except for text/plain and the internal Mozilla types. The result is that drag and drop continues to function for all in-browser activity, but when users drag an item out of browser, they get a simple text representation of the URL they dragged (usually as the contents of a text file, or as a text-based URL insert).

The patch against Firefox 24 to create this observer is attached.
Attachment #833215 - Flags: review?
Comment on attachment 833215 [details] [diff] [review]
Drag and drop observer event (patch is against FF24.1.1esr)

Mike, in the future you should make sure to request review from an actual person, so it doesn't get lost. You can find suggested reviewers when you upload an attachment and click the 'suggested reviewers' link.
Attachment #833215 - Flags: review? → review?(enndeakin)
Comment on attachment 833215 [details] [diff] [review]
Drag and drop observer event (patch is against FF24.1.1esr)

Review of attachment 833215 [details] [diff] [review]:
-----------------------------------------------------------------

We shouldn't be doing this at this low level. We don't want to be adding code that requires use of nsITransferable. Instead, the observer should pass the nsIDOMDataTransfer. A good place to do this is at http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventStateManager.cpp#2168 (just before the call to SetReadOnly)

Otherwise, this is ok. I'd change the topic to be more generic, since the observer doesn't have to be used to modify the drag data.
Attachment #833215 - Flags: review?(enndeakin) → review-
Attached patch drag-and-drop observer event v2 (obsolete) — Splinter Review
Attached is the second version of the patch rebased against m-c and tested (although I did not run the whole set of test suites yet).
Attachment #8364310 - Flags: review?(enndeakin)
Comment on attachment 8364310 [details] [diff] [review]
drag-and-drop observer event v2

Add braces around the if block.
Attachment #8364310 - Flags: review?(enndeakin) → review+
Comment on attachment 8364521 [details] [diff] [review]
drag-and-drop observer event v3

Done.
Attachment #8364521 - Attachment description: drag-and_drop_observer → drag-and-drop observer event v3
Attachment #8364521 - Attachment is patch: true
Attachment #8364521 - Flags: checkin?
Attachment #8364521 - Flags: checkin?
Assignee: nobody → gk
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: checkin-needed
Whiteboard: [please check patch v3 into mozilla-esr24]
Whiteboard: [please check patch v3 into mozilla-esr24] → [please check patch v3 into mozilla-central]
Attachment #833215 - Attachment is obsolete: true
Attachment #8364310 - Attachment is obsolete: true
https://hg.mozilla.org/integration/mozilla-inbound/rev/96f5df57e9b7
Keywords: checkin-needed
Whiteboard: [please check patch v3 into mozilla-central]
https://hg.mozilla.org/mozilla-central/rev/96f5df57e9b7
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Whiteboard: [tor]
Blocks: meta_tor
Duplicate of this bug: 752625
You need to log in before you can comment on or make changes to this bug.