Bug 1236231 - Make sure the Tracking Protection tour doorhanger is not shown when the tour starts from about:privatebrowsing. r=past
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7898,16 +7898,21 @@ var AboutPrivateBrowsingListener = {
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 => {
+ TrackingProtection.dontShowIntroPanelAgain();
+ });
}
};
function TabModalPromptBox(browser) {
this._weakBrowserRef = Cu.getWeakReference(browser);
}
TabModalPromptBox.prototype = {
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -224,16 +224,18 @@ var AboutHomeListener = {
AboutHomeListener.init(this);
var AboutPrivateBrowsingListener = {
init(chromeGlobal) {
chromeGlobal.addEventListener("AboutPrivateBrowsingOpenWindow", this,
false, true);
chromeGlobal.addEventListener("AboutPrivateBrowsingToggleTrackingProtection", this,
false, true);
+ chromeGlobal.addEventListener("AboutPrivateBrowsingDontShowIntroPanelAgain", this,
+ false, true);
},
get isAboutPrivateBrowsing() {
return content.document.documentURI.toLowerCase() == "about:privatebrowsing";
},
handleEvent(aEvent) {
if (!this.isAboutPrivateBrowsing) {
@@ -241,16 +243,19 @@ var AboutPrivateBrowsingListener = {
}
switch (aEvent.type) {
case "AboutPrivateBrowsingOpenWindow":
sendAsyncMessage("AboutPrivateBrowsing:OpenPrivateWindow");
break;
case "AboutPrivateBrowsingToggleTrackingProtection":
sendAsyncMessage("AboutPrivateBrowsing:ToggleTrackingProtection");
break;
+ case "AboutPrivateBrowsingDontShowIntroPanelAgain":
+ sendAsyncMessage("AboutPrivateBrowsing:DontShowIntroPanelAgain");
+ break;
}
},
};
AboutPrivateBrowsingListener.init(this);
var AboutReaderListener = {
_articlePromise: null,
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -52,16 +52,18 @@ document.addEventListener("DOMContentLoa
document.title = stringBundle.GetStringFromName("title");
document.getElementById("favicon")
.setAttribute("href", FAVICON_PRIVACY);
document.getElementById("enableTrackingProtection")
.addEventListener("click", toggleTrackingProtection);
document.getElementById("disableTrackingProtection")
.addEventListener("click", toggleTrackingProtection);
+ document.getElementById("startTour")
+ .addEventListener("click", dontShowIntroPanelAgain);
let formatURLPref = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Ci.nsIURLFormatter).formatURLPref;
document.getElementById("startTour").setAttribute("href",
formatURLPref("privacy.trackingprotection.introURL"));
document.getElementById("learnMore").setAttribute("href",
formatURLPref("app.support.baseURL") + "private-browsing");
@@ -76,8 +78,15 @@ function openPrivateWindow() {
}
function toggleTrackingProtection() {
// Ask chrome to enable tracking protection
document.dispatchEvent(
new CustomEvent("AboutPrivateBrowsingToggleTrackingProtection",
{bubbles:true}));
}
+
+function dontShowIntroPanelAgain() {
+ // Ask chrome to disable the doorhanger
+ document.dispatchEvent(
+ new CustomEvent("AboutPrivateBrowsingDontShowIntroPanelAgain",
+ {bubbles:true}));
+}