Closed Bug 1152796 Opened 9 years ago Closed 9 years ago

chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined

Categories

(Thunderbird :: Folder and Message Lists, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 40.0

People

(Reporter: ishikawa, Assigned: neil)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1148369 +++

I get this exception when swithing into SOME of my columns on TB trunk.

Error: invalid 'in' operand colState
Source File: chrome://messenger/content/folderDisplay.js
Line: 598

The code is like this:
if (colChild.id in aColumnStates) {
   let colState = aColumnStates[colChild.id];
   if ("visible" in colState)               <--- error
      shouldBeHidden = !colState.visible;

May 'colState' be null or something that can't be queried with "in" operand?
May this be something caused by bug 36489 where a new column ID was added?
---

It was fixed by a patch posted there, but
then now we have new problems.
From:
https://bugzilla.mozilla.org/show_bug.cgi?id=1148369#c22
(In reply to ISHIKAWA, Chiaki from comment #21)
> (In reply to ISHIKAWA, Chiaki from comment #20)
> > Ooops, sorry.
> > Please disregard the message above.
> > The patch was not properly applied locally: manual 0peration error.
> 
> The patch FIXED the problems. No more TypeError: invalid 'in' operand
> colState.
> 
> TIA

Except that we now see a different problems of the same type.
I think we hit this as we proceed further.

JavaScript error: chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined


Relevant log lines: I picked up TEST- (TEST-START, TEST-PASS, TEST-UNEXPECTED) and the error lines.
The above error may trigger an avalanche of failures.
(Funny, the file and line # are missing. But they all come from the same place as noted above.)

     TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::setupModule
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_single_message_without_backing_view_in_tab
*   TypeError: this._savedColumnStates.correspondentCol is undefined
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_single_message_without_backing_view_in_tab
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_multiple_messages_without_backing_views_in_tabs
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_multiple_messages_without_backing_views_in_tabs
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_message_without_backing_view_in_new_window
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_message_without_backing_view_in_new_window
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_message_without_backing_view_in_existing_window
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_message_without_backing_view_in_existing_window
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_filter_out_all_messages
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_filter_out_all_messages
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_single_message_without_backing_view_in_tab_filtered
*   TypeError: this._savedColumnStates.correspondentCol is undefined
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_single_message_without_backing_view_in_tab_filtered
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_multiple_messages_without_backing_views_in_tabs_filtered
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_multiple_messages_without_backing_views_in_tabs_filtered
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_message_without_backing_view_in_new_window_filtered
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_message_without_backing_view_in_new_window_filtered
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_open_message_without_backing_view_in_existing_window_filtered
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_open_message_without_backing_view_in_existing_window_filtered
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test_cleanup
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::test_cleanup
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | teardownModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js | test-opening-messages-without-a-backing-view.js::teardownModule
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-message-pane-visibility.js | setupModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-message-pane-visibility.js | test-message-pane-visibility.js::setupModule


    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test_between_tab_and_single_message
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test-pane-focus.js::test_between_tab_and_single_message
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test_between_tab_and_multi_message
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test-pane-focus.js::test_between_tab_and_multi_message
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test_after_delete
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test-pane-focus.js::test_after_delete
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | teardownModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-display/test-pane-focus.js | test-pane-focus.js::teardownModule
*   TEST-UNEXPECTED-FAIL | (runtestlist.py) | Exited with code 1 during directory run
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-pane/test-folder-names-in-recent-mode.js | setupModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/folder-pane/test-folder-names-in-recent-mode.js | test-folder-names-in-recent-mode.js::setupModule


    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test_tab_reorder_tabbar
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::test_tab_reorder_tabbar
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test_tab_reorder_window
*   JavaScript error: chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownTest
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::test_tab_reorder_window
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test_tab_reorder_detach
*   JavaScript error: chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownTest
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::test_tab_reorder_detach
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test_tab_undo
*   JavaScript error: chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownTest
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::test_tab_undo
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test_tab_recentlyClosed
*   JavaScript error: chrome://messenger/content/folderDisplay.js, line 697: TypeError: this._savedColumnStates.correspondentCol is undefined
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownTest
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownTest
*   TEST-UNEXPECTED-FAIL | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::test_tab_recentlyClosed
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | teardownModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js | test-tabmail-dragndrop.js::teardownModule
    TEST-START | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-closing.js | setupModule
    TEST-PASS | /REF-COMM-CENTRAL/comm-central/mail/test/mozmill/tabmail/test-tabmail-closing.js | test-tabmail-closing.js::setupModule


(Hmm. Strange. It seems as if mozmill sometimes runs two tests at a time? Oh, one of them is alwys teardown module?)
How to show the error message from the debug build of TB under linux 64-bit.
In my case, I run a debug build of C-C TB 64-bit.

(i) It seems that the error appears *sometimes* during start up once.

(ii) Select a message in a folder, and using the context menu (right button)
to open it in a new tab.
Try opening another message in a different new tab.

Sometimes I get the error message during this process.

(iii) Close TB

Start TB again

(iv) You have the two tabs  which you opened in step (ii) above
open. Close them one by one.
And retry opening  a message in a new tab by selecting a message and
open it in new tab using context menu.
Try another message.
During this process, the error message appears sometimes.

It is hard to figure out what exactly is causing the error path to be taken.

I hope this helps.

TIA
(In reply to ISHIKAWA, Chiaki from comment #1)
> How to show the error message from the debug build of TB under linux 64-bit.
> 


> (iv) You have the two tabs  which you opened in step (ii) above
> open. Close them one by one.

When you close the tab, make sure you click on the tab to make it appear in the front
before deletion.
In my case, I think I can cause the error message to be printed when I click on the
tab to make it appear in font.
(In reply to ISHIKAWA, Chiaki from comment #2)
> (In reply to ISHIKAWA, Chiaki from comment #1)
> > (iv) You have the two tabs  which you opened in step (ii) above open
> 
> In my case, I think I can cause the error message to be printed when I click
> on the tab to make it appear in front.

Yes, I can reproduce the problem now, thanks!
I found that when the error occurs,
 this._getDefaultColumnsForCurrentFolder(true).correspondentCol returns |undefined|,

and when that happens I tried to print
JSON.stringify(top.opener.gFolderDisplay._getDefaultColumnsForCurrentFolder())

but it turns out |top.opener| is undefined, too!
I suspect we are dealing with hidden/invisible folder???

--- temporary modification to the code --
 _restoreColumnStates: function FolderDisplayWidget__restoreColumnStates() {
    if (this._savedColumnStates) {
      // upgrade column states that don't have a correspondent column
      if (!("correspondentCol" in this._savedColumnStates)) {
        dump ("default:" +           this._getDefaultColumnsForCurrentFolder(true).correspondentCol +"\n");
        this._savedColumnStates.correspondentCol =
          this._getDefaultColumnsForCurrentFolder(true).correspondentCol;
        if (this._savedColumnStates.correspondentCol === undefined)
          dump("JSON dump:" + JSON.stringify(top.opener.gFolderDisplay._getDefaultColumnsForCurrentFolder()) +"\n");

        if ((this._savedColumnStates.correspondentCol !== undefined) &&
             this._savedColumnStates.correspondentCol.visible ) {
          if (this._savedColumnStates.senderCol &&

--- end 

output:
...
default:undefined
JavaScript error: chrome://messenger/content/folderDisplay.js, line 701: TypeError: top.opener is null
...


I can avoid (tape over) the error by checking undefined explicitly in the if expression
but if I do so, I will end up with the dreaded
Invalid 'in' operand colState since colState will become |undefined| then on
line 
 if ("visible" in colState)
in setColumnStates in folderDisplay.js

Something is amiss. 

TIA
(In reply to ISHIKAWA, Chiaki from comment #4)

Minor correction:
 
> but it turns out |top.opener| is undefined, too!
> I suspect we are dealing with hidden/invisible folder???

It was null as you could see from the output.

> output:
> ...
> default:undefined
> JavaScript error: chrome://messenger/content/folderDisplay.js, line 701:
> TypeError: top.opener is null
> ...
> 

TIA
Blocks: 1154744
Attached patch Proposed patchSplinter Review
This seems to have shut the test up.
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=caafdea04e90
Attachment #8593103 - Flags: review?(mkmelin+mozilla)
Comment on attachment 8593103 [details] [diff] [review]
Proposed patch

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

::: mail/base/content/folderDisplay.js
@@ +691,5 @@
>      if (this._savedColumnStates) {
>        // upgrade column states that don't have a correspondent column
> +      if ((this._savedColumnStates.senderCol ||
> +           this._savedColumnStates.recipientCol) &&
> +          !this._savedColumnStates.correspondentCol) {

won't you get a warning for this in strict mode?
or did you have a reason not to use "in"?
(In reply to Magnus Melin from comment #7)
> or did you have a reason not to use "in"?
I was originally worried that it could be null but as it turns out that's not allowed.
Attachment #8593103 - Flags: review?(mkmelin+mozilla) → review+
Neil, will you change the patch or is it ready for check-in?

I also like "in" more, but I think the JS engine does not warn if non-existent properties are only tested for inside an "if()".
Assignee: nobody → neil
Status: NEW → ASSIGNED
Blocks: 1152286
Pushed comm-central changeset 1def1e9c2d71.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 40.0
Great, several groups of mozmill failures vanished.
You need to log in before you can comment on or make changes to this bug.