From 60de680f0c40d4bd826ac33e3c2b042589b0f997 Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Mon, 27 Jul 2015 22:08:08 +0300 Subject: [PATCH] e10s: use frame script in toggleTabPrivate() (#162) --- bootstrap.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bootstrap.js b/bootstrap.js index dae8d17..d3c30b1 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -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;