Bug 1293181 - only specify entryPoint=uitour to Sync when UITour is showing a highlight. r?jaws,MattN draft
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 09 Aug 2016 11:29:07 +1000
changeset 398362 ba5841a8565267ba3ec5037f99bf95cb0bed02b2
parent 397688 763fe887c37cee5fcfe0f00e94fdffc84a41ea1c
child 527641 ee8e8988d9ae983388cb7b47c1f850a0c1fe1871
push id25507
push userbmo:markh@mozilla.com
push dateTue, 09 Aug 2016 01:32:13 +0000
reviewersjaws, MattN
bugs1293181
milestone51.0a1
Bug 1293181 - only specify entryPoint=uitour to Sync when UITour is showing a highlight. r?jaws,MattN MozReview-Commit-ID: 3qAvQn7oNBb
browser/base/content/browser-syncui.js
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -286,20 +286,25 @@ var gSyncUI = {
    *          "reset" -- reset sync
    * @param entryPoint
    *        Indicates the entrypoint from where this method was called.
    */
 
   openSetup: function SUI_openSetup(wizardType, entryPoint = "syncbutton") {
     if (this.weaveService.fxAccountsEnabled) {
       // If the user is also in an uitour, set the entrypoint to `uitour`
-      if (UITour.tourBrowsersByWindow.get(window) &&
-          UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
-        entryPoint = "uitour";
-      }
+      // (UITour has grown to be more than just a tour, but for the purposes
+      // of this code, we want to know "are we currently in a tour?")
+      // The best indicator for this seems to be "is UITour highlighting
+      // anything?"
+      try {
+        if (window.document.getElementById("UITourHighlight").getAttribute("active")) {
+          entryPoint = "uitour";
+        }
+      } catch (ex) { /* element might not exist */ }
       this.openPrefs(entryPoint);
     } else {
       let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
       if (win)
         win.focus();
       else {
         window.openDialog("chrome://browser/content/sync/setup.xul",
                           "weaveSetup", "centerscreen,chrome,resizable=no",