Bug 648715 - "Version/Channel compatibility for Firefox 5 beta" [r=mark.finkle]
authorJono X <jdicarlo@mozilla.com>
Sat, 09 Apr 2011 23:33:00 -0400
changeset 67883 62c358785d4c9ec9542bc181ed9c1e1da72a5515
parent 67882 598855101f1258c76db07a7bef823c416d44f588
child 67884 64b8491e8833c4aa0b48069124745790cff4d09a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark
bugs648715
milestone2.2a1pre
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 648715 - "Version/Channel compatibility for Firefox 5 beta" [r=mark.finkle]
browser/app/profile/extensions/testpilot@labs.mozilla.com/install.rdf
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/interface.js
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/install.rdf
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/install.rdf
@@ -1,24 +1,24 @@
 <?xml version="1.0"?>
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>testpilot@labs.mozilla.com</em:id>
-    <em:version>1.0.6</em:version>
+    <em:version>1.0.9</em:version>
     <em:type>2</em:type>
 
     <!-- Target Application this extension can install into, 
          with minimum and maximum supported versions. --> 
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
         <em:minVersion>3.5</em:minVersion>
-        <em:maxVersion>4.0.*</em:maxVersion>
+        <em:maxVersion>5.0</em:maxVersion>
       </Description>
     </em:targetApplication>
    
     <!-- Front End MetaData -->
     <em:name>Feedback</em:name>
     <em:description>Help make Firefox better by giving feedback.</em:description>
     <em:creator>Mozilla Corporation</em:creator>
     <em:homepageURL>http://testpilot.mozillalabs.com/</em:homepageURL>
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/interface.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/interface.js
@@ -103,18 +103,19 @@ var TestPilotUIBuilder = {
       window.document.getElementById("feedback-menu-sad-button").setAttribute("hidden", "true");
     } else {
       window.document.getElementById("feedback-menu-broken-button").setAttribute("hidden", "true");
       window.document.getElementById("feedback-menu-idea-button").setAttribute("hidden", "true");
     }
   },
 
   isBetaChannel: function() {
-    // Nightly channel is treated the same as default channel.
-    return (this._prefs.getCharPref(UPDATE_CHANNEL_PREF) == "beta");
+    // Beta and aurora channels use feedback interface; nightly and release channels don't.
+    let channel = this._prefs.getCharPref(UPDATE_CHANNEL_PREF);
+    return (channel == "beta") || (channel == "betatest") || (channel == "aurora");
   },
 
   appVersionIsFinal: function() {
     // Return true iff app version >= 4.0 AND there is no "beta" or "rc" in version string.
     let appInfo = Cc["@mozilla.org/xre/app-info;1"]
       .getService(Ci.nsIXULAppInfo);
     let version = appInfo.version;
     let versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
@@ -180,37 +180,32 @@ let TestPilotSetup = {
   __obs: null,
   get _obs() {
     if (this.__obs == null) {
       this.__obs = this._loader.require("observer-service");
     }
     return this.__obs;
   },
 
-  _isFfx4BetaVersion: function TPS__isFfx4BetaVersion() {
-    let result = Cc["@mozilla.org/xpcom/version-comparator;1"]
-                   .getService(Ci.nsIVersionComparator)
-                   .compare("3.7a1pre", this._application.version);
-    if (result < 0) {
-      return true;
-    } else {
-      return false;
-    }
+  _isBetaChannel: function TPS__isBetaChannel() {
+    // Beta and aurora channels use feedback interface; nightly and release channels don't.
+    let channel = this._prefs.getValue(UPDATE_CHANNEL_PREF, "");
+    return (channel == "beta") || (channel == "betatest") || (channel == "aurora");
   },
 
   _setPrefDefaultsForVersion: function TPS__setPrefDefaultsForVersion() {
     /* A couple of preferences need different default values depending on
      * whether we're in the Firefox 4 beta version or the standalone TP version
      */
     let ps = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService);
     let prefBranch = ps.getDefaultBranch("");
     /* note we're setting default values, not current values -- these
      * get overridden by any user set values. */
-    if (this._isFfx4BetaVersion()) {
+    if (this._isBetaChannel()) {
       prefBranch.setBoolPref(POPUP_SHOW_ON_NEW, true);
       prefBranch.setIntPref(POPUP_CHECK_INTERVAL, 600000);
     } else {
       prefBranch.setBoolPref(POPUP_SHOW_ON_NEW, false);
       prefBranch.setIntPref(POPUP_CHECK_INTERVAL, 180000);
     }
   },
 
@@ -257,17 +252,17 @@ let TestPilotSetup = {
       }}, this._prefs.getValue(POPUP_REMINDER_INTERVAL, 86400000),
       Ci.nsITimer.TYPE_REPEATING_SLACK);
 
       this.getVersion(function() {
       // Show first run page (in front window) if newly installed or upgraded.
         let currVersion = self._prefs.getValue(VERSION_PREF, "firstrun");
 
         if (currVersion != self.version) {
-          if(!self._isFfx4BetaVersion()) {
+          if(!self._isBetaChannel()) {
             self._prefs.setValue(VERSION_PREF, self.version);
             let browser = self._getFrontBrowserWindow().getBrowser();
             let url = self._prefs.getValue(FIRST_RUN_PREF, "");
             let tab = browser.addTab(url);
             browser.selectedTab = tab;
           }
           // Don't show first run page in ffx4 beta version.
         }
@@ -381,17 +376,17 @@ let TestPilotSetup = {
 
     // If there are multiple windows, show notifications in the frontmost
     // window.
     let window = this._getFrontBrowserWindow();
     let doc = window.document;
     let popup = doc.getElementById("pilot-notification-popup");
 
     let anchor;
-    if (this._isFfx4BetaVersion()) {
+    if (this._isBetaChannel()) {
       /* If we're in the Ffx4Beta version, popups come down from feedback
        * button, but if we're in the standalone extension version, they
        * come up from status bar icon. */
       anchor = doc.getElementById("feedback-menu-button");
       popup.setAttribute("class", "tail-up");
     } else {
       anchor = doc.getElementById("pilot-notifications-button");
       popup.setAttribute("class", "tail-down");