Bug 1430751 - Apply unified behavior model for about: pages to about:privatebrowsing. r=gijs,mrbkap

This commit is contained in:
Christoph Kerschbaumer
2018-03-05 09:20:34 +01:00
parent d64851a5fe
commit 3c66d0e8e0
16 changed files with 275 additions and 127 deletions

View File

@@ -1286,7 +1286,7 @@ var gBrowserInit = {
BrowserOnClick.init();
FeedHandler.init();
CompactTheme.init();
AboutPrivateBrowsingListener.init();
AboutCapabilitiesListener.init();
TrackingProtection.init();
CaptivePortalWatcher.init();
ZoomUI.init(window);
@@ -1858,6 +1858,8 @@ var gBrowserInit = {
CompactTheme.uninit();
AboutCapabilitiesListener.uninit();
TrackingProtection.uninit();
CaptivePortalWatcher.uninit();
@@ -9033,25 +9035,37 @@ var PanicButtonNotifier = {
},
};
var AboutPrivateBrowsingListener = {
var AboutCapabilitiesListener = {
_topics: [
"AboutCapabilities:OpenPrivateWindow",
"AboutCapabilities:DontShowIntroPanelAgain",
],
init() {
window.messageManager.addMessageListener(
"AboutPrivateBrowsing:OpenPrivateWindow",
msg => {
let mm = window.messageManager;
for (let topic of this._topics) {
mm.addMessageListener(topic, this);
}
},
uninit() {
let mm = window.messageManager;
for (let topic of this._topics) {
mm.removeMessageListener(topic, this);
}
},
receiveMessage(aMsg) {
switch (aMsg.name) {
case "AboutCapabilities:OpenPrivateWindow":
OpenBrowserWindow({private: true});
});
window.messageManager.addMessageListener(
"AboutPrivateBrowsing:ToggleTrackingProtection",
msg => {
const PREF = "privacy.trackingprotection.pbmode.enabled";
Services.prefs.setBoolPref(PREF, !Services.prefs.getBoolPref(PREF));
});
window.messageManager.addMessageListener(
"AboutPrivateBrowsing:DontShowIntroPanelAgain",
msg => {
break;
case "AboutCapabilities:DontShowIntroPanelAgain":
TrackingProtection.dontShowIntroPanelAgain();
});
}
break;
}
},
};
const SafeBrowsingNotificationBox = {