Bug: JavaScript Error: "TypeError: can't access property "folderURL", parentFolder is null" {file: "resource:///modules/MailNotificationService.jsm" line: 335}
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2021-11-06 00:56:18+00:00
Resolved: 2023-05-27 10:25:21+00:00

I suspect this is platform-agnostic error, but I found the following error in my local mochitest log of DEBUG version of TB under Debian GNU/Linux 64-bit.

There are many lines of warning in the following form:
```
JavaScript error: resource:///modules/MailNotificationService.jsm, line 335: TypeError: can't access property "folderURL", parentFolder is null
```
About hundred of them. 

They are visible in other people's linux64 debug test runs on treeherder as well. 
For example, you can find the same error in the following log file.
https://firefoxci.taskcluster-artifacts.net/Hg-cZIWPShutIGEHJt97UA/0/public/logs/live_backing.log
This comes from Geoff's job
https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=282a50bcb1aff3b343501350c5731bf19d19327c

So they are for real.
I now realize local log contains the stack trace when the error was recorded. For example,

```
 3:41.37 INFO Console message: [JavaScript Error: "TypeError: can't access property "folderURL", parentFolder is null" {file: "resource:///modules/MailNotificationService.jsm" line: 335}]
onFolderAdded@resource:///modules/MailNotificationService.jsm:335:51
configure_message_injection@file:////NEW-SSD/moz-obj-dir/objdir-tb3/_tests/testing/mochitest/resources/messageInjection.js:89:29
setupAccountStuff@resource://testing-common/mozmill/FolderDisplayHelpers.jsm:327:34
setupModule@resource://testing-common/mozmill/FolderDisplayHelpers.jsm:305:3
@resource://testing-common/mozmill/FolderDisplayHelpers.jsm:312:1
@chrome://mochitests/content/browser/comm/calendar/test/browser/browser_todayPane_dragAndDrop.js:16:17
Tester_execTest@chrome://mochikit/content/browser-test.js:1055:26
nextTest/<@chrome://mochikit/content/browser-test.js:939:14
SimpleTest.waitForFocus/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:1041:13

```
Another one:
```
112:32.90 INFO Console message: [JavaScript Error: "TypeError: can't access property "folderURL", parentFolder is null" {file: "resource:///modules/MailNotificationService.jsm" line: 335}]
onFolderAdded@resource:///modules/MailNotificationService.jsm:335:51
testMessagePane@chrome://mochitests/content/browser/comm/mail/base/test/browser/browser_formPickers.js:144:25
Tester_execTest/<@chrome://mochikit/content/browser-test.js:1091:34
Tester_execTest@chrome://mochikit/content/browser-test.js:1131:11
nextTest/<@chrome://mochikit/content/browser-test.js:939:14
SimpleTest.waitForFocus/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:1041:13

```

Still another one:
```
113:16.02 INFO Console message: [JavaScript Error: "TypeError: can't access property "folderURL", parentFolder is null" {file: "resource:///modules/MailNotificationService.jsm" line: 335}]
onFolderAdded@resource:///modules/MailNotificationService.jsm:335:51
testMessagePane@chrome://mochitests/content/browser/comm/mail/base/test/browser/browser_mailContext.js:154:25
Tester_execTest/<@chrome://mochikit/content/browser-test.js:1091:34
Tester_execTest@chrome://mochikit/content/browser-test.js:1131:11
nextTest/<@chrome://mochikit/content/browser-test.js:939:14
SimpleTest.waitForFocus/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:1041:13

```
Given the seemingly important name of "folderURL", and that this error did not show until October this year, we should fix the error before people forget the possible cause of the error, most likely some new changes.  (I don't find the errors in local logs from September. I was trying to run TB under valgrind during mochitest and thus don't have many ordinary mochitest logs but the first ordinary mochitest run I did on October did contain the errors) .
The last ordinary mochitest run I did in September was based on the C-C tree
that contains the following |hg log| lines (and I added my local patches there) and the log did not contain the error line. So the error began popping up up afterward.
```
changeset:   33871:9671b0bbcd26
tag:	     qparent
fxtree:	     comm
user:	     Geoff Lankow <geoff@darktrojan.net>
date:	     Fri Sep 24 15:08:03 2021 +1200
summary:     Bug 1732420 - Port bug 1728180 - Unify js::intl_GetCalendarInfo. rs=bustage-fix

changeset:   33870:904caad064a0
user:	     Richard Marti <richard.marti@gmail.com>
date:	     Thu Sep 23 20:14:31 2021 +0200
summary:     Bug 1732371 - Fix the Dark/Light theme preview after bug 1730262. r=aleca

```