Bug 456382 - mousing on last tab shouldn't close window (middle click, close button, context menu). ui-r=beltzner, r=gavin
authorTuukka Tolvanen <tuukka.tolvanen@gmail.com>
Thu, 15 Jan 2009 15:16:23 +0100
changeset 23744 e30f1765a42c06c8b7ad376facdb09e30f4cbe0f
parent 23743 5542884b9bdc8c0f14ecafd788628098d366bd45
child 23745 b01601d60e6172a9ada49ba7d8cf3cc8abbdcae8
child 23848 fc69496f131c8fb7b4eba8c33e33b62d61c8e35b
push id4696
push userdgottwald@mozilla.com
push dateThu, 15 Jan 2009 14:18:22 +0000
treeherdermozilla-central@e30f1765a42c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbeltzner, gavin
bugs456382
milestone1.9.2a1pre
Bug 456382 - mousing on last tab shouldn't close window (middle click, close button, context menu). ui-r=beltzner, r=gavin
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -114,17 +114,17 @@
             <xul:menuitem id="context_undoCloseTab"
                           label="&undoCloseTab.label;"
                           accesskey="&undoCloseTab.accesskey;"
                           command="History:UndoCloseTab"
                           anonid="undoCloseTabMenuItem"/>
             <xul:menuseparator/>
             <xul:menuitem id="context_closeTab" label="&closeTab.label;" accesskey="&closeTab.accesskey;"
                           oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
-                                     tabbrowser.removeTab(tabbrowser.mContextTab);"/>
+                                     tabbrowser.removeClickedTab(tabbrowser.mContextTab);"/>
           </xul:menupopup>
 
           <xul:tabs class="tabbrowser-tabs" flex="1"
                     anonid="tabcontainer"
                     setfocus="false"
                     onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
                     xbl:inherits="onnewtab"
                     ondblclick="this.parentNode.parentNode.parentNode.onTabBarDblClick(event);"
@@ -1010,17 +1010,17 @@
 
       <method name="onTabClick">
         <parameter name="event"/>
         <body>
           <![CDATA[
             if (event.button != 1 || event.target.localName != 'tab')
               return;
 
-            this.removeTab(event.target);
+            this.removeClickedTab(event.target);
             event.stopPropagation();
           ]]>
         </body>
       </method>
 
       <method name="onTitleChanged">
         <parameter name="evt"/>
         <body>
@@ -1492,16 +1492,25 @@
         <parameter name="aTab"/>
         <body>
           <![CDATA[
             this._endRemoveTab(this._beginRemoveTab(aTab, true));
           ]]>
         </body>
       </method>
 
+      <method name="removeClickedTab">
+        <parameter name="aTab"/>
+        <body>
+          <![CDATA[
+            this._endRemoveTab(this._beginRemoveTab(aTab, true, false));
+          ]]>
+        </body>
+      </method>
+
       <!-- Returns everything that _endRemoveTab needs in an array. -->
       <method name="_beginRemoveTab">
         <parameter name="aTab"/>
         <parameter name="aFireBeforeUnload"/>
         <parameter name="aCloseWindowWithLastTab"/>
         <body>
           <![CDATA[
             if (aFireBeforeUnload) {
@@ -3287,17 +3296,17 @@
             if (event.detail > 1 && !this._ignoredClick) {
               this._ignoredClick = true;
               return;
             }
 
             // Reset the "ignored click" flag
             this._ignoredClick = false;
 
-            tabbedBrowser.removeTab(bindingParent);
+            tabbedBrowser.removeClickedTab(bindingParent);
             tabbedBrowser._blockDblClick = true;
 
             /* XXXmano hack (see bug 343628):
              * Since we're removing the event target, if the user
              * double-clicks this button, the dblclick event will be dispatched
              * with the tabbar as its event target (and explicit/originalTarget),
              * which treats that as a mouse gesture for opening a new tab.
              * In this context, we're manually blocking the dblclick event