From d7128a78b1d996427494f40fb3aae8c2a6b784c9 Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Mon, 9 Jan 2017 15:50:29 +0300 Subject: [PATCH] Don't modify tabs at "SSTabRestoring" in capturing phase Weird things may happens sometimes (like empty tab with correct favicon) (#237) --- bootstrap.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap.js b/bootstrap.js index f4f8a26..7ab631a 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -3714,21 +3714,21 @@ var privateTab = { return isPrivate; }, duplicateTabAndTogglePrivate: function(tab, isPrivate) { - var window = tab.ownerDocument.defaultView; + var document = tab.ownerDocument; var gBrowser = this.getTabBrowser(tab); if(isPrivate === undefined) isPrivate = !this.isPrivateTab(tab); // Toggle // Set private attribute before our global "SSTabRestoring" listener var onRestore; - window.addEventListener("SSTabRestoring", onRestore = function(e) { - window.removeEventListener(e.type, onRestore, true); + document.addEventListener("SSTabRestoring", onRestore = function(e) { + document.removeEventListener(e.type, onRestore, false); _log("duplicateTabAndTogglePrivate() => " + e.type + " => update private attribute"); var tab = e.originalTarget || e.target; if(isPrivate) tab.setAttribute(this.privateAttr, "true"); else tab.removeAttribute(this.privateAttr); - }.bind(this), true); + }.bind(this), false); return gBrowser.duplicateTab(tab); }, toggleWindowPrivate: function(window, isPrivate) {