Last Comment Bug 670976 - aFolder is undefined - in folderWidgets.xml
: aFolder is undefined - in folderWidgets.xml
Status: VERIFIED FIXED
: testcase
Product: Thunderbird
Classification: Client Software
Component: Folder and Message Lists (show other bugs)
: 8 Branch
: All All
: -- normal (vote)
: Thunderbird 13.0
Assigned To: :aceman
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-12 10:16 PDT by Mitra Ardron
Modified: 2012-04-24 12:50 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
-


Attachments
patch experiment (1.78 KB, patch)
2012-02-16 12:21 PST, :aceman
mozilla: review+
Details | Diff | Splinter Review

Description Mitra Ardron 2011-07-12 10:16:02 PDT
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330

Steps to reproduce:

No idea what I did, but I see multiple errors 

Error: aFolder is undefined
Source File: chrome://messenger/content/folderWidgets.xml
Line: 691

I'm not seeing broken functionality except with Spotlight searcing which seems unrelated -

I'm running nightlies of Miramar 5.0b2pre (this new bugzilla interface doesn't seem to allow that to be input anywhere :-(
Comment 1 Ludovic Hirlimann [:Usul] 2011-07-13 01:13:47 PDT
Do you also have it if you start in -safe-mode ? (And I'm assuming you aren't running powerpc, right ?)
Comment 2 Mitra Ardron 2011-07-13 15:39:57 PDT
Its intermitent anyway - for example I restarted about 15 mins ago, and don't see it in the Error Console currently. If/when I can figure out what is causing the Error I can restart in -safe-mode (presuming I can figure out how to do that :-) and try and repeat.
Comment 3 bruno da silva 2011-08-22 00:44:59 PDT
Hi,
I have also it undeder windows seven (thunderbird 6)

Erreur : aFolder is undefined
Fichier Source : chrome://messenger/content/folderWidgets.xml
Ligne : 691
Comment 4 mail@duckpondwebs.com 2011-10-06 16:46:57 PDT
I also have this error on Thunderbird 7.1 on XP.
Comment 5 mail@duckpondwebs.com 2011-10-06 16:47:36 PDT
I also have this error on Thunderbird 7.1 on XP.

Error: aFolder is undefined
Source File: chrome://messenger/content/folderWidgets.xml
Line: 691
Comment 6 Philipp Kewisch [:Fallen] 2011-10-07 02:56:14 PDT
Still confirmed on Thunderbird 8.0b1 and it looks kind of ugly for a release. Don't you want to fix this bug? :-)
Comment 7 Mark Banner (:standard8) 2011-10-07 04:04:55 PDT
Well getting a testcase or something would help.
Comment 8 Mark Banner (:standard8) 2011-10-07 07:43:45 PDT
Not tracking unless there's visible side effects of this.
Comment 9 :aceman 2011-10-20 13:06:06 PDT
I can also see this on Linux, TB7/8. It happens for example when a filter is moving a message. I get the error message for each moved message (not each tested). The filter is simple "subject-contains-word,move_to_folder-X".
Comment 10 Wayne Mery (:wsmwk, NI for questions) 2011-10-21 08:55:38 PDT
Mitra, isn't this a regression??
Comment 11 :aceman 2011-10-21 09:00:41 PDT
But I must say I forgot to enable safe mode, will check that later.
Comment 12 :aceman 2011-10-21 11:47:38 PDT
Reproduced in safe mode too. It happens only when going into Message filters and clicking Run Now (the filter from comment 9 pre-selected).
Can anybody confirm?
Comment 13 Mitra Ardron 2011-10-21 20:08:50 PDT
A regression - not quite sure what you mean? Error console always has lots of errors so i don't track it, it may have gone away and come back, or it might always have been there.  The error message could be a LOT more descriptive of what causes it, but I guess its hard since its buried in a function and looks like its the caller that causes the error. 

? I just tried manually running a filter with a "Move" and had the same error show up.  

Good thing now, is that it was intermittent for me, but @aceman has found a repeatable case.
Comment 14 Kent James (:rkent) 2011-10-28 09:01:04 PDT
"Not tracking unless there's visible side effects of this."

I first started looking in the error console for problems, and found this error and related bug, because I was having cases where, after I clicked on a folder, an empty view came up, or nothing seemed to change. I would be curious if others have experienced this as well.
Comment 15 :aceman 2011-12-02 11:06:12 PST
I can still see it on the testcase from comment 9 on TB11, linux. However, the Error console seems to be temporarily broken, it doesn't show the filename, just line number (still the same as in TB8).
Comment 16 :aceman 2011-12-10 15:53:55 PST
I have instrumented the callers of _setCssSelectors and have found something.
When copying messages in a filter, the error does not appear for every message, but only for some of them (on my test sample, it is always 3 times even when slightly changing filter condition). But when it happens I could track down the caller to this spot:
folderWidgets.xml:
        OnItemIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
          var child = this._getChildForItem(aItem);
          if (child) {
            this._menu._setCssSelectors(child._folder, child); }
        },

Here, child._folder is undefined. aItem.name contains the name of the folder into which the messages are copied.

When not running filters, the error comes up just when a folder is selected by mouse. Then, aItem.name contains the name of this folder.

I have not seen any other place calling the function with the first argument set to "undefined".

Can anybody continue from here?
Comment 17 Kent James (:rkent) 2011-12-16 13:52:10 PST
I don't understand how those functions work, or ever worked. Note they were changed recently (4/2011) by bienvenu in bug 370324.

child = _getChildForItem claims it returns a menuitem, but actually returns aItem which is an nsIMsgFolder. So child._folder makes no sense. But surely I must be confused about something?
Comment 18 :aceman 2011-12-16 14:14:00 PST
May they be called when the number of unread messages in a folder increases?
Comment 19 Wayne Mery (:wsmwk, NI for questions) 2011-12-16 14:43:34 PST
We have a user new to thunderbird seeing this for both manual and automatic filter
 Error: aFolder is undefined
 Source File: chrome://messenger/content/folderWidgets.xml
 Line: 691 
for a filter of an imap inbox with filter condition
  from contains xxxx
and action
  move to yyy on same imap account

Is it worth testing whether it does not fail if the target folder is not imap?
Comment 20 WADA 2011-12-30 11:51:08 PST
I could see the error consistently by "copy of a mail via context menu".
(0) Create new profile by Tb 9.1.0,
    define a dummy POP3 account and a dummy IMAP account.
    ("Local Folders" only is perhaps sufficient) 
(1) Restart Tb 9.0.1, open Error Console.
Following error is always seen.
> Error: no element found
> Source File: https://testpilot.mozillalabs.com/testcases/index-tb.json
> Line: 1
(2) Select folder A of Local Folders, select a mail,
    at Context menu of the mail, Copy To, select folder B of Local Folders.
    => Two next error is shown in Error Console.
> Error: aFolder is undefined
> Source File: chrome://messenger/content/folderWidgets.xml
> Line: 691
(3) Once this error occurs, this error always occurs when "move mail by Drag&Drop"(3 errors), "copy mail by Ctrl+Drag&Drop"(2 errors), "copy/move mail via Context menu"(3 errors), "Delete mail in local mail folder"(2 errors), "Run Filters on Folder with action=MoveToFolder, action=Delete" and so on.
Comment 21 :aceman 2012-01-05 03:36:51 PST
WADA, were you able to see any problems caused by this? Any function not working after this error appears?
Comment 22 WADA 2012-01-19 21:17:57 PST
(In reply to :aceman from comment #21)
> WADA, were you able to see any problems caused by this? Any function not
> working after this error appears?

I didn't see "function not working after this error" in test. I only experienced annoyance of "once this error occurs, this error always occurs when specfic operations until restart of Tb".  

In bug 713380, a typo was found in msgHdrViewOverlay.js. See bug 713380 comment #13. This may be relevant.
> fix typo in msgHdrViewOverlay.js
> -      return this.mProperties[property];
> +      return this.mProperties[aProperty];
Comment 23 WADA 2012-01-19 21:34:44 PST
I did same test as comment #20 with same profile used in the test.
(1) trunk 20120114 build. patch of bug 713380 is not checked in yet.
> Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120114 Thunderbird/12.0a1
Problem was reproduced.
(2) trunk 20120119 build. patch of bug 713380 is checked in on 1/17.
> Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120119 Thunderbird/12.0a1
Problem was not reproduced.

The typo was perhaps one of main culprits.
Comment 24 :aceman 2012-01-20 00:37:47 PST
Pity there is no checking of existence of identifiers in JS (as in C). It will break only when the code is actually reached at runtime.
Comment 25 WADA 2012-01-21 00:43:58 PST
Test result in comment #23 was wrong. Test procedure was diffirent from original and I didn't check with "Copy To". Following error is still occurs when "Copy To" is executed. Sorry for wrong report.
> Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120119 Thunderbird/12.0a1
> Timestamp: 2012/01/21 17:36:53
> Error: aFolder is undefined
> Source File: chrome://messenger/content/folderWidgets.xml
> Line: 691
Comment 26 :aceman 2012-01-21 12:36:11 PST
I wonder why that <method name="_setCssSelectors"> in folderWidgets.xml doesn't use getSpecialFolderString(aFolder) from folderUtils.jsm. Looks like duplicated code.
Comment 27 :aceman 2012-02-16 08:38:20 PST
(Filed bug 727851 for that.)

I can also consistently reproduce this error on TB13 when copying a message from a normal folder to a special one (like Junk) in Local Folders.
Comment 28 :aceman 2012-02-16 12:21:14 PST
Created attachment 597951 [details] [diff] [review]
patch experiment

(In reply to Kent James (:rkent) from comment #17)
> child = _getChildForItem claims it returns a menuitem, but actually returns
> aItem which is an nsIMsgFolder. So child._folder makes no sense. But surely
> I must be confused about something?

Thanks for the hint! So I changed the _getChildForItem to really return the menuitem, so that ._folder can be called on it. Also 'child' was passed as the second argument to _setCssSelectors which should have been a menuitem, but wasn't (it was a aItem=nsIMsgFolder per comment in _getChildForItem). The error message is no more (on the STR I have described).
However if we haven't seen any problems caused by the error, we now can't see if the patch solves anything.

WADA, rkent, can you try the patch if it causes any problems?
Comment 29 :aceman 2012-02-16 12:48:44 PST
I noticed when I alter _setCssSelectors to always set "SpecialFolder" to "none" then it causes special icons of folders (like the flame for Junk) to be lost in the right-click -> Copy To -> folder picker . So that is one place where this function comes into play.
Comment 30 David :Bienvenu 2012-02-17 15:11:37 PST
Comment on attachment 597951 [details] [diff] [review]
patch experiment

thx, makes sense, and this also seems to get rid of the error, and things seem to basically still work.
Comment 31 Mark Banner (:standard8) 2012-02-21 05:32:47 PST
Checked in: http://hg.mozilla.org/comm-central/rev/61302b689327

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