Closed Bug 663667 Opened 13 years ago Closed 11 years ago

TB throws an uncaught error when user cancels file picker during saving of mail attachment (left-clicking)

Categories

(Toolkit :: Downloads API, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ishikawa, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: trunk

Saving of file is initiated by LEFT-clicking on the attachment.
TB responds with "you have chosen to open ...
would you like to save this file [Cancel] [Save File]
Now, the user chooses [Save].
This opens up a "FilePicker"

Then FilePicker shows the list of directories, etc., and
[Cancel] [Save]

Now, if the user hits [Cancel], TB throws an uncaught JavaScript
error which is recorded in Error Console:

Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIHelperAppLauncher.saveToDisk]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///home/ishikawa/TB-3HG/objdir-tb3/mozilla/dist/bin/components/nsHelperAppDlg.js :: <TOP_LEVEL> :: line 458"  data: no]
Source File: file:///home/ishikawa/TB-3HG/objdir-tb3/mozilla/dist/bin/components/nsHelperAppDlg.js
Line: 458



Line 458 is marked with "===>" below.
    else if (aTimer == this._saveToDiskTimer) {
      // Since saveToDisk may open a file picker and therefore block this routine,
      // we should only call it once the dialog is closed.
===>  this.mLauncher.saveToDisk(null, false);  
      this._saveToDiskTimer = null;
    }

Obviously something is wrong, and the uncaught error should be caught.



Reproducible: Always

Steps to Reproduce:
1. Open an e-mail message with an attachment.
2. Left-click on the attachment. And left-click further to show
   the dialog for saving attachment. 
3. Hit [Save file] button.
4. Now you see a "FilePicker" window.
5. Hit [Cancel]

An uncaught error is generated as noted above.


Actual Results:  
As noted above.

Expected Results:  
The uncaught error should be caught IMHO.


A possible patch is uploaded.
But someone in the know should look at this code.

Please note that file in question is worked on to fix other bugs
most notably

Bug 567585 - TB3 fails to raise an error when it tries to save an attachment to write-protected directory. 

The bug reported here is noticed while a fix was tried to fix Bug 567585.
The uncaught error is generated with the pristine untouched nsHelperAppDlg.js
Attached patch A suggested fixSplinter Review
Surround the offending line with try/catch.
I have verified that this at least catch the error, and the
uncaught error no longer appears in Error Console.
nsHelperAppDlg.js is toolkit, so moving this to a more appropriate product/component.
Component: Mail Window Front End → Download Manager
Product: Thunderbird → Toolkit
QA Contact: front-end → download.manager
(In reply to comment #2)
> nsHelperAppDlg.js is toolkit, so moving this to a more appropriate
> product/component.

Aha, thank you for the pointer. I have never realized the category of
the problem as such. But come to think of it, this file is used by both by FireFox and Thunderbird and so toolkit should be it. Thanks.
After more than two years, with the current comm-central, I do not see the issue any more although the
true cause of the original bug is not known.

I am closing it as RESOLVED and WORKSFORME now.

TIA
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: