window.close() from a content tab closes Thunderbird window

RESOLVED FIXED in Thunderbird 3.0b4


10 years ago
10 years ago


(Reporter: gaubugzilla, Assigned: standard8)


(Blocks 1 bug)

Thunderbird 3.0b4
Dependency tree / graph
Bug Flags:
wanted-thunderbird3 +

Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)

I am opening a dialog in a Thunderbird tab of type "contentTab". Dialogs call window.close() by default when the accept button is pressed. No issues in Firefox, yet in Thunderbird (Shredder 20090708 build on Windows XP) this closes the entire Thunderbird window. The code preventing this in tabbrowser (and missing in tabmail) seems to be this:

      <handler event="DOMWindowClose" phase="capturing">
          if (!event.isTrusted)

          const browsers = this.mPanelContainer.childNodes;
          if (browsers.length == 1) {
            // There's only one browser left. If a window is being
            // closed and the window is *not* the window in the
            // browser that's still around, prevent the event's default
            // action to prevent closing a window that's being closed
            // already.
            if (this.getBrowserAtIndex(0).contentWindow !=


          var i = 0;
          for (; i < browsers.length; ++i) {
            if (this.getBrowserAtIndex(i).contentWindow == {


At the very least, Thunderbird should prevent propagation of this event. However, it can probably also query its tabs whether they "know" the event target - and close the one that does.
Good point, although I'd debate that a tab is not a dialog - a dialog is a special window to display information or get a response. A content tab is just a tab to display content.

However I can port this code across as it sounds like a good idea to have anyway.
Assignee: nobody → bugzilla
Flags: wanted-thunderbird3+
The reason this bug strikes me as important is because it makes it harder for extensions targetted at both Firefox and Thunderbird to Just Work.  It doesn't feel quite important enough to block Tb3, however.
Posted patch Possible fix (obsolete) — Splinter Review
I've not tested this yet (apart from running up TB with a tab), but I think this would potentially be enough, though it may need moving to tabmail.xml.
Confirmed, this patch fixes the issue for Adblock Plus.
Posted patch The fixSplinter Review
I reworked the previous fix for this a bit. I've now split out setting up the listeners into separate functions and reordered the openTab function - hopefully this makes things a bit clearer especially when it comes to editing.
Attachment #387848 - Attachment is obsolete: true
Attachment #396202 - Flags: review?(bugmail)
Attachment #396202 - Flags: review?(bugmail) → review+
Checked in:
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b4
You need to log in before you can comment on or make changes to this bug.