Closed Bug 696186 Opened 13 years ago Closed 4 years ago

canceling folder delete throws an exception

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 72.0

People

(Reporter: aceman, Assigned: iannbugzilla)

Details

(Whiteboard: [regression:TB??])

Attachments

(1 file, 1 obsolete file)

If I delete a folder that is the target of a filter (move messages to) I get the prompt "Are you sure you want to delete the folder X?", then I get prompt "Deleting the folder 'X' will disable its associated filter(s). Are you sure you want to delete the folder?" After canceling this prompt the following exception is thrown:

Error: uncaught exception: [Exception... "Component returned failure code: 0x8055001a [nsIMsgFolder.deleteSubFolders]"  nsresult: "0x8055001a (<unknown>)"  location: "JS frame :: chrome://messenger/content/folderPane.js :: ftc_delete :: line 2231"  data: no]

This is a normal operation. Can't the negative answer in the dialog be handled cleanly?
Component: Mail Window Front End → Folder and Message Lists
QA Contact: front-end → folders-message-lists
This seems to have gotten broken since the report. In current TB18 I get this:
1. I attempt to delete a folder.
2. I get the prompt "Are you sure you want to delete the folder X?"
3. I confirm and the folder is moved to Trash without further prompts.
4. The filter is automatically updated to point to the folder in Trash.
5. Deleting the folder from Trash goes without any warning.
6. The filter now points to nowhere. Editing it shows an empty folder picker as the Move to target. Clicking OK says I must select a target folder.

The exception in comment 0 still occurs but I must Cancel the first warning of "Are you sure you want to delete the folder X?".

Maybe this got broken by the pluggable mailstores changes?
> Maybe this got broken by the pluggable mailstores changes?
still see it?
Whiteboard: [regression:TB??]

Still happening

Component: Folder and Message Lists → Backend
Product: Thunderbird → MailNews Core
Version: 8 Branch → 8

So nsMsgLocalMailFolder::CopyFolderLocal in mailnews/local/src/nsLocalMailFolder.cpp returns NS_MSG_ERROR_COPY_FOLDER_ABORTED when the user cancels the copy.
This means nsMsgLocalMailFolder::DeleteSubFolders returns this result causing the error message in the console.

OS: Linux → All
Hardware: x86 → All
Assignee: nobody → iann_bugzilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch Swallow the abort (obsolete) — Splinter Review

Potentially we might want to log this in some way (through MOZ_LOG perhaps?)

Attachment #9111061 - Flags: review?(acelists)

Might be better to have this within the if (folder) statement and set rv = NS_OK
Or just put a try/catch around the call to DeleteSubFolders

Comment on attachment 9111061 [details] [diff] [review]
Swallow the abort

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

Thanks, NS_MSG_ERROR_COPY_FOLDER_ABORTED seems to only be generated when user aborts the deletion.

The question is whether it is OK to report success from the nsMsgLocalMailFolder::DeleteSubFolders() when no folders were deleted. Caller may expect deletion was done when it wasn't (whatever the reason).
Maybe we should catch the error higher in the stack, maybe in the UI, in folderPane.js?
Attached patch try and catchSplinter Review

Let's use a try/catch around this caller instead (similar to the test in test_nsIMsgLocalMailFolder.js).

Attachment #9111061 - Attachment is obsolete: true
Attachment #9111061 - Flags: review?(acelists)
Attachment #9111779 - Flags: review?(acelists)
Comment on attachment 9111779 [details] [diff] [review]
try and catch

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

Thanks.
We already have such treatment at https://searchfox.org/comm-central/source/suite/mailnews/content/mail3PaneWindowCommands.js#959 .
Attachment #9111779 - Flags: review?(acelists) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/c006cb1d5b5b
canceling folder delete throws an exception r=aceman

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 72.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: