зеркало из https://github.com/mozilla/gecko-dev.git
Bug 802274 - Part 1: Add support for temporary autostart private browsing mode to PrivateBrowsingUtils; r=jdm
This commit is contained in:
Родитель
39050309b1
Коммит
7b8a92de57
|
@ -6,7 +6,11 @@ this.EXPORTED_SYMBOLS = ["PrivateBrowsingUtils"];
|
|||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const kAutoStartPref = "browser.components.autostart";
|
||||
const kAutoStartPref = "browser.privatebrowsing.autostart";
|
||||
|
||||
// This will be set to true when the PB mode is autostarted from the command
|
||||
// line for the current session.
|
||||
let gTemporaryAutoStartMode = false;
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -24,7 +28,8 @@ this.PrivateBrowsingUtils = {
|
|||
|
||||
get permanentPrivateBrowsing() {
|
||||
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
return Services.prefs.getBoolPref(kAutoStart, false);
|
||||
return gTemporaryAutoStartMode ||
|
||||
Services.prefs.getBoolPref(kAutoStartPref, false);
|
||||
#else
|
||||
try {
|
||||
return Cc["@mozilla.org/privatebrowsing;1"].
|
||||
|
@ -34,12 +39,20 @@ this.PrivateBrowsingUtils = {
|
|||
return false; // PB not supported
|
||||
}
|
||||
#endif
|
||||
},
|
||||
|
||||
// These should only be used from internal code
|
||||
enterTemporaryAutoStartMode: function pbu_enterTemporaryAutoStartMode() {
|
||||
gTemporaryAutoStartMode = true;
|
||||
},
|
||||
get isInTemporaryAutoStartMode() {
|
||||
return gTemporaryAutoStartMode;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
function autoStartObserver(aSubject, aTopic, aData) {
|
||||
var newValue = Services.prefs.getBoolPref(kAutoStart);
|
||||
var newValue = Services.prefs.getBoolPref(kAutoStartPref);
|
||||
var windowsEnum = Services.wm.getEnumerator(null);
|
||||
while (windowsEnum.hasMoreElements()) {
|
||||
var window = windowsEnum.getNext();
|
||||
|
|
Загрузка…
Ссылка в новой задаче