diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index d9cff276ac..93818e290a 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -4296,94 +4296,17 @@
event.originalTarget.localName != "box")
return;
- // See comments in the "mousedown" and "click" event handlers of the
- // "tabbrowser-tabs" binding.
+ // See hack note in the tabbrowser-close-tab-button binding
if (!this._blockDblClick)
BrowserOpenTab();
- else
- this.flagBlockedOpenTabAfterDblClick = true;
event.preventDefault();
]]>
-
-
-
-
-
- 1 || !this._closeWindowWithLastTab)
this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true});
@@ -4756,6 +4679,63 @@
+ 1 && !this._ignoredClick) {
+ this._ignoredClick = true;
+ return;
+ }
+
+ // Reset the "ignored click" flag
+ this._ignoredClick = false;
+
+ tabContainer.tabbrowser.removeTab(bindingParent, {animate: true, byMouse: true});
+ tabContainer._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
+ * (see dblclick handler).
+ */
+ var clickedOnce = false;
+ function enableDblClick(event) {
+ var target = event.originalTarget;
+ if (target.className == 'tab-close-button')
+ target._ignoredClick = true;
+ if (!clickedOnce) {
+ clickedOnce = true;
+ return;
+ }
+ tabContainer._blockDblClick = false;
+ tabContainer.removeEventListener("click", enableDblClick, true);
+ }
+ tabContainer.addEventListener("click", enableDblClick, true);
+ ]]>
+
+
+ // for the one-close-button case
+ event.stopPropagation();
+
+
event.stopPropagation();