Bug 523740: only show about:firstrun on real "first runs", show autocomplete popup otherwise, r=mfinkle
authorGavin Sharp <gavin@gavinsharp.com>
Fri, 13 Nov 2009 14:36:39 -0500
changeset 49652 70455824d7c45f96052e7db3c39048c1e652bb8d
parent 49651 63c932e29801d767f340a80404c3dd55226d388a
child 49653 5f6ad7997da7ab571f461580630f7312589241e0
push id15027
push useredward.lee@engineering.uiuc.edu
push dateThu, 12 Aug 2010 09:51:47 +0000
treeherderautoland@cdfff833edf9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs523740
Bug 523740: only show about:firstrun on real "first runs", show autocomplete popup otherwise, r=mfinkle
toolkit/content/Geometry.jsm
--- a/toolkit/content/Geometry.jsm
+++ b/toolkit/content/Geometry.jsm
@@ -128,16 +128,44 @@ let Util = {
         result: true,
         scale: viewportScale,
         width: parseInt(windowUtils.getDocumentMetadata("viewport-width")),
         height: parseInt(windowUtils.getDocumentMetadata("viewport-height"))
       }
     }
 
     return {reason: "", result: false};
+  },
+
+  /**
+   * Determines whether a home page override is needed.
+   * Returns:
+   *  "new profile" if this is the first run with a new profile.
+   *  "new version" if this is the first run with a build with a different
+   *                      Gecko milestone (i.e. right after an upgrade).
+   *  "none" otherwise.
+   */
+  needHomepageOverride: function needHomepageOverride() {
+    let savedmstone = null;
+    try {
+      savedmstone = gPrefService.getCharPref("browser.startup.homepage_override.mstone");
+    } catch (e) {}
+
+    if (savedmstone == "ignore")
+      return "none";
+
+#expand    let ourmstone = "__MOZ_APP_VERSION__";
+
+    if (ourmstone != savedmstone) {
+      gPrefService.setCharPref("browser.startup.homepage_override.mstone", ourmstone);
+
+      return (savedmstone ? "new version" : "new profile");
+    }
+
+    return "none";
   }
 };
 
 
 /**
  * Simple Point class.
  *
  * Any method that takes an x and y may also take a point.