Skip to content

Commit

Permalink
e10s: use frame script in toggleTabPrivate()
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Jul 27, 2015
1 parent a5af254 commit 60de680
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3385,6 +3385,21 @@ var privateTab = {
toggleTabPrivate: function(tab, isPrivate, _silent) {
var window = tab.ownerDocument.defaultView;
var privacyContext = this.getTabPrivacyContext(tab);
if(!privacyContext) { // Electrolysis
//~ todo: find way to use only one frame script
_log("toggleTabPrivate(): getTabPrivacyContext() failed, will use frame script");
var data = '\
var isPrivate = ' + isPrivate + '\n\
var privacyContext = docShell.QueryInterface(Components.interfaces.nsILoadContext);\n\
if(isPrivate === undefined)\n\
isPrivate = !privacyContext.usePrivateBrowsing;\n\
if(privacyContext.usePrivateBrowsing != isPrivate)\n\
privacyContext.usePrivateBrowsing = isPrivate;\n\
';
var mm = tab.linkedBrowser.messageManager;
mm.loadFrameScript("data:application/javascript;charset=UTF-8," + encodeURIComponent(data), false);
return;
}
if(isPrivate === undefined)
isPrivate = !privacyContext.usePrivateBrowsing;

Expand Down

0 comments on commit 60de680

Please sign in to comment.