commit cd00a313475584c0a4b94eaea5171428b993ce5b Author: Kathy Brade brade@pearlcrescent.com Date: Sat Sep 1 14:51:12 2018 -0400
squash! Bug 26961: New user onboarding.
Also fix bug 27403: the onboarding bubble is not always displayed. --- browser/extensions/onboarding/bootstrap.js | 6 +++++- browser/extensions/onboarding/content/onboarding.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/browser/extensions/onboarding/bootstrap.js b/browser/extensions/onboarding/bootstrap.js index 4bc6d468dce9..0762249ba1e9 100644 --- a/browser/extensions/onboarding/bootstrap.js +++ b/browser/extensions/onboarding/bootstrap.js @@ -14,7 +14,11 @@ XPCOMUtils.defineLazyModuleGetters(this, {
const {PREF_STRING, PREF_BOOL, PREF_INT} = Ci.nsIPrefBranch;
-const BROWSER_READY_NOTIFICATION = "browser-delayed-startup-finished"; +// In Tor Browser we initialize onboarding upon "final-ui-startup" instead +// of waiting for "browser-delayed-startup-finished"; otherwise, on first +// run the onboarding frame script's "onload" listener is installed too +// late to detect that about:tor is loaded. +const BROWSER_READY_NOTIFICATION = "final-ui-startup"; const BROWSER_SESSION_STORE_NOTIFICATION = "sessionstore-windows-restored"; const PREF_WHITELIST = [ ["browser.onboarding.enabled", PREF_BOOL], diff --git a/browser/extensions/onboarding/content/onboarding.js b/browser/extensions/onboarding/content/onboarding.js index 1f46abdb722d..dd776b3edf93 100644 --- a/browser/extensions/onboarding/content/onboarding.js +++ b/browser/extensions/onboarding/content/onboarding.js @@ -642,7 +642,11 @@ class Onboarding { }
_resizeUI() { - this._windowWidth = this._window.document.body.getBoundingClientRect().width; + // In Tor Browser we check against innerWidth instead of against the + // body's bounding rect because about:tor keeps its body hidden until + // the Tor status is known, and the bounding rect is zero while the + // body is hidden. + this._windowWidth = this._window.innerWidth; if (this._windowWidth < ONBOARDING_MIN_WIDTH_PX) { // Don't show the overlay UI before we get to a better, responsive design. this.destroy();