Closed Bug 904719 Opened 11 years ago Closed 11 years ago

items is undefined in cloudAttachmentLinkManager.js

Categories

(Thunderbird :: Message Compose Window, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 26.0

People

(Reporter: aceman, Assigned: aceman)

Details

Attachments

(1 file, 1 obsolete file)

Error: items is undefined
Source file: chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js
Line: 108

I get this when composing a message and then closing it without saving or sending.

There is also another error, which I am not sure is related:
Error: gMsgCompose is null
Source file: chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js
Line: 32

The code causing this was there since the beginning of the file (http://hg.mozilla.org/comm-central/rev/42e362b0c7c6) but I don't know why the error was not produced at that time and only started to show recently.
Attached patch patch (obsolete) — Splinter Review
So this would fix the error but I don't know if it does not hide some real error causing this problem (as this only started recently).
Attachment #789709 - Flags: review?(mkmelin+mozilla)
Attachment #789709 - Flags: review?(mconley)
I'd bet the "gMsgCompose is null" is related, and likely sorting that out could fix the "items is undefined" too.
I can't review this on Win XP with latest Earlybird (and a recent Daily). Is it still reproducible on your machine?
(In reply to Archaeopteryx [:aryx] from comment #3)
> I can't review this on Win XP with latest Earlybird (and a recent Daily). Is
> it still reproducible on your machine?

There is something fishy going on here.

---
From |make mozmill| test under Debian GNU/linux (64bits, but I think
this is common to 32bits) recorded this morning.


I get these errors (errors with NS_* error code):

     28 [Exception... "'[JavaScript Error: "nBox.getNotificationWithValue is not a function" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 1822}]' when calling method: [nsITimerCallback::notify]"	nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]
     21 [Exception... "'[JavaScript Error: "items is undefined" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 108}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"	data: yes]
     13 [Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"	data: yes]
     10 [Exception... "'[JavaScript Error: "this._settings.contentDocument.body is undefined" {file: "chrome://messenger/content/cloudfile/addAccountDialog.js" line: 118}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]
      3 [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIInlineSpellChecker.ignoreWords]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: observe :: line 2842"  data: no]
      3 [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgMailNewsUrl.server]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: resource:///modules/activity/alertHook.js :: alertHook.onAlert :: line 48"  data: no]
      3 [Exception... "'[JavaScript Error: "this.view.displayedFolder is null" {file: "chrome://messenger/content/folderDisplay.js" line: 1071}]' when calling method: [nsIMsgSearchNotify::onSearchDone]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"	 location: "JS frame :: resource:///modules/searchSpec.js :: SearchSpec_dissociateView :: line 141"  data: yes]
      2 [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIMsgDBView.getMsgHdrsForSelection]"  nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"	 location: "JS frame :: chrome://messenger/content/folderDisplay.js :: FolderDisplayWidget.prototype.selectedMessages :: line 2028"  data: no]
      2 [Exception... "'[JavaScript Error: "this.folderDisplay.view.dbView is null" {file: "chrome://messenger/content/messageWindow.js" line: 251}]' when calling method: [nsIMsgDBViewCommandUpdater::summarizeSelection]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource:///modules/dbViewWrapper.js :: DBViewWrapper__createView :: line 1047"  data: yes]
      2 [Exception... "'[JavaScript Error: "items is undefined" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 108}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: dispatchAttachmentBucketEvent :: line 4471"	data: yes]
      2 [Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: gComposeRecyclingListener.onClose :: line 234"  data: yes]
      2 + name (string) 'NS_ERROR_INVALID_POINTER'
      2 + message (string) 'Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIMsgDBView.getMsgHdrsForSelection]'
      1 [Exception... "'[JavaScript Error: "overlay is null" {file: "chrome://messenger/content/plugins.js" line: 106}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"	location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"	 data: yes]
      1 [Exception... "'[JavaScript Error: "document.getElementById(...) is null" {file: "chrome://messenger/content/chat/imStatusSelector.js" line: 36}]' when calling method: [nsIObserver::observe]"	 nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource:///modules/chatHandler.jsm :: ChatCore.init/<.onPromptStart :: line 74"  data: yes]

"gMsgCompose is NULL" is at the thrid position in terms of frequency.

The source version is about a week old.
/COMM-CENTRAL/comm-central
hg identify
1354ac5484d5 format-llu-2-lu-fix.patch/qtip/tip

/COMM-CENTRAL/comm-central/mozilla
hg identify
9d3d525ee502 mWALModeEnabled-initialization.patch/qtip/tip


Excerpt from the log :	one test target that
test_can_quit_on_changes

Oh, I didn't realize the error message about

		     SyntaxError: illegal character
before (!)

I checked the logs and found that the log I recorded on Aug 27th
started to record this whereas older logs on Aug 20, Aug 16, and
earlier didn't. So this is a recent addition!
log219-mozmill-original-comm-central.txt:579:                     SyntaxError: illegal character
log219-mozmill-original-comm-central.txt:618:                     SyntaxError: illegal character
log219-mozmill-original-comm-central.txt:640:                     SyntaxError: illegal character
			  ....

Let me investigate a little more.

BTW, if I search for SyntaxError, I get another set of disturbing hits about
log103-mozmill-original.txt:52472:                     SyntaxError: JSON.parse: unexpected end of data
log104-mozmill-original-fixed-stack.txt:37028:		     SyntaxError: JSON.parse: unexpected end of data
But this set of errors have been present since the logs from Late March
    this year.
/FF-NEW/log53.txt:28694:		     SyntaxError: JSON.parse: unexpected end of data
/FF-NEW/log55.txt:34001:                     SyntaxError: JSON.parse: unexpected end of data
but were not in early March this year.

I will try to come up with what are causing these illegal character
and unexpected end of data.
(It is possible that my local repository got messed up.)


---
TEST-START | /COMM-CENTRAL/comm-central/mail/test/mozmill/composition/test-save-changes-on-quit.js | test_can_quit_on_changes
Step Pass: {"function": "Controller.keypress()"}
++DOCSHELL 0x166d0c0 == 26 [id = 61]
++DOMWINDOW == 81 (0x5125f48) [serial = 150] [outer = (nil)]
++DOCSHELL 0x47d7a10 == 27 [id = 62]
++DOMWINDOW == 82 (0x32fee58) [serial = 151] [outer = (nil)]
++DOCSHELL 0x4270eb0 == 28 [id = 63]
++DOMWINDOW == 83 (0x6683d68) [serial = 152] [outer = (nil)]
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 84 (0x5d97958) [serial = 153] [outer = 0x5125f48]
++DOMWINDOW == 85 (0x13c7c18) [serial = 154] [outer = 0x32fee58]
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 86 (0x3be6678) [serial = 155] [outer = 0x6683d68]
++DOMWINDOW == 87 (0x4ec5788) [serial = 156] [outer = 0x32fee58]
WARNING: NS_ENSURE_TRUE(aSelection->GetRangeCount()) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3806
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3785
WARNING: NS_ENSURE_SUCCESS(res, res) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp, line 316
WARNING: NS_ENSURE_TRUE(sheet) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2955
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
++DOMWINDOW == 88 (0x596c1e8) [serial = 157] [outer = 0x5125f48]
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "nBox.getNotificationWithValue is not a function" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 1822}]' when calling method: [nsITimerCallback::notify]"	nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]
************************************************************
System JS : ERROR chrome://messenger/content/addressbook/abResultsPane.js:193
		     SyntaxError: illegal character
--DOMWINDOW == 87 (0x5155b88) [serial = 104] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 86 (0x33955c8) [serial = 113] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 85 (0x4d2e8a8) [serial = 103] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 84 (0x10dfe78) [serial = 95] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 83 (0x5f67438) [serial = 114] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 82 (0x251b508) [serial = 124] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 81 (0x250b6c8) [serial = 123] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 80 (0x63f7ba8) [serial = 133] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 79 (0x6407af8) [serial = 134] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 78 (0x3f04118) [serial = 101] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 77 (0x5e51348) [serial = 92] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 76 (0x1315128) [serial = 111] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 75 (0x3380858) [serial = 121] [outer = (nil)] [url = about:blank]
--DOMWINDOW == 74 (0x5fa2c08) [serial = 120] [outer = (nil)] [url = chrome://messenger/content/addressbook/abContactsPanel.xul]
--DOMWINDOW == 73 (0x50d54a8) [serial = 108] [outer = (nil)] [url = chrome://messenger/content/messengercompose/messengercompose.xul]
--DOMWINDOW == 72 (0x5ed5178) [serial = 110] [outer = (nil)] [url = chrome://messenger/content/addressbook/abContactsPanel.xul]
--DOMWINDOW == 71 (0x5f23598) [serial = 130] [outer = (nil)] [url = chrome://messenger/content/addressbook/abContactsPanel.xul]
--DOMWINDOW == 70 (0x5f600a8) [serial = 100] [outer = (nil)] [url = chrome://messenger/content/addressbook/abContactsPanel.xul]
Step Pass: {"function": "Controller.type()"}
WARNING: NS_ENSURE_TRUE(ps) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2959
WARNING: NS_ENSURE_TRUE(ps) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2959
WARNING: NS_ENSURE_TRUE(ps) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2959
WARNING: NS_ENSURE_TRUE(ps) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2959
WARNING: NS_ENSURE_TRUE(editor) failed: file /COMM-CENTRAL/comm-central/mozilla/extensions/spellcheck/src/mozInlineSpellChecker.cpp, line 1824
WARNING: NS_ENSURE_TRUE(editor) failed: file /COMM-CENTRAL/comm-central/mozilla/extensions/spellcheck/src/mozInlineSpellChecker.cpp, line 708
++DOCSHELL 0x4b10660 == 29 [id = 64]
++DOMWINDOW == 71 (0x5d7ac58) [serial = 158] [outer = (nil)]
++DOMWINDOW == 72 (0x4143278) [serial = 159] [outer = 0x5d7ac58]
TEST-PASS | /COMM-CENTRAL/comm-central/mail/test/mozmill/composition/test-save-changes-on-quit.js | test-save-changes-on-quit.js::test_can_quit_on_changes
TEST-START | /COMM-CENTRAL/comm-central/mail/test/mozmill/composition/test-save-changes-on-quit.js | test_window_quit_state_reset_on_aborted_quit
Step Pass: {"function": "Controller.keypress()"}
++DOCSHELL 0x31d2b70 == 30 [id = 65]
++DOMWINDOW == 73 (0x4cdeab8) [serial = 160] [outer = (nil)]
++DOCSHELL 0xf88ee0 == 31 [id = 66]
++DOMWINDOW == 74 (0x67c6f88) [serial = 161] [outer = (nil)]
++DOCSHELL 0x165f180 == 32 [id = 67]
++DOMWINDOW == 75 (0x22c6288) [serial = 162] [outer = (nil)]
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 76 (0x61e56b8) [serial = 163] [outer = 0x4cdeab8]
++DOMWINDOW == 77 (0x4cc5d38) [serial = 164] [outer = 0x67c6f88]
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 78 (0x50d4548) [serial = 165] [outer = 0x22c6288]
++DOMWINDOW == 79 (0x4e91848) [serial = 166] [outer = 0x67c6f88]
WARNING: NS_ENSURE_TRUE(aSelection->GetRangeCount()) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3806
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3785
WARNING: NS_ENSURE_SUCCESS(res, res) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp, line 316
WARNING: NS_ENSURE_TRUE(sheet) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2955
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
++DOMWINDOW == 80 (0x3f33e58) [serial = 167] [outer = 0x4cdeab8]
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "nBox.getNotificationWithValue is not a function" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 1822}]' when calling method: [nsITimerCallback::notify]"	nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]
************************************************************
System JS : ERROR chrome://messenger/content/addressbook/abResultsPane.js:193
		     SyntaxError: illegal character
++DOCSHELL 0x3be99b0 == 33 [id = 68]
++DOMWINDOW == 81 (0x4de1f98) [serial = 168] [outer = (nil)]
++DOMWINDOW == 82 (0x2283158) [serial = 169] [outer = 0x4de1f98]
Step Pass: {"function": "Controller.keypress()"}
++DOCSHELL 0x6653000 == 34 [id = 69]
++DOMWINDOW == 83 (0x178a0e8) [serial = 170] [outer = (nil)]
++DOCSHELL 0x5298590 == 35 [id = 70]
++DOMWINDOW == 84 (0x5297308) [serial = 171] [outer = (nil)]
++DOCSHELL 0x6519820 == 36 [id = 71]
++DOMWINDOW == 85 (0x69f9ae8) [serial = 172] [outer = (nil)]
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && subjPrincipal) failed: file /COMM-CENTRAL/comm-central/mozilla/docshell/base/nsDocShell.cpp, line 8413
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 86 (0x3e8a908) [serial = 173] [outer = 0x178a0e8]
++DOMWINDOW == 87 (0x669ad08) [serial = 174] [outer = 0x5297308]
WARNING: Subdocument container has no frame: file /COMM-CENTRAL/comm-central/mozilla/layout/base/nsDocumentViewer.cpp, line 2339
++DOMWINDOW == 88 (0x29f36e8) [serial = 175] [outer = 0x69f9ae8]
++DOMWINDOW == 89 (0x16007d8) [serial = 176] [outer = 0x5297308]
WARNING: NS_ENSURE_TRUE(aSelection->GetRangeCount()) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3806
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3785
WARNING: NS_ENSURE_SUCCESS(res, res) failed with result 0x80004005: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp, line 316
WARNING: NS_ENSURE_TRUE(sheet) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 2955
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
++DOMWINDOW == 90 (0x45d8fa8) [serial = 177] [outer = 0x178a0e8]
System JS : ERROR chrome://messenger/content/addressbook/abResultsPane.js:193
		     SyntaxError: illegal character
Step Pass: {"function": "Controller.type()"}
Step Pass: {"function": "Controller.type()"}
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "items is undefined" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 108}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: dispatchAttachmentBucketEvent :: line 4471"	data: yes]
************************************************************
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: gComposeRecyclingListener.onClose :: line 234"  data: yes]
************************************************************
Step Pass: {"function": "controller.click()"}
WARNING: NS_ENSURE_TRUE(nextNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 940
WARNING: NS_ENSURE_TRUE(nextNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 940
WARNING: NS_ENSURE_TRUE(nextNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/html/nsHTMLEditor.cpp, line 940
++DOMWINDOW == 91 (0x69b3b58) [serial = 178] [outer = 0x23202a8]
WARNING: NS_ENSURE_TRUE(aNode) failed: file /COMM-CENTRAL/comm-central/mozilla/editor/libeditor/base/nsEditor.cpp, line 3480
TEST-PASS | /COMM-CENTRAL/comm-central/mail/test/mozmill/composition/test-save-changes-on-quit.js | test-save-changes-on-quit.js::test_window_quit_state_reset_on_aborted_quit


---
Sorry for the false alarm regarding syntax error : illegal character.
My source has a #if,#endif block there.
Many JS scripts are processed by CPP-like python tool before installed
into distribution directory so I assumed that
this file abResultsPane.js is also preprocessed and the CPP-like macro processor lines would be removed.
But this file is not processed. Thus syntax error.

But "gMsgCompose is null" error
has been in the session log from early this year up to today.
It is for real :-)

/FF-NEW/log119-mozmill-original.txt:48967:[Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]

The reason I didn't report this error earlier 
is that I thought the error was only visible during 
cloud-related processing, which never seems to work 
in local set up (probably because the test requires ID / password for the service).
The test target is listed in alphabetical order.
cloud* comes before compose* and so I didn't realize it.

TIA
JSON.parse error is safe to ignore on a local build, I think.

System JS : ERROR file:///TEST-MAIL-DIR/objdir-tb3/mozilla/dist/bin/components/nsYouSendIt.js:702
                     SyntaxError: JSON.parse: unexpected end of data
TEST-START | /COMM-CENTRAL/comm-central/mail/test/mozmill/cloudfile/test-cloudfile-backend-yousendit.js | teardownTest
Step Pass: {"function": "controller.waitFor()"}

701   req.onerror = function() {
702     let response = JSON.parse(req.responseText);
703     this._lastErrorStatus = response.errorStatus.status;

This is part of cloud interaction error: Response, of course, contains garbatge (or
nil) thus the parsing caused error. 
We could argue that the test code ought to get prepared for this, but
I suppose that this is handled OK in the TryServer, so the priority 
of fixing this is low.


Ah, yes, "items is undefined" still persists as regarding the original poster's question.
Again, I didn't realize this occurs by simple operation without invoking
cloud interaction.

TIA
Comment on attachment 789709 [details] [diff] [review]
patch

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

I think this is a fine change - but I think we can also drop the truthiness check for items.

::: mail/components/compose/content/cloudAttachmentLinkManager.js
@@ +89,5 @@
>  
>        for (let attachment in fixIterator(
>             event.detail, Components.interfaces.nsIMsgAttachment)) {
>          // Remove the attachment from the message body.
>          if (list && items)

We probably don't need to check for truthiness here for items, since it is guaranteed to be an Array / Iterable.
Attachment #789709 - Flags: review?(mconley) → review+
(In reply to Mike Conley (:mconley) from comment #7)
> Comment on attachment 789709 [details] [diff] [review]
> patch
> 
> Review of attachment 789709 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I think this is a fine change - but I think we can also drop the truthiness
> check for items.
> 
> ::: mail/components/compose/content/cloudAttachmentLinkManager.js
> @@ +89,5 @@
> >  
> >        for (let attachment in fixIterator(
> >             event.detail, Components.interfaces.nsIMsgAttachment)) {
> >          // Remove the attachment from the message body.
> >          if (list && items)
> 
> We probably don't need to check for truthiness here for items, since it is
> guaranteed to be an Array / Iterable.

I applied the posted patch as is for a local debug build, and tested it by running |make mozmill| test.

"items is undefined" is gone.

But I still see gMsgCompose is null:

They are seen in actually in two calling environments.
One of them caused the error 13 times, and the other caused the error two times
in a |make mozmill| session.


	 13 [Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"	data: yes]


	  2 [Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: gComposeRecyclingListener.onClose :: line 234"  data: yes]

TIA
Assignee: nobody → acelists
Keywords: checkin-needed
OS: Linux → All
Hardware: x86 → All
Comment on attachment 789709 [details] [diff] [review]
patch

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

Yeah i don't think this hurts.
Attachment #789709 - Flags: review?(mkmelin+mozilla) → review+
Thanks, I will refresh the patch.
Status: NEW → ASSIGNED
I use thunderbird for work at the office and at home.
Before an annual technology exhibition, I receive about 1000 e-mails
in a month with large attachments (PDFs for proof-reading: mainly product
brochures, exhibition posters, booklets, etc.). This can 
break the 2GB and 4GB folder limit easily if I am not careful :-(


So I am desperately seeking "rock-solid e-mail client." (tm) :-)
That is why I am contributing bug fixes, etc.

Anyway, aceman, here is what I found about gMsgCompose:

gMsgCmpose seems to be set only in three places (aside from the test
routines).

https://mxr.mozilla.org/comm-central/ident?i=gMsgCompose&filter=

mail/components/compose/content/MsgComposeCommands.js (View Hg log or Hg annotations)
    line 112 -- gMsgCompose = null;
    line 144 -- gMsgCompose = null; 

    line 1975 -- gMsgCompose = MailServices.compose.initCompose(params, window, editorElement.docShell);

Line 112 is part of a function named InitializeGlobalVariables.

function InitializeGlobalVariables()
108 {
109   gMessenger = Components.classes["@mozilla.org/messenger;1"]
110                          .createInstance(Components.interfaces.nsIMessenger);
111 
112   gMsgCompose = null;
113   gWindowLocked = false;

Line 144 is part of a function named ReleaseGlobalVariables.

function ReleaseGlobalVariables()
141 {
142   gCurrentIdentity = null;
143   gCharsetConvertManager = null;
144   gMsgCompose = null;
145   gMessenger = null;
146   _gComposeBundle = null;
147   MailServices.mailSession.RemoveMsgWindow(msgWindow);
148   msgWindow = null;
149 }
150 

function 1975 is  part of a function named ComposeStartup


1973   // Get the <editor> element to startup an editor
1974   var editorElement = GetCurrentEditorElement();
1975   gMsgCompose = MailServices.compose.initCompose(params, window, editorElement.docShell);
1976 
1977   // Set the close listener.
1978   gMsgCompose.recyclingListener = gComposeRecyclingListener;
1979   gMsgCompose.addMsgSendListener(gSendListener);

Assuming that gMsgCompose is set up properly by line 1975, where
is ReleaseGlobalVariables() called to clear gMsgComose to null?


Referenced (in 2 files total) in:
(note the one under suite/mailnews is for SeaMonkey, I think.)

    mail/components/compose/content/MsgComposeCommands.js (View Hg log or Hg annotations)
        line 196 -- ReleaseGlobalVariables();
        line 2221 -- ReleaseGlobalVariables(); 
    suite/mailnews/compose/MsgComposeCommands.js (View Hg log or Hg annotations)
        line 166 -- ReleaseGlobalVariables(); 

Line 196 is part of a function that is named onClose
171 var gComposeRecyclingListener = {
172   onClose: function() {
173     //Reset recipients and attachments
	...
194     SetContentAndBodyAsUnmodified();
195     updateEditableFields(true);
196     ReleaseGlobalVariables();  <--- here

Line 2221 is part of a function named ComposeUnload:

2199 function ComposeUnload()
2200 {
2201   UnloadCommandUpdateHandlers();
2202 
2203   // Stop gSpellChecker so personal dictionary is saved
2204   enableInlineSpellCheck(false);
2205 
2206   EditorCleanup();
2207 
2208   if (gMsgCompose)
2209     gMsgCompose.removeMsgSendListener(gSendListener);
2210 
2211   RemoveMessageComposeOfflineQuitObserver();
2212   gAttachmentNotifier.shutdown();
2213 
2214   if (gMsgCompose)
2215     gMsgCompose.UnregisterStateListener(stateListener);
2216   if (gAutoSaveTimeout)
2217     clearTimeout(gAutoSaveTimeout);
2218   if (msgWindow)
2219     msgWindow.closeWindow();
2220 
2221   ReleaseGlobalVariables();
2222 }


Considering that I see the following log when I close the compose
window after manually starting local build of thunderbird (comm-central)
let me check MsgComposeCommands.js line 234:

************************************************************

* Call to xpconnect wrapped JSObject produced this error:  *

[Exception... "'[JavaScript Error: "gMsgCompose is null" {file: "chrome://messenger/content/messengercompose/cloudAttachmentLinkManager.js" line: 32}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://messenger/content/messengercompose/MsgComposeCommands.js :: <TOP_LEVEL> :: line 234"  data: yes]

************************************************************


MsgComposeCommands.js:
	...

229     //Release the nsIMsgComposeParams object
230     if (window.arguments && window.arguments[0])
231       window.arguments[0] = null;
232     var event = document.createEvent('Events');
233     event.initEvent('compose-window-close', false, true);
234     document.getElementById("msgcomposeWindow").dispatchEvent(event);
235     if (gAutoSaveTimeout)
236       clearTimeout(gAutoSaveTimeout);
237   },


Now, wait a second!. This is still part of onClose() routine!
If for some reason, the sequence of statements starting from 232, 233,
and then ending 234 tries to access gMsgCompose, which seems likely,
there is a problem after all.
onClose() already calls, on line 196, ReleaseGlobalVariables() which
sets gMsgCompose to null. So gMsgComose is null when control reaches
line 234.

Possible solution:

Like the function CompooseUnload() does, maybe we should move
ReleaseGlobalVariables() to the end of onClose().

Or maybe move the processing of

    var event = document.createEvent('Events');
    event.initEvent('compose-window-close', false, true);
    document.getElementById("msgcomposeWindow").dispatchEvent(event);

before the call to ReleaseGlobalVariables().

What do people think?
Great detective work! If it works, moving ReleaseGlobalVariables() to the end sounds like good solution to me.
(But we probably should handle the gMsgCompose problem in another bug, and let this one deal with the items issue.)
Chiaki, please file your whole comment as a separate bug and then you can take it and make the patch :)
Flags: needinfo?(ishikawa)
Attached patch patch v2Splinter Review
Updated the patch with mconley's suggestion.
Attachment #789709 - Attachment is obsolete: true
Attachment #803255 - Flags: review+
Keywords: checkin-needed
Blocks: 915516
No longer blocks: 915516
https://hg.mozilla.org/comm-central/rev/4399071beccd
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 26.0
Flags: needinfo?(ishikawa)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: