Closed Bug 588895 Opened 14 years ago Closed 14 years ago

Implement getBrowser() in MailNews windows

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.1b1

People

(Reporter: kairo, Assigned: kairo)

References

Details

Attachments

(1 file)

Thunderbird has a getBrowser() implementation in its mail window, originally introduced for their use of the find bar, but also used with toolkit's zoom manager and potentially others, see http://mxr.mozilla.org/comm-central/source/mail/base/content/mailWindow.js#506

We should implement it for the same reasons as well as for Thunderbird add-on compat.

I'll need it for the zoom manager in bug 386363, for one thing.
FYI, bug 328795 originally introduced it in Thunderbird.

I already worked around it not being there in bug bug 562339 ending up with http://mxr.mozilla.org/comm-central/source/suite/mailnews/mailContextMenus.js#119 - we should probably changes that one to use getBrowser() as well.
This patch is relatively straight-forward, esp. as that caller it adds right now had exactly the same code in use before. :)
Attachment #467496 - Flags: review?(iann_bugzilla)
Comment on attachment 467496 [details] [diff] [review]
v1: implement it!

>+// The zoom manager, view source and possibly some other functions still rely
>+// on the getBrowser function.
>+function getBrowser()
>+{
>+  return GetTabMail() ? GetTabMail().getBrowserForSelectedTab() :
>+                        document.getElementById("messagepane");
>+}

Um, getMessageBrowser() exists...
(In reply to comment #3)
> Um, getMessageBrowser() exists...

for one thing, it can't replace getBrowser() as toolkit code doesn't know about anything else but getBrowser. For the other, it doesn't take .getBrowserForSelectedTab() into account, from what I see, and Thunderbird switched away from what getMessageBrowser does in bug 495818 because that returned the wrong browser in some cases.
Comment on attachment 467496 [details] [diff] [review]
v1: implement it!

I'd prefer getBrowser function to be in mailWindowOverlay.js, so r=me with that addressed.
Attachment #467496 - Flags: review?(iann_bugzilla) → review+
> > Um, getMessageBrowser() exists...
> 
> for one thing, it can't replace getBrowser() as toolkit code doesn't know about
> anything else but getBrowser. For the other, it doesn't take
> .getBrowserForSelectedTab() into account, from what I see, and Thunderbird
> switched away from what getMessageBrowser does in bug 495818 because that
> returned the wrong browser in some cases.

I meant that you should call getMessageBrowser() (or even gMessageBrowser) instead of touching document.getElementById("messagepane") directly.
Pushed as http://hg.mozilla.org/comm-central/rev/071ee24478ff with Ian's and Karsten's nits addressed.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.1b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: