Commit 9162c555 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 26961: New user onboarding.

Reuse the Firefox onboarding mechanism with minimal changes.
Localizable strings are pulled in from Torbutton (if Torbutton is
  not installed, we lack about:tor and no tour will be shown).
Replace SVG images with PNGs (see bug 27002),
For defense in depth, omit include OnboardingTelemetry.jsm entirely.
Added support for the following UITour page event:
  torBrowserOpenSecuritySettings
parent bcf94f96
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -325,6 +325,11 @@ pref("browser.download.panel.shown", true);
// Treat .onions as secure
pref("dom.securecontext.whitelist_onions", true);

// Onboarding.
pref("browser.onboarding.newtour", "welcome,privacy,tor-network,circuit-display,security,expect-differences,onion-services");
pref("browser.onboarding.updatetour", "welcome,privacy,tor-network,circuit-display,security,expect-differences,onion-services");
pref("browser.onboarding.skip-tour-button.hide", true);

#ifdef TOR_BROWSER_VERSION
#expand pref("torbrowser.version", __TOR_BROWSER_VERSION__);
#endif
+7 −0
Original line number Diff line number Diff line
@@ -789,6 +789,13 @@ if (typeof Mozilla == "undefined") {
  Mozilla.UITour.closeTab = function() {
    _sendEvent("closeTab");
  };

  /**
  * @summary Opens Torbutton's Security Settings (aka the Security Slider).
  */
  Mozilla.UITour.torBrowserOpenSecuritySettings = function() {
    _sendEvent("torBrowserOpenSecuritySettings");
  };
})();

// Make this library Require-able.
+7 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ const PREF_LOG_LEVEL = "browser.uitour.loglevel";
const PREF_SEENPAGEIDS    = "browser.uitour.seenPageIDs";

const TOR_BROWSER_PAGE_ACTIONS_ALLOWED = new Set([
  // Add page actions used by Tor Browser's new user/feature onboarding here.
  "torBrowserOpenSecuritySettings",
]);

const BACKGROUND_PAGE_ACTIONS_ALLOWED = new Set([
@@ -694,6 +694,12 @@ var UITour = {
        }
        break;
      }

      case "torBrowserOpenSecuritySettings":
        // Ask Torbutton to open the Tor Browser Security Settings.
        Services.obs.notifyObservers(undefined, "TorOpenSecuritySettings",
                                     undefined);
        break;
    }

    // For performance reasons, only call initForBrowser if we did something
+15 −2
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
  OnboardingTourType: "resource://onboarding/modules/OnboardingTourType.jsm",
  OnboardingTelemetry: "resource://onboarding/modules/OnboardingTelemetry.jsm",
  Services: "resource://gre/modules/Services.jsm",
  UIState: "resource://services-sync/UIState.jsm",
});
@@ -27,6 +26,17 @@ const PREF_WHITELIST = [
];

[
  // Tor Browser tours:
  "onboarding-tour-tor-welcome",
  "onboarding-tour-tor-privacy",
  "onboarding-tour-tor-network",
  "onboarding-tour-tor-circuit-display",
  "onboarding-tour-tor-security",
  "onboarding-tour-tor-expect-differences",
  "onboarding-tour-tor-onion-services",
#if 0
// Firefox tours. To reduce conflicts when rebasing against newer Firefox
// code, we use the preprocessor to omit this code block.
  "onboarding-tour-addons",
  "onboarding-tour-customize",
  "onboarding-tour-default-browser",
@@ -36,6 +46,7 @@ const PREF_WHITELIST = [
  "onboarding-tour-screenshots",
  "onboarding-tour-singlesearch",
  "onboarding-tour-sync",
#endif
].forEach(tourId => PREF_WHITELIST.push([`browser.onboarding.tour.${tourId}.completed`, PREF_BOOL]));

let waitingForBrowserReady = true;
@@ -149,6 +160,8 @@ function initContentMessageListener() {
          isLoggedIn: syncTourChecker.isLoggedIn()
        });
        break;
#if 0
// No telemetry in Tor Browser.
      case "ping-centre":
        try {
          OnboardingTelemetry.process(msg.data.params.data);
@@ -156,6 +169,7 @@ function initContentMessageListener() {
          Cu.reportError(e);
        }
        break;
#endif
    }
  });
}
@@ -167,7 +181,6 @@ function onBrowserReady() {
  waitingForBrowserReady = false;

  OnboardingTourType.check();
  OnboardingTelemetry.init(startupData);
  Services.mm.loadFrameScript("resource://onboarding/onboarding.js", true);
  initContentMessageListener();
}
+798 B
Loading image diff...
Loading