As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact
Last Comment Bug 735542 - fetchCustomMsgAttribute causes logoff
: fetchCustomMsgAttribute causes logoff
: imap-interop, testcase
Product: MailNews Core
Classification: Components
Component: Networking: IMAP (show other bugs)
: Trunk
: All All
: -- normal (vote)
: Thunderbird 14.0
Assigned To: David Lechner (:dlech)
Depends on:
  Show dependency treegraph
Reported: 2012-03-13 18:10 PDT by David Lechner (:dlech)
Modified: 2012-04-23 13:36 PDT (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

fetchCutomMsgAttribute_test.js (759 bytes, text/javascript)
2012-03-13 18:10 PDT, David Lechner (:dlech)
no flags Details
tail of imap log file (1.17 KB, text/plain)
2012-03-13 18:11 PDT, David Lechner (:dlech)
no flags Details
proposed patch (1.03 KB, patch)
2012-03-26 20:37 PDT, David Lechner (:dlech)
mozilla: review+
standard8: approval‑comm‑aurora+
Details | Diff | Splinter Review

Description User image David Lechner (:dlech) 2012-03-13 18:10:14 PDT
Created attachment 605620 [details]

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Build ID: 20120215223356

Steps to reproduce:

I am trying to use the nsIMsgImapMailFolder.fetchCustomMsgAttribute function in javascript to get the X-GM-LABELS attribute for a message from Gmail via imap. See attached .js file.

Actual results:

When the function is called, the results that are parsed cause a syntax error. As a result of this error, a logout command is sent to the imap server, so I loose my idle connection and the next command is slow because Thunderbird has to log back in to the server.

Expected results:

As far as I can tell, there is not a syntax error in the response from the server, so the function should complete successfully.

Also, sending the logout command on a syntax error is debatable.
Comment 1 User image David Lechner (:dlech) 2012-03-13 18:11:40 PDT
Created attachment 605621 [details]
tail of imap log file
Comment 2 User image David Lechner (:dlech) 2012-03-13 18:22:57 PDT
To reproduce the error, you will need a gmail imap account setup in Thunderbird. There are lots of instructions available on how to do this, so I won't spend time writing it here.

You will also need the Extension Developers Extension or another way to inject javascript into XUL.

1. Run Thunderbird with imap logging enabled. See:
2. Open a gmail message.
3. Run the attached .js file. Using the Extension Developer's Extension: Tools > Extension Developer > JavaScript Injector, browse for the selected file, select chrome://messenger/content/messenger.xul and click "Execute!"
4. A message box should show with the results of the call. It shows successful.
4. Open your imap.log file. You should see the syntax error and logout command just like the attached file.
Comment 3 User image Magnus Melin 2012-03-14 00:02:03 PDT
Did you try with the latest thunderbird nightly build?
Comment 4 User image David Lechner (:dlech) 2012-03-14 18:22:16 PDT
just tried it with


and got the same results.
Comment 5 User image David Lechner (:dlech) 2012-03-26 20:37:18 PDT
Created attachment 609596 [details] [diff] [review]
proposed patch

I found a break statement in a while loop that I don't think should be there.
Comment 6 User image David Lechner (:dlech) 2012-03-31 06:26:54 PDT
I probably should have mentioned that I actually compiled Thunderbird with the patch and verified that it fixed the problem.
Comment 7 User image David Lechner (:dlech) 2012-04-14 10:33:10 PDT
Is there anything else I need to be doing to help move this along? Perhaps this is wishful thinking, but I was hoping that this could be included in the next release (TB12) so that I can continue development on an extension.
Comment 8 User image Jim Porter (:squib) 2012-04-14 11:16:26 PDT
(In reply to David Lechner from comment #7)
> Is there anything else I need to be doing to help move this along? Perhaps
> this is wishful thinking, but I was hoping that this could be included in
> the next release (TB12) so that I can continue development on an extension.

Tests would help, though I'm not the right person to talk to about that, since my knowledge of Thunderbird's network code is slim to none.
Comment 9 User image David Lechner (:dlech) 2012-04-14 11:20:57 PDT
There are no tests that call the nsIMsgImapMailFolder.fetchCustomMsgAttribute function. Does that mean I need to write one?
Comment 10 User image David :Bienvenu 2012-04-16 16:30:13 PDT
Comment on attachment 609596 [details] [diff] [review]
proposed patch

[Approval Request Comment]

thx for the patch, sorry it took a while to get to it. I don't think we're going to take this for beta since we're going to ship in a week, but I'd consider it for alpha, which will go into beta in a week.
Comment 11 User image David :Bienvenu 2012-04-16 16:31:02 PDT
fixed on trunk -
Comment 12 User image Mark Banner (:standard8) 2012-04-23 13:36:11 PDT
Checked in:

Note You need to log in before you can comment on or make changes to this bug.