Closed Bug 1338879 Opened 7 years ago Closed 7 years ago

JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null in mozmill test test-migrate-to-rdf-ui-5.js

Categories

(Thunderbird :: Instant Messaging, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 55.0

People

(Reporter: ishikawa, Assigned: aleth)

Details

Attachments

(1 file)

I have seen this error for quite some time at leat locally (since September 2014. I did not see it in logs in August and earlier):

JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null

What is interesting about this bug is that this error message is printed BEFORE
a test is invoked.

> JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null
> TEST-START | /NREF-COMM-CENTRAL/comm-central/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js | setupModule

It is possible there are some issues about the buffering of stdout/stderr and other output streams, but I am not sure.
But  before the error, I see the following error, so there may be some file path issue, a syntax error
that caused the failure to load the .js file, etc.

> Failed to load file:///NREF-COMM-CENTRAL/comm-central/mailnews/base/prefs/content/AccountManager.js

That some objects are not initialized may be the reason.

Here is the excerpt from the log.

INFO | (runtestlist.py) | Running directory: migration-to-rdf-ui-5
['/NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill-virtualenv/bin/python', 'runtest.py', '-t', '/NREF-COMM-CENTRAL/comm-central/mozilla/../mail/test/mozmill/migration-to-rdf-ui-5', '--binary', '/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/thunderbird', '--symbols-path', '/NREF-COMM-CENTRAL/objdir-tb3/dist/crashreporter-symbols', '--plugins-path', '/NREF-COMM-CENTRAL/objdir-tb3/dist/plugins', '--testing-modules-dir', '/NREF-COMM-CENTRAL/objdir-tb3/_tests/modules']
Using profile dir: /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile
[13167] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520012: file /NREF-COMM-CENTRAL/comm-central/mozilla/extensions/cookie/nsPermissionManager.cpp, line 2640
++DOCSHELL 0x55859ad90170 == 1 [pid = 13167] [id = {d4c85f1f-f7af-4b61-878f-181e5281c36f}]
++DOMWINDOW == 1 (0x55859ad92940) [pid = 13167] [serial = 1] [outer = (nil)]
++DOMWINDOW == 2 (0x55859adc8560) [pid = 13167] [serial = 2] [outer = 0x55859ad92940]
[13167] WARNING: GetDefaultCharsetForLocale: need to add multi locale support: file /NREF-COMM-CENTRAL/comm-central/mozilla/intl/locale/unix/nsUNIXCharset.cpp, line 98
LoadPlugin() /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile/plugins/libnptest.so returned 55859b7ff790
LoadPlugin() /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile/plugins/libnpswftest.so returned 55859b7f5770
LoadPlugin() /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile/plugins/libnpthirdtest.so returned 55859b7fa0b0
LoadPlugin() /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile/plugins/libnpsecondtest.so returned 55859ab6f5d0
LoadPlugin() /NREF-COMM-CENTRAL/objdir-tb3/_tests/mozmill/mozmillprofile/plugins/libnptestjava.so returned 55859b7988e0
Warning: unrecognized command line flag -foreground
++DOCSHELL 0x55859ba14730 == 2 [pid = 13167] [id = {8b9e24ce-d534-47d0-b202-366fff4bb627}]
++DOMWINDOW == 3 (0x55859ba16be0) [pid = 13167] [serial = 3] [outer = (nil)]
++DOMWINDOW == 4 (0x55859ba18700) [pid = 13167] [serial = 4] [outer = 0x55859ba16be0]
++DOMWINDOW == 5 (0x55859b8397f0) [pid = 13167] [serial = 5] [outer = 0x55859ad92940]
++DOCSHELL 0x55859c4f49e0 == 3 [pid = 13167] [id = {c9e24087-4d82-431d-afd1-eb170ca57b38}]
++DOMWINDOW == 6 (0x55859c4f50e0) [pid = 13167] [serial = 6] [outer = (nil)]
++DOCSHELL 0x55859c4fc160 == 4 [pid = 13167] [id = {8cfb234f-141b-4663-afc4-6b5984c8f45f}]
++DOMWINDOW == 7 (0x55859c4fc8a0) [pid = 13167] [serial = 7] [outer = (nil)]
++DOCSHELL 0x55859c583a50 == 5 [pid = 13167] [id = {ce38453c-4756-4311-8e99-debb38450f39}]
++DOMWINDOW == 8 (0x55859c584230) [pid = 13167] [serial = 8] [outer = (nil)]
++DOCSHELL 0x55859c5f40a0 == 6 [pid = 13167] [id = {5c69e5e4-4d2d-4b87-a328-29976650ed66}]
++DOMWINDOW == 9 (0x55859c5f4720) [pid = 13167] [serial = 9] [outer = (nil)]
(debug) FullyReadStream: we dump stack and return because we could not read required data at all. Maybe at EOF. rv=0x00000000, n=0
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbccc78)[0x7efca14b2c78]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbdf4c8)[0x7efca14c54c8]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbdf5a2)[0x7efca14c55a2]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbdf605)[0x7efca14c5605]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbe369e)[0x7efca14c969e]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xbe68d5)[0x7efca14cc8d5]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xcb6d72)[0x7efca159cd72]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xcb7350)[0x7efca159d350]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xa4866a)[0x7efca132e66a]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xfc94fb)[0x7efca18af4fb]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xfc6588)[0x7efca18ac588]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xfc6e89)[0x7efca18ace89]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0x19b9514)[0x7efca229f514]
/NREF-COMM-CENTRAL/objdir-tb3/dist/bin/libxul.so(+0xff5b4e)[0x7efca18dbb4e]
++DOCSHELL 0x55859cffe080 == 7 [pid = 13167] [id = {e7397f69-50d5-4300-83da-9c5c0a8bc648}]
++DOMWINDOW == 10 (0x55859cffe730) [pid = 13167] [serial = 10] [outer = (nil)]
++DOCSHELL 0x55859d015ae0 == 8 [pid = 13167] [id = {bc448f6a-f388-4c2a-af51-bae1c59ededa}]
++DOMWINDOW == 11 (0x55859d015fa0) [pid = 13167] [serial = 11] [outer = (nil)]
++DOCSHELL 0x55859d016690 == 9 [pid = 13167] [id = {7f20d00a-00d7-4bcb-bfce-238baf35cf9e}]
++DOMWINDOW == 12 (0x55859d016cf0) [pid = 13167] [serial = 12] [outer = (nil)]
++DOCSHELL 0x55859d017690 == 10 [pid = 13167] [id = {0fd2103a-30df-4f24-b330-1c98aa798ab7}]
++DOMWINDOW == 13 (0x55859d017dd0) [pid = 13167] [serial = 13] [outer = (nil)]
++DOCSHELL 0x55859cc222a0 == 11 [pid = 13167] [id = {e3e2ba83-a163-45ae-ab9b-7eecda5ba965}]
++DOMWINDOW == 14 (0x55859cc22d00) [pid = 13167] [serial = 14] [outer = (nil)]
++DOMWINDOW == 15 (0x55859db2e360) [pid = 13167] [serial = 15] [outer = 0x55859d017dd0]
++DOMWINDOW == 16 (0x55859dbb5ea0) [pid = 13167] [serial = 16] [outer = 0x55859cffe730]
[13167] WARNING: Failed to open external DTD: publicId "-//W3C//DTD SVG 1.1//EN" systemId "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" base "file:///NREF-COMM-CENTRAL/comm-central/mail/themes/linux/mail/tabs/selected-start.svg" URL "resource://gre/res/dtd/svg11.dtd": file /NREF-COMM-CENTRAL/comm-central/mozilla/parser/htmlparser/nsExpatDriver.cpp, line 702
[13167] WARNING: Failed to open external DTD: publicId "-//W3C//DTD SVG 1.1//EN" systemId "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" base "file:///NREF-COMM-CENTRAL/comm-central/mail/themes/linux/mail/tabs/selected-end.svg" URL "resource://gre/res/dtd/svg11.dtd": file /NREF-COMM-CENTRAL/comm-central/mozilla/parser/htmlparser/nsExpatDriver.cpp, line 702
++DOMWINDOW == 17 (0x55859defaec0) [pid = 13167] [serial = 17] [outer = 0x55859cc22d00]
++DOMWINDOW == 18 (0x55859df65420) [pid = 13167] [serial = 18] [outer = 0x55859c584230]
++DOMWINDOW == 19 (0x55859df9dd20) [pid = 13167] [serial = 19] [outer = 0x55859c4f50e0]
++DOMWINDOW == 20 (0x55859dfc7d20) [pid = 13167] [serial = 20] [outer = 0x55859c4fc8a0]
++DOMWINDOW == 21 (0x55859ba291c0) [pid = 13167] [serial = 21] [outer = 0x55859c584230]
++DOMWINDOW == 22 (0x55859e045060) [pid = 13167] [serial = 22] [outer = 0x55859c5f4720]
++DOMWINDOW == 23 (0x55859e05e010) [pid = 13167] [serial = 23] [outer = 0x55859cffe730]
++DOMWINDOW == 24 (0x55859e097990) [pid = 13167] [serial = 24] [outer = 0x55859d015fa0]
++DOMWINDOW == 25 (0x55859e0aee90) [pid = 13167] [serial = 25] [outer = 0x55859d016cf0]
++DOMWINDOW == 26 (0x55859e0c75c0) [pid = 13167] [serial = 26] [outer = 0x55859d017dd0]
++DOMWINDOW == 27 (0x55859e0e28c0) [pid = 13167] [serial = 27] [outer = 0x55859cc22d00]
++DOMWINDOW == 28 (0x55859e50d020) [pid = 13167] [serial = 28] [outer = 0x55859c4f50e0]
Failed to load file:///NREF-COMM-CENTRAL/comm-central/mailnews/base/prefs/content/AccountManager.js
++DOMWINDOW == 29 (0x55859ea91d20) [pid = 13167] [serial = 29] [outer = 0x55859c4f50e0]
[13167] WARNING: NS_ENSURE_TRUE(mScriptGlobalObject) failed: file /NREF-COMM-CENTRAL/comm-central/mozilla/dom/xul/XULDocument.cpp, line 3505
[13167] WARNING: NS_ENSURE_TRUE(mScriptGlobalObject) failed: file /NREF-COMM-CENTRAL/comm-central/mozilla/dom/xul/XULDocument.cpp, line 3505
JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null
TEST-START | /NREF-COMM-CENTRAL/comm-central/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js | setupModule
[13167] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file /NREF-COMM-CENTRAL/comm-central/mailnews/base/src/nsMsgAccountManager.cpp, line 2314
TEST-PASS | /NREF-COMM-CENTRAL/comm-central/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js | test-migrate-to-rdf-ui-5.js::setupModule
          ...


cf.

[13167] WARNING: NS_ENSURE_TRUE(mScriptGlobalObject) failed: file /NREF-COMM-CENTRAL/comm-central/mozilla/dom/xul/XULDocument.cpp, line 3505

is here:

    nsresult
    XULDocument::ExecuteScript(nsXULPrototypeScript *aScript)
    {
        NS_PRECONDITION(aScript != nullptr, "null ptr");
        NS_ENSURE_TRUE(aScript, NS_ERROR_NULL_POINTER);
=>      NS_ENSURE_TRUE(mScriptGlobalObject, NS_ERROR_NOT_INITIALIZED);

        nsresult rv;
        rv = mScriptGlobalObject->EnsureScriptEnvironment();
        NS_ENSURE_SUCCESS(rv, rv);

So it looks like there are a object or two (we have two similar error messages) not initialized here?


---

JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null

is here:

      displayStatusType: function ss_displayStatusType(aStatusType) {
==>     document.getElementById("statusMessage")
                .setAttribute("statusType", aStatusType);
        let statusString = Status.toLabel(aStatusType);
        let statusTypeIcon = document.getElementById("statusTypeIcon");
        statusTypeIcon.setAttribute("status", aStatusType);
        statusTypeIcon.setAttribute("tooltiptext", statusString);
        return statusString;
      },

So the question is what |document| is. Maybe it is not initialized very well yet?


---

The error, [13167] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file /NREF-COMM-CENTRAL/comm-central/mailnews/base/src/nsMsgAccountManager.cpp, line 2314
is here:

    NS_IMETHODIMP
    nsMsgAccountManager::CreateLocalMailAccount()
    {
      // create the server
      nsCOMPtr<nsIMsgIncomingServer> server;
      nsresult rv = CreateIncomingServer(NS_LITERAL_CSTRING("nobody"),
                                NS_LITERAL_CSTRING("Local Folders"),
                                NS_LITERAL_CSTRING("none"), getter_AddRefs(server));
=>    NS_ENSURE_SUCCESS(rv,rv);

  nsString localFoldersName;

I think the test environment is not quite set up very well.

TIA
Could you provide a minimal test case for where this happens? E.g. "make mozmill some_individual_test". Otherwise it's a bit hard to reproduce and diagnose.
Just check any debug log on C-C ;-)

https://archive.mozilla.org/pub/thunderbird/tinderbox-builds/comm-central-win32-debug/1488621203/comm-central_win7_ix-debug_test-mozmill-bm127-tests1-windows-build2.txt.gz

INFO -  JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null
INFO -  TEST-START | C:\slave\test\build\tests\mozmill\migration-to-rdf-ui-5\test-migrate-to-rdf-ui-5.js | setupModule

It seems a little weird that the error happens before the test starts.
(In reply to Jorg K (GMT+1) from comment #2)
> Just check any debug log on C-C ;-)

I would like to encourage frequent contributors to file more precise bugs ;)

There's exactly one mozmill test for which this happens:
mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js

And it's not debug-only.
Summary: |make mozmill|: JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null → JavaScript error: chrome://messenger/content/chat/imStatusSelector.js, line 36: TypeError: document.getElementById(...) is null in mozmill test test-migrate-to-rdf-ui-5.js
Call stack
ss_displayStatusType@chrome://messenger/content/chat/imStatusSelector.js:37:11
ss_displayCurrentStatus@chrome://messenger/content/chat/imStatusSelector.js:55:24
ss_load@chrome://messenger/content/chat/imStatusSelector.js:264:5
initAfterChatCore@chrome://messenger/content/chat/chat-messenger-overlay.js:1101:5
observe@chrome://messenger/content/chat/chat-messenger-overlay.js:946:7
onPromptStart@resource:///modules/chatHandler.jsm:76:9
runnablePrompter.prototype.run<@Daily.app/Contents/Resources/components/msgAsyncPrompter.js:28:12
(In reply to aleth [:aleth] from comment #3)
> I would like to encourage frequent contributors to file more precise bugs ;)
Are you talking to me or the reporter? I did a survey of messages in Xpcshell and Mozmill tests in the context of bug 1318776, bug 1338798 and bug 1342858. I saw this message and since it had already been reported, I CC'ed myself on the bug. So which duties did I neglect ;-(
(In reply to Jorg K (GMT+1) from comment #5)
> (In reply to aleth [:aleth] from comment #3)
> > I would like to encourage frequent contributors to file more precise bugs ;)
> Are you talking to me or the reporter? 

I meant the reporter. There was nobody else commenting when I filed comment 1...
(In reply to aleth [:aleth] from comment #3)
> I would like to encourage frequent contributors to file more precise bugs ;)

Please, the report is already too precise :) I wouldn't want to see Chiaki in overdrive ;)
Assignee: nobody → aleth
Status: NEW → ASSIGNED
(In reply to aleth [:aleth] from comment #3)
> (In reply to Jorg K (GMT+1) from comment #2)
> > Just check any debug log on C-C ;-)
> 
> I would like to encourage frequent contributors to file more precise bugs ;)
> 
> There's exactly one mozmill test for which this happens:
> mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js
> 
> And it's not debug-only.

Sorry, I test locally only using debug build and
did no have time to check whether the bug manifests in optimize build, etc.

I wish I have the time to do the additional testing, etc.

TIA
(In reply to :aceman from comment #7)
> (In reply to aleth [:aleth] from comment #3)
> > I would like to encourage frequent contributors to file more precise bugs ;)
> 
> Please, the report is already too precise :) I wouldn't want to see Chiaki
> in overdrive ;)

Yes, I try to be terse sometimes.
Attachment #8843759 - Flags: review?(clokep) → review+
https://hg.mozilla.org/comm-central/rev/5e008d8cb6468cfc54d220eb61308c82e97227a3
Bug 1338879 - Don't update status elements that aren't in the DOM yet. r=clokep
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 55.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: