Bug 1236231 - Make sure the Tracking Protection tour doorhanger is not shown when the tour starts from about:privatebrowsing. r=past
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 11 Jan 2016 14:40:31 +0000
changeset 281512 166f314b7d4dc21be028a8307d2e34887b9e95da
parent 281511 0b913b279cb68c70f135deabd3c729d75ede226b
child 281513 fd55305662594a886ca5bf3ad77f3afbe4d53034
push id29944
push userkwierso@gmail.com
push dateMon, 25 Jan 2016 22:00:46 +0000
treeherdermozilla-central@aa90f482e16d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1236231
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1236231 - Make sure the Tracking Protection tour doorhanger is not shown when the tour starts from about:privatebrowsing. r=past
browser/base/content/browser.js
browser/base/content/tab-content.js
browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7877,16 +7877,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}));
+}