mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
41ba1acfa5
--HG-- extra : rebase_source : d8414b8de165cf2fa534719c36416d82d21872c6
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
var _PBSvc = null;
|
|
|
|
function get_PBSvc()
|
|
{
|
|
if (_PBSvc)
|
|
return _PBSvc;
|
|
|
|
try {
|
|
_PBSvc = Components.classes["@mozilla.org/privatebrowsing;1"].
|
|
getService(Components.interfaces.nsIPrivateBrowsingService);
|
|
return _PBSvc;
|
|
}
|
|
catch (ex) {
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function enterPrivateBrowsing()
|
|
{
|
|
if (get_PBSvc()) {
|
|
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].
|
|
getService(Components.interfaces.nsIPrefBranch);
|
|
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
|
|
|
get_PBSvc().privateBrowsingEnabled = true;
|
|
}
|
|
}
|
|
|
|
function leavePrivateBrowsing()
|
|
{
|
|
if (get_PBSvc()) {
|
|
get_PBSvc().privateBrowsingEnabled = false;
|
|
|
|
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].
|
|
getService(Components.interfaces.nsIPrefBranch);
|
|
if (prefBranch.prefHasUserValue("browser.privatebrowsing.keep_current_session"))
|
|
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
|
}
|
|
}
|