Closed Bug 60924 Opened 24 years ago Closed 24 years ago

Can't drag multiple files into mozilla

Categories

(Core :: XUL, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla0.8

People

(Reporter: markh, Assigned: mikepinkerton)

Details

Attachments

(2 files)

It is not possible to drop multiple files onto a Mozilla window from Windows 
explorer.  When the clipboard code attempts to retrieve the second or 
subsequent files, an exception is raised.  Thus, only the first dropped file 
can be accessed.

The fault is in widget/src/windows/nsDragService.cpp.  The 
function "GetNumDropItems()" has special handling for file drops, but 
the "GetData()" function does not have the equivilent handling.

A patch is attached.

Steps to reproduce:
-------------------
* Place the attached "test.xul" into a chrome directory.
* Run Mozilla opening the chrome - eg:
     mozilla -chrome "chrome://global/content/text.xul"
     
   A window without any widgets or children will appear.
   
* From Explorer, select 2 files, and drop them onto the
   Mozilla window.
   
The following messages appear:

DropOn - fetching element 0
S_OK
S_OK
Yay - got item 0
DropOn - fetching element 1
JavaScript error:
 line 0: uncaught exception: [Exception... "Component returned failure code: 
0x80004005 (NS_ERROR_FAILURE) [nsIDragSession.getData]"  nsresult: "0x80004005 
(NS_ERROR_FAILURE)"  location: "JS frame :: chrome://komodo/content/test.xul :: 
DropOn :: line 43"  data: no]
-- end of output --

With the attached patch applied, the output is:
DropOn - fetching element 0
S_OK
S_OK
Yay - got item 0
DropOn - fetching element 1
S_OK
S_OK
Yay - got item 1
--

Notes on the patch:
-------------------
I chose to keep the "if index==0" the fast path, and only check
for multiple files when index != 0.  However, this has resulted in
a duplicate call to nsClipboard::GetDataFromDataObject() which
could otherwise be avoided.

I also added 2 extra assertions, for when an invalid index has been specified.
thanks! ->pinkerton
Assignee: trudelle → pinkerton
Awesome. I'll try to land this soon.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: patch
Priority: P3 → P2
Summary: Can not drop multiple files from Windows onto Explorer. → Can't drag multiple files into mozilla
Target Milestone: --- → mozilla0.9
OS: Windows 2000 → All
Hardware: PC → All
Target Milestone: mozilla0.9 → mozilla0.8
Let's not let the patch rot...
I've a few patches rotting ATM, but I don't know what preservative to use!  Is there a generally accepted "polite" way for me to nudge well reported bugs with patches along?
You could send an email directly to pinkerton. (Sometimes the volume of bug 
email gets to a bit much, and some bug comments get missed, particularly at 
a time like now, when everyone will be trying to catch up on 1000 or more 
bugzilla emails over the holidays). 

That said, though, I note that on Dec. 18, Mike re-scheduled this bug for the 
next milestone (0.8), so that means he will be doing this Real Soon Now.
landed. r=saari/sr=hyatt
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Works for me!  Thanks guys!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: