I'm developing TB extension. I've added field to messagePane just below "from, subject, to" fields. So I need to update the field value correctly. I'm getting the value from msgHdr. My current approach is to listen "load" event of the messagePane document. It works fine when there opened only one message in TB. But if there are several opened messages, then every message window gets the same field value, because every window triggers "load" event of last loaded message. It is bug. When I'm receiving load event, how can I determine the msgHdr of message opened in the window? Is it stored somewhere? Have the windows any identity information like handle, uri or something else? Why DOM inspector shows only one DOM node of my field while it exists in every messagePane? Sorry for a bag of questions, I just cannot understand the whole mess with TB windows.
Thanks.
Message windows have the global variable gMessageDisplay which has the property displayedMessage. displayedMessage is the currently displayed message's nsIMsgDBHdr.
For getting notifications when a new message is displayed I suggest adding a listener to gMessageListeners:
Take your action in onStartHeaders or onEndHeaders.