Bug: JavaScript Error: "TypeError: can't access property "key", gCurrentIdentity is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 5257
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2020-05-15 14:16:52+00:00
Resolved: 2020-05-28 07:09:38+00:00

During mochitest execution with FULL DEBUG version of TB under Debian
GNU/Linux 64-bit, I saw the following error three times.

JavaScript error: chrome://messenger/content/messengercompose/MsgComposeCommands.js, line 5257: TypeError: can't access property "key", gCurrentIdentity is null

I think the error is architecture neutral and so I set it to ALL.

The source code in question is as follows.: (I am afraid the line
number from my few days old tree is one line off from searchfox line.)
https://searchfox.org/comm-central/source/mail/components/compose/content/MsgComposeCommands.js#5258

```
function getCurrentIdentityKey() {
  // Get the identity key.
  return gCurrentIdentity.key; <=== 
}

```

The errors happen in the following tests.

```
29:40.96 INFO Entering test bound testPlaintextComposeWindowSwitchSignatures
29:45.89 GECKO(539290) JavaScript error: chrome://messenger/content/messengercompose/MsgComposeCommands.js, line 5257: TypeError: can't access property "key", gCurrentIdentity is null
29:45.90 INFO Leaving test bound testPlaintextComposeWindowSwitchSignatures

29:45.90 INFO Entering test bound testPlaintextComposeWindowSwitchSignaturesWithSuppressedSeparator
29:45.91 INFO Console message: [JavaScript Error: "TypeError: can't access property "key", gCurrentIdentity is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 5257}]
29:51.24 GECKO(539290) JavaScript error: chrome://messenger/content/messengercompose/MsgComposeCommands.js, line 5257: TypeError: can't access property "key", gCurrentIdentity is null

29:51.24 INFO Leaving test bound testPlaintextComposeWindowSwitchSignaturesWithSuppressedSeparator
29:51.24 INFO Entering test bound testHTMLComposeWindowSwitchSignatures
29:51.25 INFO Console message: [JavaScript Error: "TypeError: can't access property "key", gCurrentIdentity is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 5257}]
29:57.13 INFO Leaving test bound testHTMLComposeWindowSwitchSignatures
         ...
30:10.40 INFO Entering test bound testHTMLComposeWindowSwitchSignaturesWithSuppressedSeparatorParagraphFormat
30:26.20 GECKO(539290) JavaScript error: chrome://messenger/content/messengercompose/MsgComposeCommands.js, line 5257: TypeError: can't access property "key", gCurrentIdentity is null
30:26.24 INFO Console message: [JavaScript Error: "TypeError: can't access property "key", gCurrentIdentity is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 5257}]
30:26.24 INFO Leaving test bound testHTMLComposeWindowSwitchSignaturesWithSuppressedSeparatorParagraphFormat
30:26.27 TEST_END: Test OK. Subtests passed 70/70. Unexpected 0
```
The above was produced by
```
egrep "(TEST_START|TEST_END|Entering test|Leaving test|can't access property \"key\")" /FF-NEW/log1220-mochitest.txt
```

I am attaching an excerpt from my local mochitest execution with FULL
DEBUG version of TB.
The log is more verbose than normal execution because I have added
local debug dump.

What irks me is that mochitest framework did not fail this test even
though this TypeError happened.  We really need to fail a test that
produces TypeError(s).