Skip to content

Commit

Permalink
toggleTabPrivate(): check for last private tab in multi-process mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Mar 1, 2016
1 parent 9a5657b commit 71cb4f7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3600,8 +3600,25 @@ var privateTab = {
}));
},
toggleTabPrivate: function(tab, isPrivate, _silent) {
var window = tab.ownerDocument.defaultView;
if(this.isRemoteTab(tab)) {
_log("toggleTabPrivate(): will use frame script");

var isPrivateAttr = isPrivate === undefined
? !tab.hasAttribute(this.privateAttr)
: isPrivate;
if(
!isPrivateAttr
&& tab.hasAttribute(this.privateAttr)
) {
this.checkNoPrivate(window);
if(this.isLastPrivate(tab)) {
_log("toggleTabPrivate() called for last private tab");
if(this.forbidCloseLastPrivate())
return undefined;
}
}

var mm = tab.linkedBrowser.messageManager;
var receiveMessage = function(msg) {
mm.removeMessageListener("PrivateTab:PrivateChanged", receiveMessage);
Expand All @@ -3621,7 +3638,6 @@ var privateTab = {
return;
}

var window = tab.ownerDocument.defaultView;
var privacyContext = this.getTabPrivacyContext(tab);
if(isPrivate === undefined)
isPrivate = !privacyContext.usePrivateBrowsing;
Expand Down

0 comments on commit 71cb4f7

Please sign in to comment.