Skip to content

Commit

Permalink
Don't modify tabs at "SSTabRestoring" in capturing phase
Browse files Browse the repository at this point in the history
Weird things may happens sometimes (like empty tab with correct favicon)
(#237)
  • Loading branch information
Infocatcher committed Jan 9, 2017
1 parent 17edfae commit d7128a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d7128a7

Please sign in to comment.