Closed Bug 343268 Opened 19 years ago Closed 16 years ago

DnD month view: Uncaught exception if Drag and Drop is aborted with Escape key

Categories

(Calendar :: Internal Components, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ssitter, Assigned: Taraman)

References

Details

(Whiteboard: [good first bug])

Attachments

(2 files, 1 obsolete file)

Fall out from Bug 312736: DnD month view: Uncaught exception if Drag and Drop is aborted with Escape key Steps to Reproduce: 1. Switch to Month view 2. Create event 3. Drag event and abort Drag and Drop operation by pressing the Escape key Actual Results: Drop shadow is displayed on last position. Event is not displayed. After refresh of view the event is displayed again but Drag and Drop is not possible anymore. JavaScript console shows: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDragService.invokeDragSession]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://calendar/content/calendar-month-view.xml :: onxbldraggesture :: line 164" data: no] Expected Results: Drag and Drop operation is aborted gracefully. Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060630 Sunbird/0.3a2+
This is WFM, although I can see code in nsDragAndDrop.js related to it. Is this platform specific?
(In reply to comment #1) Using Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060630 Sunbird/0.3a2+ I don't see the exception but the other steps listed above in 'Actual Results'. (But that steps apply to almost every DnD problem reported.) Using Thunderbird 1.5.0.4 (20060516) and Lightning 0.1+ (20060630) on Windows shows the same exception.
The bugspam monkeys have struck again. They are currently chewing on default assignees for Calendar. Be afraid for your sanity!
Assignee: base → nobody
When the patch in bug 343190 lands, we're going need to do more here than just catch().
Depends on: 343190
Retest with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a2pre) Gecko/20070112 Calendar/0.4a1: Aborting Drag and Drop operation by pressing the Escape key still results in the error message shown in Comment #0. But: After that the event is now displayed on original date. Further Drag and Drop operation is possible. This was probably fixed by checkin for Bug 343190.
Severity: normal → minor
Retest with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20081219 Calendar/1.0pre (BuildID: 20081219033507) Aborting Drag and Drop operation by pressing the Escape key still results in the same error message but new location: Error: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDragService.invokeDragSession] Source file: chrome://calendar/content/calendar-dnd-listener.js Line: 571 Afterwards the drop shadow is still displayed in the view. But event is displayed on original date. Further Drag and Drop operation is possible.
Flags: blocking-calendar1.0?
Attached patch Fix - v1 (obsolete) β€” β€” Splinter Review
I found no exception, but a warning. This patch gets rid of the warning.
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Attachment #367571 - Flags: review?(ssitter)
Flags: blocking-calendar1.0? → blocking-calendar1.0+
I can still reproduce using Lightning 1.0pre (BuildID: 20090316031544) with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090316 Shredder/3.0b3pre: [[[ Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDragService.invokeDragSession]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://calendar/content/calendar-dnd-listener.js :: invokeEventDragSession :: line 630" data: no] ]]] Maybe different drag'n'drop behavior Windows vs. Linux?
Comment on attachment 367571 [details] [diff] [review] Fix - v1 What warning did you saw? Maybe |return false| should be just |return;|? The same check is used in dragenter/dragdrop and I'd like to keep them similar if possible.
Warning: function onxbldragover does not always return a value Source File: chrome://calendar/content/widgets/calendar-widgets.xml Line: 375, Column: 31 Source Code: This is the warning, it shows up when dragging in the month view. For multiday view right now I can't seem to cancel the drag at all!?
Attachment #367571 - Flags: review?(ssitter) → review-
Comment on attachment 367571 [details] [diff] [review] Fix - v1 I'd keep the if clause as used in dragover, dragenter and dragdrop handler but change |return false;| to just |return;|
Like so?
Attachment #367571 - Attachment is obsolete: true
Attachment #371065 - Flags: review?(ssitter)
Attachment #371065 - Attachment description: Fix - v2 → Fix warning - v2
Attachment #371065 - Flags: review?(ssitter) → review+
Comment on attachment 371065 [details] [diff] [review] [checked in] Fix warning - v2 I guess this should work r=ssitter
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/b08051438f9f> -> FIXED
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
OS: Windows 2000 → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → 1.0
Reopening because the patch fixes only the warning but not the exception. Lightning/1.0pre (BuildID: 20090408054113) with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090408 Shredder/3.0b3pre: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDragService.invokeDragSession]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://calendar/content/calendar-dnd-listener.js :: invokeEventDragSession :: line 652" data: no]
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Since I cannot reproduce the Exception on Linux, it would be nice if someone else could give it a try.
Assignee: philipp → nobody
Status: REOPENED → NEW
OS: All → Windows XP
Hardware: All → x86
I debugged it on Windows, but couldn't find a solution. But I had some findings which may help the more skilled: When cancelling a drag - by either pressing ESC or letting the mouse button go in an area with no target - <handler event="dragend"> in [1] is called. While executing this everything is equal in both cases. but in continuation after there is a difference: When cancelling with ESC: Execution continues directly with <handler event="mouseover"> in [2] and in that exact same moment the exception is thrown. When dropping with no target: Execution jumps back to [3] - the location the exception states - then back to <handler event="draggesture"> in [4]. Only after that it jumps to <handler event="mouseover"> in [2] So the exception somehow comes from not returning to the right function call? I believe it is not a problem in the Views, but in the backend code since it only appears on windows. [1]: Line 443 of calendar-widgets.xml http://mxr.mozilla.org/comm-central/source/calendar/base/content/widgets/calendar-widgets.xml#443 [2]: Line 352 of calendar-view-core.xml http://mxr.mozilla.org/comm-central/source/calendar/base/content/calendar-view-core.xml#352 [3]: Line 652 of calendar-dnd-listener.js which is Line 655 in MXR for some reason http://mxr.mozilla.org/comm-central/source/calendar/base/content/calendar-dnd-listener.js#655 [4]: Line 369 of calendar-view-core.xml http://mxr.mozilla.org/comm-central/source/calendar/base/content/calendar-view-core.xml#369
Looking at http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/d77750c8a7b8/widget/src/windows/nsDragService.cpp there are a few case where a NS_ERROR_FAILURE may occur: * nsBaseDragService fails (line 196) - nsIDragService's suppress() was called previously without unsuppress() * The number of items in the array is 0 (line 209) * Creating the native data object fails (line 232,246) * StartInvokingDragSession fails (line 263) - The native DND fails (line 316, 390) Markus, could you check if the array of items passed to invokeDragService() is greater zero ?
In calendar the array is always one (at least in the cases I tried.) The invokeDragService() function is always called at the beginning of the drag-action. So it should not be a difference if I later on cancel the drag with ESC or not.
What I forgot in the last comment: Even if you mark more than one item and drag, only the item under the mouse on start of drg is dragged. Maybe this is a bug itself. Further research showed, that the exception is thrown by StartInvokingDragSession() at [1] [1]: http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/d77750c8a7b8/widget/src/windows/nsDragService.cpp#l390
Did you actually check this with a C debugger? In that case we should probably fix this bug by catching the exception and ignoring it, and file a core bug to find out why http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/d77750c8a7b8/widget/src/windows/nsDragService.cpp#l316 fails. They might tell us that the old dnd api is out of date though, so we might want to try moving to the new dom event driven dnd api.
I checked it a little unusual by changing the type of exception in that line. I got the altered exception - thus it must be coming from this line. If you look at http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/d77750c8a7b8/widget/src/windows/nsDragService.cpp#l348 you see that here the same compare statement leads to execution or cancellation of the drag&drop action which is used to return success or the exception at the end. This seems to me, that the exception is normal behaviour of the nativeDragService and we must handle it. By the way - if you try to drag a task in the task mode and press ESC, the same exception is thrown.
This patch adds error Handling code to the call of the nativeDragService's "invokeDragSession" function. (See above comments.)
Attachment #371065 - Attachment is obsolete: true
Attachment #375488 - Flags: review?(philipp)
Assignee: nobody → MarkusAdrario
Status: NEW → ASSIGNED
Attachment #371065 - Attachment description: Fix warning - v2 → [checked in] Fix warning - v2
Attachment #371065 - Attachment is obsolete: false
Comment on attachment 375488 [details] [diff] [review] [checked in] error Handling to fix Exception >+ } >+ catch (error) { Only a small nit, our style guide uses: } catch() { I'll fix this before checkin. r=philipp
Attachment #375488 - Flags: review?(philipp) → review+
Attachment #375488 - Attachment description: error Handling to fix Warning → [checked in] error Handling to fix Exception
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/790cf8238238> -> FIXED
Status: ASSIGNED → RESOLVED
Closed: 16 years ago16 years ago
OS: Windows XP → All
Hardware: x86 → All
Resolution: --- → FIXED
Verified fixed using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1pre) Gecko/20090611 Calendar/1.0pre (BuildID: 20090611031611)
Status: RESOLVED → VERIFIED
Target Milestone: 1.0 → 1.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: