Closed Bug 161824 Opened 22 years ago Closed 22 years ago

Drag and Drop Support for files not working

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: kreuzritter2000, Assigned: kreuzritter2000)

References

Details

Attachments

(1 file)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020605 BuildID: 2002060513 When i try to drag a file in my file manager (konqueror from KDE 3.0.1) via mouse and want to drop it over a Mozilla window, Mozilla isn't able to open the html file. Drag and Drop just doesn't work with files. Once ago i talked with a KDE developer about this, he said that it isn't a konqueror problem, it has something to do with Mozilla that is not exactly compabtible with a drag and drop protocol standard (or something like this, i can't remember what name the standard was, maybe it is this one: http://www.newplanetsoftware.com/xdnd/) So, is someone trying to fix this? That you can drag and drop a file from konqueror or another file managers to Mozilla so that Mozilla will open the file? Reproducible: Always Steps to Reproduce: 1. start konqueror (the version from KDE 3.x) 2. click on a html or text file in konqueror while still holding the mouse button 3. then drag it over a mozilla window 4. and drop it there Actual Results: Mozilla just does nothing. It is not opening and showing the text or html file. Expected Results: Mozilla should open the file and show it.
I also have this problem using Endeavor Mark II on Linux. When I drag and drop image files from the file manager, Mozilla does not always open the file in the browser window. I find it works maybe once out of every 10 to 20 tries. If I look at the Javascript Console, it will report an uncaught exception in nsTransferable::get(Any)TransferData. I'm not sure, but this could be related to Bug 86371. I'll attach the patch I use to fix this problem.
The problem is that gtk (1.2.10) sends a drag_leave signal during the drop event which ends the drag session before mozilla can read the data. The drop event handler has a comment which says it cancels any pending mDragLeaveTimer event, but it simply sets mDragLeaveTimer to 0. This patch explicitly calls mDragLeaveTimer->Cancel() before setting it to 0 to make sure that the event is actually cancelled.
forgot to add myself to CC...
Hmm... Maybe this should really be reassigned to "XP Apps: Drag and Drop". If someone with permission agrees, could they please make the change?
=>patch author
Assignee: law → kreuzritter2000
Status: UNCONFIRMED → NEW
Component: File Handling → XP Apps: Drag and Drop
Ever confirmed: true
Comment on attachment 95885 [details] [diff] [review] fix drag and drop problem for gtk toolkit r/sr=bzbarsky assuming you've tested this an all.
Attachment #95885 - Flags: superreview+
Thanks for the review! The patch works for me on the 1.0 and 1.1 branches. It would be helpful if someone else could independently verify that it fixes the problem on their system. I'm compiling w/ gcc-3.2 -O2 which I don't think is officially supported at the moment. Feedback is welcome, especially if someone can confirm whether or not the patch also fixes Bug 141362.
The reason that I never explicitly canceled that timer was because when you dereference it, it should be automatically cancelled. What's the deal?
By derereference I obviously mean unreference.
Right, when you unreference the timer it should cancel it *if* it already hasn't fired (e.g. mArmed == PR_TRUE). But, in this case, the timer already fired because it was initialized in nsWindow::OnDragLeaveSignal with: // fire this baby asafp mDragLeaveTimer->Init(DragLeaveTimerCallback, this, 0); Therefore, mArmed == PR_FALSE and nsTimerImpl::PostTimerEvent has already added the timer event to the event queue. We explicitly cancel the timer so *when* the event is processed in nsTimerImpl::Fire it immediately returns.
Comment on attachment 95885 [details] [diff] [review] fix drag and drop problem for gtk toolkit r=blizzard Ugh.
Attachment #95885 - Flags: review+
Patch checked in. Some testing in tomorrow's builds to see how things look would be nice.
Blocks: 141362
Patch 95885 must have uncovered the following crash. This new crash potentially zt4newcrash is happening in the startup and only reproduced by stephend@netscape.com. Looking at the source we are NOT validating of the encoder. Check for rv is missing ? 2330 rv = ccm->GetUnicodeEncoder(&platformCharset, getter_AddRefs(encoder)); 2331 2332 // Estimate out length and allocate the buffer based on a worst-case estimate, then do 2333 // the conversion. 2334 PRInt32 len = (PRInt32)aTitle.Length(); 2335 encoder->GetMaxLength(aTitle.get(), len, &platformLen); Stack Trace: nsWindow::SetTitle() [/builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsWindow.cpp line 2335] nsXULWindow::SetTitle() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsXULWindow.cpp line 708] nsChromeTreeOwner::SetTitle() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsChromeTreeOwner.cpp line 397] nsDocShell::SetTitle() [/builds/client/linux22/seamonkey/mozilla/docshell/base/nsDocShell.cpp line 3224] nsGlobalChromeWindow::SetTitle() [/builds/client/linux22/seamonkey/mozilla/dom/src/base/nsGlobalWindow.cpp line 1380] XPTC_InvokeByIndex() XPCWrappedNative::CallMethod() [/builds/client/linux22/seamonkey/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp line 1994] XPC_WN_GetterSetter() [/builds/client/linux22/seamonkey/mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp line 1841] js_Invoke() [/builds/client/linux22/seamonkey/mozilla/js/src/jsinterp.c line 839] js_InternalInvoke() [/builds/client/linux22/seamonkey/mozilla/js/src/jsinterp.c line 931] js_SetProperty() [/builds/client/linux22/seamonkey/mozilla/js/src/jsobj.c line 2623] js_Interpret() [/builds/client/linux22/seamonkey/mozilla/js/src/jsinterp.c line 2645] js_Invoke() [/builds/client/linux22/seamonkey/mozilla/js/src/jsinterp.c line 856] js_InternalInvoke() [/builds/client/linux22/seamonkey/mozilla/js/src/jsinterp.c line 931] JS_CallFunctionValue() [/builds/client/linux22/seamonkey/mozilla/js/src/jsapi.c line 3431] nsJSContext::CallEventHandler() [/builds/client/linux22/seamonkey/mozilla/dom/src/base/nsJSEnvironment.cpp line 1044] nsJSEventListener::HandleEvent() [/builds/client/linux22/seamonkey/mozilla/dom/src/events/nsJSEventListener.cpp line 182] nsEventListenerManager::HandleEventSubType() [/builds/client/linux22/seamonkey/mozilla/content/events/src/nsEventListenerManager.cpp line 1182] nsEventListenerManager::HandleEvent() [/builds/client/linux22/seamonkey/mozilla/content/events/src/nsEventListenerManager.cpp line 1851] GlobalWindowImpl::HandleDOMEvent() [/builds/client/linux22/seamonkey/mozilla/dom/src/base/nsGlobalWindow.cpp line 764] DocumentViewerImpl::LoadComplete() [/builds/client/linux22/seamonkey/mozilla/content/base/src/nsDocumentViewer.cpp line 929] nsDocShell::EndPageLoad() [/builds/client/linux22/seamonkey/mozilla/docshell/base/nsDocShell.cpp line 4129] nsWebShell::EndPageLoad() [/builds/client/linux22/seamonkey/mozilla/docshell/base/nsWebShell.cpp line 814] nsDocShell::OnStateChange() [/builds/client/linux22/seamonkey/mozilla/docshell/base/nsDocShell.cpp line 197] nsDocLoaderImpl::FireOnStateChange() [/builds/client/linux22/seamonkey/mozilla/uriloader/base/nsDocLoader.cpp line 1234] nsDocLoaderImpl::doStopDocumentLoad() [/builds/client/linux22/seamonkey/mozilla/uriloader/base/nsDocLoader.cpp line 870] nsDocLoaderImpl::DocLoaderIsEmpty() [/builds/client/linux22/seamonkey/mozilla/uriloader/base/nsDocLoader.cpp line 768] nsDocLoaderImpl::OnStopRequest() [/builds/client/linux22/seamonkey/mozilla/uriloader/base/nsDocLoader.cpp line 696] nsLoadGroup::RemoveRequest() [/builds/client/linux22/seamonkey/mozilla/netwerk/base/src/nsLoadGroup.cpp line 694] nsJARChannel::OnStopRequest() [/builds/client/linux22/seamonkey/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp line 610] nsOnStopRequestEvent::HandleEvent() nsARequestObserverEvent::HandlePLEvent() [/builds/client/linux22/seamonkey/mozilla/netwerk/base/src/nsRequestObserverProxy.cpp line 116] PL_HandleEvent() [/builds/client/linux22/seamonkey/mozilla/xpcom/threads/plevent.c line 596] PL_ProcessEventsBeforeID() [/builds/client/linux22/seamonkey/mozilla/xpcom/threads/plevent.c line 1272] processQueue() [/builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsAppShell.cpp line 448] nsVoidArray::EnumerateForwards() [/builds/client/linux22/seamonkey/mozilla/xpcom/ds/nsVoidArray.cpp line 660] nsAppShell::ProcessBeforeID() [/builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsAppShell.cpp line 456] handle_gdk_event() [/builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsGtkEventHandler.cpp line 926] libgdk-1.2.so.0 + 0x170c3 (0x4035f0c3) libglib-1.2.so.0 + 0xffa5 (0x4038dfa5) libglib-1.2.so.0 + 0x105a9 (0x4038e5a9) libglib-1.2.so.0 + 0x10675 (0x4038e675) nsAppShell::DispatchNativeEvent() [/builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsAppShell.cpp line 371] nsXULWindow::ShowModal() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsXULWindow.cpp line 283] nsWebShellWindow::ShowModal() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp line 1109] nsContentTreeOwner::ShowAsModal() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp line 449] nsWindowWatcher::OpenWindowJS() [/builds/client/linux22/seamonkey/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp line 758] nsWindowWatcher::OpenWindow() [/builds/client/linux22/seamonkey/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp line 458] nsProfile::LoadDefaultProfileDir() [/builds/client/linux22/seamonkey/mozilla/profile/src/nsProfile.cpp line 579] nsProfile::StartupWithArgs() [/builds/client/linux22/seamonkey/mozilla/profile/src/nsProfile.cpp line 411] nsAppShellService::DoProfileStartup() [/builds/client/linux22/seamonkey/mozilla/xpfe/appshell/src/nsAppShellService.cpp line 245] netscape-bin + 0x8286 (0x08050286) netscape-bin + 0x8f6b (0x08050f6b) netscape-bin + 0x9887 (0x08051887) libc.so.6 + 0x171c4 (0x405041c4) Source File : /builds/client/linux22/seamonkey/mozilla/widget/src/gtk/nsWindow.cpp line : 2335 10069019 OS: Linux 2.4.18-10 Email: stephend@netscape.com
How does that strack trace track to this bug? You should open a new bug methinks.
Shiva, I had to start testing the trunk, and so I killed that profile instead of wisely just creating a new one. But, it definitely went away with a new profile. Dan Mosedale suggested that a path in my prefs.js was corrupted?
I just downloaded the official linux builds for 1.2a and 1.0.1... Mozilla 1.2a contains the patch and works great on my system. In contrast, drag and drop in Mozilla 1.0.1 is still intermittent. Is it possible to get this patch checked in on the 1.0 branch?
Is this bug fixed on trunk? I don't understand why it's needed for the 1.0.x branch. If this issue is resolved, let's close this bug report.
QA Contact: sairuh → pmac
Glen, please mail the 1.0 branch drivers (drivers@mozilla.org, put "[1.0 branch approval] in the subject line) and request approval for the branch if you want to see this on branch....
Comment on attachment 95885 [details] [diff] [review] fix drag and drop problem for gtk toolkit approved; please change mozilla1.0.2+ to fixed1.0.2 when checked in
Attachment #95885 - Flags: approval1.0.x+
checked in on the branch.
Status: NEW → RESOLVED
Closed: 22 years ago
Keywords: fixed1.0.2
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: