Can't drag multiple files into mozilla

RESOLVED FIXED in mozilla0.8

Status

()

P2
normal
RESOLVED FIXED
18 years ago
18 years ago

People

(Reporter: markh, Assigned: mikepinkerton)

Tracking

Trunk
mozilla0.8
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

18 years ago
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.
(Reporter)

Comment 1

18 years ago
Created attachment 19596 [details] [diff] [review]
Patch to correct the behaviour
(Reporter)

Comment 2

18 years ago
Created attachment 19597 [details]
test .xul file that demonstrates the problem and confirms the fix.

Comment 3

18 years ago
thanks! ->pinkerton
Assignee: trudelle → pinkerton
(Assignee)

Comment 4

18 years ago
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

Updated

18 years ago
OS: Windows 2000 → All
Hardware: PC → All
(Assignee)

Updated

18 years ago
Target Milestone: mozilla0.9 → mozilla0.8

Comment 5

18 years ago
Let's not let the patch rot...
(Reporter)

Comment 6

18 years ago
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?

Comment 7

18 years ago
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.
(Assignee)

Comment 8

18 years ago
landed. r=saari/sr=hyatt
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
(Reporter)

Comment 9

18 years ago
Works for me!  Thanks guys!
You need to log in before you can comment on or make changes to this bug.