Bug 1381765 - Should show the first uncomplete tour by default;r=Fischer,mossop
authorgasolin <gasolin@gmail.com>
Tue, 18 Jul 2017 18:23:47 +0800
changeset 419180 162b4c3253c4d7acfb7251be61fdf5ec52f58a24
parent 419179 8e12f9e0619f51792f8dd6d1acb2eb355d98acae
child 419181 736042ec645d1c4c64af0528365768e40ee24e56
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFischer, mossop
bugs1381765
milestone56.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 1381765 - Should show the first uncomplete tour by default;r=Fischer,mossop MozReview-Commit-ID: 4vDvR4lVE16
browser/extensions/onboarding/content/onboarding.js
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -456,16 +456,18 @@ class Onboarding {
     switch (evt.target.id) {
       case "onboarding-overlay-button":
       case "onboarding-overlay-close-btn":
       // If the clicking target is directly on the outer-most overlay,
       // that means clicking outside the tour content area.
       // Let's toggle the overlay.
       case "onboarding-overlay":
         this.toggleOverlay();
+        let selectedTour = this._tours.find(tour => !this.isTourCompleted(tour.id)) || this._tours[0];
+        this.gotoPage(selectedTour.id);
         break;
       case "onboarding-notification-close-btn":
         this.hideNotification();
         this._removeTourFromNotificationQueue(this._notificationBar.dataset.targetTourId);
         break;
       case "onboarding-notification-action-btn":
         let tourId = this._notificationBar.dataset.targetTourId;
         this.toggleOverlay();
@@ -828,25 +830,25 @@ class Onboarding {
 
       div.id = `${tour.id}-page`;
       div.classList.add("onboarding-tour-page");
       div.style.display = "none";
       pagesFrag.appendChild(div);
       // Cache elements in arrays for later use to avoid cost of querying elements
       this._tourItems.push(li);
       this._tourPages.push(div);
+
+      this.markTourCompletionState(tour.id);
     }
-    tours.forEach(tour => this.markTourCompletionState(tour.id));
 
     let dialog = this._window.document.getElementById("onboarding-overlay-dialog");
     let ul = this._window.document.getElementById("onboarding-tour-list");
     ul.appendChild(itemsFrag);
     let footer = this._window.document.getElementById("onboarding-footer");
     dialog.insertBefore(pagesFrag, footer);
-    this.gotoPage(tours[0].id);
   }
 
   _loadCSS() {
     // Returning a Promise so we can inform caller of loading complete
     // by resolving it.
     return new Promise(resolve => {
       let doc = this._window.document;
       let link = doc.createElement("link");