Closed Bug 1659162 Opened 5 years ago Closed 4 years ago

Error when creating mailing list from contacts sidebar context: Uncaught ReferenceError: gDirectoryTreeView is not defined

Categories

(Thunderbird :: Address Book, defect)

defect

Tracking

(thunderbird_esr78 wontfix, thunderbird80 affected, thunderbird81 affected)

RESOLVED FIXED
81 Branch
Tracking Status
thunderbird_esr78 --- wontfix
thunderbird80 --- affected
thunderbird81 --- affected

People

(Reporter: thomas8, Assigned: mkmelin)

Details

Attachments

(1 file, 2 obsolete files)

Seen on daily 81.0a1 (2020-08-14) (64-bit)

Str:

  1. compose new msg
  2. from contacts sidebar, get ab context menu (mini-burger, or right-click pane whitespace)
  3. New List

Actual:

daily 81.0a1 (2020-08-14) (64-bit) and
beta 80.0b3 (32-bit):

Uncaught ReferenceError: gDirectoryTreeView is not defined
goNewListDialog chrome://messenger/content/addressbook/abCommon.js:788
AbPanelNewList chrome://messenger/content/addressbook/abContactsPanel.js:199
oncommand chrome://messenger/content/addressbook/abContactsPanel.xhtml:1
abCommon.js:788:5

Release 78.1.1 (64-bit):

[Exception... "JavaScript component does not have a method named: "hasEmailAddress"'JavaScript component does not have a method named: "hasEmailAddress"' when calling method: [nsIAbCard::hasEmailAddress]" nsresult: "0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)" location: "JS frame :: chrome://messenger/content/msgHdrView.js :: UpdateExtraAddressProcessing :: line 1548" data: no] 2 msgHdrView.js:1548:17

Seems like a harmless error.
But we should fix it. The sidebar didn't have the expected include. However, trying to select the list after it's creation would be weird in the sidebar, where you can search by name and then the new list would all the sudden get selected.

Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Attachment #9170916 - Flags: review?(bugzilla2007)
Severity: -- → S4
Comment on attachment 9170916 [details] [diff] [review] bug1659162_sidebar_gDirectoryTreeView.patch Review of attachment 9170916 [details] [diff] [review]: ----------------------------------------------------------------- Thanks. This fixes it. However, do we need to load abTrees.js into contacts sidebar just to check for gDirectoryTreeView which we already know does *not* exist there? Commit message: capitalization in r=ThomasD I'll upload a patch just now with these nits fixed. ::: mail/components/addrbook/content/abCommon.js @@ +783,5 @@ > "", > "chrome,modal,resizable=no,centerscreen", > params > ); > + if (params.newListURI && gDirectoryTreeView.selection) { Check for existence of gDirectoryTreeView while avoiding the reference error. ``` if (params.newListURI && typeof gDirectoryTreeView !== "undefined") { ``` ::: mail/components/addrbook/content/abContactsPanel.xhtml @@ +32,5 @@ > <script src="chrome://messenger/content/addressbook/abResultsPane.js"/> > <script src="chrome://messenger/content/addressbook/abContactsPanel.js"/> > <script src="chrome://messenger/content/jsTreeView.js"/> > <script src="chrome://messenger/content/addressbook/abView.js"/> > + <script src="chrome://messenger/content/addressbook/abTrees.js"/> Now we don't need to load this into memory any more.
Attachment #9170916 - Flags: review?(bugzilla2007)

New patch with the proposed little amendments.

Attachment #9171270 - Flags: review+

(In reply to Thomas D. (:thomas8) from comment #2)

Thanks. This fixes it. However, do we need to load abTrees.js into contacts
sidebar just to check for gDirectoryTreeView which we already know does
not exist there?

Strictly speaking it's likely not needed. However, since the files are split up in these weird ways, I think including it is the correct way - otherwise there's a trap for future devs who do not realize that's not there. The linting is also set up not to help, since it says "you can assume abTreees.js is loaded here". https://searchfox.org/comm-central/rev/c25f688917f090fb02d31f0160e484fd2b8ad93e/mail/components/addrbook/content/abCommon.js#9
That it's not really common code but still in abCommon.js is perhaps the real bug, but I didn't want to go down that rabbit hole...

(In reply to Magnus Melin [:mkmelin] from comment #4)

(In reply to Thomas D. (:thomas8) from comment #2)

However, do we need to load abTrees.js into contacts sidebar
Strictly speaking it's likely not needed. However, since the files are split up in these weird ways, I think including it is the correct way

Yeah, ok, sort of. Thanks for the explanation!
Patch adjusted per your preference.

Attachment #9170916 - Attachment is obsolete: true
Attachment #9171270 - Attachment is obsolete: true
Attachment #9171377 - Flags: review+

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/315dd887eb1e
Don't try to select a new mailing list if it was created from Contacts Sidebar. r=ThomasD

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch

This is harmless so we don't need to uplift it anywhere.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: