Bug 706777 - Automatically repopulate AddonRepository database on application upgrade. r=dtownsend
authorBlair McBride <bmcbride@mozilla.com>
Wed, 07 Dec 2011 23:48:33 +1300
changeset 83817 109bb6c0e72a9e1c6cfa8d4a5fa383e1a39ad6c4
parent 83703 658fad825c36eae247dbd43df3b1d456d95fb39f
child 83818 86dc0aadfbb518e9308c53c81582fd0e4d94c143
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend
bugs706777
milestone11.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 706777 - Automatically repopulate AddonRepository database on application upgrade. r=dtownsend
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/content/selectAddons.js
toolkit/mozapps/extensions/content/update.js
toolkit/mozapps/extensions/test/browser/Makefile.in
toolkit/mozapps/extensions/test/browser/addons/browser_bug557956_10/install.rdf
toolkit/mozapps/extensions/test/browser/addons/browser_select_compatoverrides_1/install.rdf
toolkit/mozapps/extensions/test/browser/browser_bug557956.js
toolkit/mozapps/extensions/test/browser/browser_bug557956.xml
toolkit/mozapps/extensions/test/browser/browser_select_compatoverrides.js
toolkit/mozapps/extensions/test/browser/browser_select_compatoverrides.xml
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -1304,16 +1304,20 @@ var AddonManagerPrivate = {
   notifyAddonChanged: function AMP_notifyAddonChanged(aId, aType, aPendingRestart) {
     AddonManagerInternal.notifyAddonChanged(aId, aType, aPendingRestart);
   },
 
   updateAddonAppDisabledStates: function AMP_updateAddonAppDisabledStates() {
     AddonManagerInternal.updateAddonAppDisabledStates();
   },
 
+  updateAddonRepositoryData: function AMP_updateAddonRepositoryData(aCallback) {
+    AddonManagerInternal.updateAddonRepositoryData(aCallback);
+  },
+
   callInstallListeners: function AMP_callInstallListeners(aMethod) {
     return AddonManagerInternal.callInstallListeners.apply(AddonManagerInternal,
                                                            arguments);
   },
 
   callAddonListeners: function AMP_callAddonListeners(aMethod) {
     AddonManagerInternal.callAddonListeners.apply(AddonManagerInternal, arguments);
   },
--- a/toolkit/mozapps/extensions/content/selectAddons.js
+++ b/toolkit/mozapps/extensions/content/selectAddons.js
@@ -33,16 +33,17 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 "use strict";
 
 Components.utils.import("resource://gre/modules/AddonManager.jsm");
+Components.utils.import("resource://gre/modules/AddonRepository.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 var gView = null;
 
 function showView(aView) {
@@ -119,27 +120,35 @@ var gChecking = {
         return true;
       });
 
       self._addonCount = aAddons.length;
       self._progress.value = 0;
       self._progress.max = aAddons.length;
       self._progress.mode = "determined";
 
-      aAddons.forEach(function(aAddon) {
-        // Ignore disabled themes
-        if (aAddon.type != "theme" || !aAddon.userDisabled) {
-          gAddons[aAddon.id] = {
-            addon: aAddon,
-            install: null,
-            wasActive: aAddon.isActive
-          }
-        }
+      // Ensure compatibility overrides are up to date before checking for
+      // individual addon updates.
+      let ids = [addon.id for each (addon in aAddons)];
+      AddonRepository.repopulateCache(ids, function() {
+        AddonManagerPrivate.updateAddonRepositoryData(function() {
 
-        aAddon.findUpdates(self, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+          aAddons.forEach(function(aAddon) {
+            // Ignore disabled themes
+            if (aAddon.type != "theme" || !aAddon.userDisabled) {
+              gAddons[aAddon.id] = {
+                addon: aAddon,
+                install: null,
+                wasActive: aAddon.isActive
+              }
+            }
+
+            aAddon.findUpdates(self, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+          });
+        });
       });
     });
   },
 
   onUpdateAvailable: function(aAddon, aInstall) {
     // If the add-on can be upgraded then remember the new version
     if (aAddon.permissions & AddonManager.PERM_CAN_UPGRADE)
       gAddons[aAddon.id].install = aInstall;
--- a/toolkit/mozapps/extensions/content/update.js
+++ b/toolkit/mozapps/extensions/content/update.js
@@ -40,16 +40,17 @@
 
 "use strict";
 
 const PREF_UPDATE_EXTENSIONS_ENABLED            = "extensions.update.enabled";
 const PREF_XPINSTALL_ENABLED                    = "xpinstall.enabled";
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource://gre/modules/AddonManager.jsm");
+Components.utils.import("resource://gre/modules/AddonRepository.jsm");
 
 var gUpdateWizard = {
   // When synchronizing app compatibility info this contains all installed
   // add-ons. When checking for compatible versions this contains only
   // incompatible add-ons.
   addons: [],
   // Contains a list of add-ons that were disabled prior to the application
   // upgrade.
@@ -161,19 +162,27 @@ var gVersionInfoPage = {
     // Retrieve all add-ons in order to sync their app compatibility information
     AddonManager.getAllAddons(function(aAddons) {
       gUpdateWizard.addons = aAddons.filter(function(a) {
         return a.type != "plugin";
       });
 
       gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
 
-      gUpdateWizard.addons.forEach(function(aAddon) {
-        aAddon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-      }, this);
+      // Ensure compatibility overrides are up to date before checking for
+      // individual addon updates.
+      let ids = [addon.id for each (addon in gUpdateWizard.addons)];
+      AddonRepository.repopulateCache(ids, function() {
+        AddonManagerPrivate.updateAddonRepositoryData(function() {
+
+          gUpdateWizard.addons.forEach(function(aAddon) {
+            aAddon.findUpdates(gVersionInfoPage, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+          }, this);
+        });
+      });
     });
   },
 
   onAllUpdatesFinished: function() {
     // Filter out any add-ons that were disabled before the application was
     // upgraded or are already compatible
     gUpdateWizard.addons = gUpdateWizard.addons.filter(function(a) {
       return a.appDisabled && gUpdateWizard.inactiveAddonIDs.indexOf(a.id) < 0;
--- a/toolkit/mozapps/extensions/test/browser/Makefile.in
+++ b/toolkit/mozapps/extensions/test/browser/Makefile.in
@@ -96,30 +96,33 @@ include $(DEPTH)/config/autoconf.mk
 _TEST_FILES = \
   head.js \
   browser_bug557956.js \
   browser_bug616841.js \
   browser_updatessl.js \
   browser_installssl.js \
   browser_newaddon.js \
   browser_select_selection.js \
+  browser_select_compatoverrides.js \
   browser_select_confirm.js \
   browser_select_update.js \
   $(NULL)
 
 _TEST_RESOURCES = \
   addon_about.xul \
   addon_prefs.xul \
   browser_bug557956.rdf \
   browser_bug557956_8_2.xpi \
   browser_bug557956_9_2.xpi \
+  browser_bug557956.xml \
   browser_bug591465.xml \
   browser_bug593535.xml \
   browser_searching.xml \
   browser_searching_empty.xml \
+  browser_select_compatoverrides.xml \
   browser_updatessl.rdf \
   browser_updatessl.rdf^headers^ \
   browser_install.rdf \
   browser_install.rdf^headers^ \
   browser_install.xml \
   browser_install1_3.xpi \
   browser_eula.xml \
   browser_purchase.xml \
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_bug557956_10/install.rdf
@@ -0,0 +1,23 @@
+<?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>addon10@tests.mozilla.org</em:id>
+    <em:version>1.0</em:version>
+
+    <em:targetApplication>
+      <Description>
+        <em:id>toolkit@mozilla.org</em:id>
+        <em:minVersion>0</em:minVersion>
+        <em:maxVersion>0</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+
+    <!-- Front End MetaData -->
+    <em:name>Addon10</em:name>
+    <em:bootstrap>true</em:bootstrap>
+
+  </Description>
+</RDF>
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_select_compatoverrides_1/install.rdf
@@ -0,0 +1,23 @@
+<?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>addon1@tests.mozilla.org</em:id>
+    <em:version>1.0</em:version>
+
+    <em:targetApplication>
+      <Description>
+        <em:id>toolkit@mozilla.org</em:id>
+        <em:minVersion>0</em:minVersion>
+        <em:maxVersion>0.1</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+
+    <!-- Front End MetaData -->
+    <em:name>Addon1</em:name>
+    <em:bootstrap>true</em:bootstrap>
+
+  </Description>
+</RDF>
--- a/toolkit/mozapps/extensions/test/browser/browser_bug557956.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug557956.js
@@ -2,16 +2,20 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // Test that the compatibility dialog that normally displays during startup
 // appears to work correctly.
 
 const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
 
+const PREF_GETADDONS_CACHE_ENABLED    = "extensions.getAddons.cache.enabled";
+const PREF_GETADDONS_BYIDS            = "extensions.getAddons.get.url";
+const PREF_MIN_PLATFORM_COMPAT        = "extensions.minCompatiblePlatformVersion";
+
 Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
 
 /**
  * Test add-ons:
  *
  * Addon    minVersion   maxVersion   Notes
  * addon1   0            *
  * addon2   0            0
@@ -26,16 +30,20 @@ Services.prefs.setBoolPref(PREF_STRICT_C
 
 function test() {
   requestLongerTimeout(2);
   waitForExplicitFinish();
 
   run_next_test();
 }
 
+registerCleanupFunction(function() {
+  Services.prefs.clearUserPref(PREF_GETADDONS_CACHE_ENABLED);
+});
+
 function end_test() {
   // Test generates a lot of available installs so just cancel them all
   AddonManager.getAllInstalls(function(aInstalls) {
     aInstalls.forEach(function(aInstall) {
       aInstall.cancel();
     });
 
     finish();
@@ -51,17 +59,18 @@ function install_test_addons(aCallback) 
   ["browser_bug557956_1",
    "browser_bug557956_2",
    "browser_bug557956_3",
    "browser_bug557956_4",
    "browser_bug557956_5",
    "browser_bug557956_6",
    "browser_bug557956_7",
    "browser_bug557956_8_1",
-   "browser_bug557956_9_1"].forEach(function(aName) {
+   "browser_bug557956_9_1",
+   "browser_bug557956_10"].forEach(function(aName) {
     AddonManager.getInstallForURL(TESTROOT + "addons/" + aName + ".xpi", function(aInstall) {
       installs.push(aInstall);
     }, "application/x-xpinstall");
   });
 
   var listener = {
     installCount: 0,
 
@@ -86,17 +95,18 @@ function uninstall_test_addons(aCallback
   AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org",
                                "addon5@tests.mozilla.org",
                                "addon6@tests.mozilla.org",
                                "addon7@tests.mozilla.org",
                                "addon8@tests.mozilla.org",
-                               "addon9@tests.mozilla.org"],
+                               "addon9@tests.mozilla.org",
+                               "addon10@tests.mozilla.org"],
                                function(aAddons) {
     aAddons.forEach(function(aAddon) {
       if (aAddon)
         aAddon.uninstall();
     });
     aCallback();
   });
 }
@@ -167,17 +177,18 @@ function get_list_names(aList) {
 // Tests that the right add-ons show up in the mismatch dialog and updates can
 // be installed
 add_test(function() {
   install_test_addons(function() {
     // These add-ons were inactive in the old application
     var inactiveAddonIds = [
       "addon2@tests.mozilla.org",
       "addon4@tests.mozilla.org",
-      "addon5@tests.mozilla.org"
+      "addon5@tests.mozilla.org",
+      "addon10@tests.mozilla.org"
     ];
 
     // Check that compatibility updates were applied.
     AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
                                  "addon6@tests.mozilla.org"],
                                  function([a5, a6]) {
       ok(!a5.isCompatible, "addon5 should not be compatible");
       ok(!a6.isCompatible, "addon6 should not be compatible");
@@ -255,17 +266,18 @@ add_test(function() {
 // Tests that the install failures show the install failed page and disabling
 // xpinstall shows the right UI.
 add_test(function() {
   install_test_addons(function() {
     // These add-ons were inactive in the old application
     var inactiveAddonIds = [
       "addon2@tests.mozilla.org",
       "addon4@tests.mozilla.org",
-      "addon5@tests.mozilla.org"
+      "addon5@tests.mozilla.org",
+      "addon10@tests.mozilla.org"
     ];
 
     Services.prefs.setBoolPref("xpinstall.enabled", false);
 
     open_compatibility_window(inactiveAddonIds, function(aWindow) {
       var doc = aWindow.document;
       wait_for_page(aWindow, "mismatch", function(aWindow) {
         var items = get_list_names(doc.getElementById("mismatch.incompatible"));
@@ -338,33 +350,35 @@ add_test(function() {
     AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                  "addon2@tests.mozilla.org",
                                  "addon3@tests.mozilla.org",
                                  "addon4@tests.mozilla.org",
                                  "addon5@tests.mozilla.org",
                                  "addon6@tests.mozilla.org",
                                  "addon7@tests.mozilla.org",
                                  "addon8@tests.mozilla.org",
-                                 "addon9@tests.mozilla.org"],
+                                 "addon9@tests.mozilla.org",
+                                 "addon10@tests.mozilla.org"],
                                  function(aAddons) {
       aAddons.forEach(function(aAddon) {
         aAddon.userDisabled = true;
       });
 
       // These add-ons were inactive in the old application
       var inactiveAddonIds = [
         "addon1@tests.mozilla.org",
         "addon2@tests.mozilla.org",
         "addon3@tests.mozilla.org",
         "addon4@tests.mozilla.org",
         "addon5@tests.mozilla.org",
         "addon6@tests.mozilla.org",
         "addon7@tests.mozilla.org",
         "addon8@tests.mozilla.org",
-        "addon9@tests.mozilla.org"
+        "addon9@tests.mozilla.org",
+        "addon10@tests.mozilla.org"
       ];
 
       open_compatibility_window(inactiveAddonIds, function(aWindow) {
         // Should close immediately on its own
         wait_for_window_close(aWindow, function() {
           uninstall_test_addons(run_next_test);
         });
       });
@@ -372,17 +386,18 @@ add_test(function() {
   });
 });
 
 // Tests that the right UI shows for when no updates are available
 add_test(function() {
   install_test_addons(function() {
     AddonManager.getAddonsByIDs(["addon7@tests.mozilla.org",
                                  "addon8@tests.mozilla.org",
-                                 "addon9@tests.mozilla.org"],
+                                 "addon9@tests.mozilla.org",
+                                 "addon10@tests.mozilla.org"],
                                  function(aAddons) {
       aAddons.forEach(function(aAddon) {
         aAddon.uninstall();
       });
 
       // These add-ons were inactive in the old application
       var inactiveAddonIds = [
         "addon2@tests.mozilla.org",
@@ -411,8 +426,68 @@ add_test(function() {
 
             EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
           });
         });
       });
     });
   });
 });
+
+// Tests that compatibility overrides are retreived and affect addon
+// compatibility.
+add_test(function() {
+  Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
+  Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
+  is(AddonManager.strictCompatibility, false, "Strict compatibility should be disabled");
+
+  // Use a blank update URL
+  Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
+
+  install_test_addons(function() {
+
+    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                                 "addon2@tests.mozilla.org",
+                                 "addon3@tests.mozilla.org",
+                                 "addon4@tests.mozilla.org",
+                                 "addon5@tests.mozilla.org",
+                                 "addon6@tests.mozilla.org",
+                                 "addon7@tests.mozilla.org",
+                                 "addon8@tests.mozilla.org",
+                                 "addon9@tests.mozilla.org",
+                                 "addon10@tests.mozilla.org"],
+                                 function(aAddons) {
+      aAddons.forEach(function(aAddon) {
+        if (aAddon.id == "addon10@tests.mozilla.org")
+          is(aAddon.isCompatible, true, "Addon10 should be compatible before compat overrides are refreshed");
+        else
+          aAddon.uninstall();
+      });
+
+      Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, TESTROOT + "browser_bug557956.xml");
+      Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
+
+      open_compatibility_window([], function(aWindow) {
+        var doc = aWindow.document;
+        wait_for_page(aWindow, "mismatch", function(aWindow) {
+          var items = get_list_names(doc.getElementById("mismatch.incompatible"));
+          is(items.length, 1, "Should have seen 1 incompatible item");
+          is(items[0], "Addon10 1.0", "Should have seen addon10 as incompatible");
+
+          var button = doc.documentElement.getButton("next");
+          EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
+
+          wait_for_page(aWindow, "noupdates", function(aWindow) {
+            var button = doc.documentElement.getButton("finish");
+            ok(!button.hidden, "Finish button should not be hidden");
+            ok(!button.disabled, "Finish button should not be disabled");
+
+            wait_for_window_close(aWindow, function() {
+              uninstall_test_addons(run_next_test);
+            });
+
+            EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
+          });
+        });
+      });
+    });
+  });
+});
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug557956.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<searchresults total_results="1">
+  <addon_compatibility hosted="false">
+    <guid>addon10@tests.mozilla.org</guid>
+    <name>Addon10</name>
+    <version_ranges>
+      <version_range type="incompatible">
+        <min_version>1.0</min_version>
+        <max_version>2.0</max_version>
+        <compatible_applications>
+          <application>
+            <min_version>0.1</min_version>
+            <max_version>999.0</max_version>
+            <appID>toolkit@mozilla.org</appID>
+          </application>
+        </compatible_applications>
+      </version_range>
+    </version_ranges>
+  </addon_compatibility>
+</searchresults>
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_select_compatoverrides.js
@@ -0,0 +1,118 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+// Tests that compatibility overrides are refreshed when showing the addon
+// selection UI.
+
+const PREF_GETADDONS_CACHE_ENABLED    = "extensions.getAddons.cache.enabled";
+const PREF_GETADDONS_BYIDS            = "extensions.getAddons.get.url";
+const PREF_MIN_PLATFORM_COMPAT        = "extensions.minCompatiblePlatformVersion";
+
+var gTestAddon = null;
+
+function waitForView(aView, aCallback) {
+  var view = gWin.document.getElementById(aView);
+  if (view.parentNode.selectedPanel == view) {
+    aCallback();
+    return;
+  }
+
+  view.addEventListener("ViewChanged", function() {
+    view.removeEventListener("ViewChanged", arguments.callee, false);
+    aCallback();
+  }, false);
+}
+
+function install_test_addon(aCallback) {
+  AddonManager.getInstallForURL(TESTROOT + "addons/browser_select_compatoverrides_1.xpi", function(aInstall) {
+    var listener = {
+      onInstallEnded: function() {
+        AddonManager.getAddonByID("addon1@tests.mozilla.org", function(addon) {
+          gTestAddon = addon;
+          aCallback();
+        });
+      }
+    };
+    aInstall.addListener(listener);
+    aInstall.install();
+  }, "application/x-xpinstall");
+}
+
+registerCleanupFunction(function() {
+  if (gWin)
+    gWin.close();
+  if (gTestAddon)
+    gTestAddon.uninstall();
+
+  Services.prefs.clearUserPref(PREF_GETADDONS_CACHE_ENABLED);
+  Services.prefs.clearUserPref(PREF_GETADDONS_BYIDS);
+  Services.prefs.clearUserPref(PREF_MIN_PLATFORM_COMPAT);
+});
+
+function end_test() {
+  finish();
+}
+
+
+function test() {
+  waitForExplicitFinish();
+  Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
+  Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
+  Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
+
+  install_test_addon(run_next_test);
+}
+
+add_test(function() {
+  gWin = Services.ww.openWindow(null,
+                              "chrome://mozapps/content/extensions/selectAddons.xul",
+                              "",
+                              "chrome,centerscreen,dialog,titlebar",
+                              null);
+  waitForFocus(function() {
+    waitForView("select", run_next_test);
+  }, gWin);
+});
+
+add_test(function() {
+  for (var row = gWin.document.getElementById("select-rows").firstChild; row; row = row.nextSibling) {
+    if (row.localName == "separator")
+      continue;
+    if (row.id.substr(-18) != "@tests.mozilla.org")
+      continue;
+
+    is(row.id, "addon1@tests.mozilla.org", "Should get expected addon");
+    isnot(row.action, "incompatible", "Addon should not be incompatible");
+
+    gWin.close();
+    gWin = null;
+    run_next_test();
+  }
+});
+
+add_test(function() {
+  Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, TESTROOT + "browser_select_compatoverrides.xml");
+  Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
+
+  gWin = Services.ww.openWindow(null,
+                              "chrome://mozapps/content/extensions/selectAddons.xul",
+                              "",
+                              "chrome,centerscreen,dialog,titlebar",
+                              null);
+  waitForFocus(function() {
+    waitForView("select", run_next_test);
+  }, gWin);
+});
+
+add_test(function() {
+  for (var row = gWin.document.getElementById("select-rows").firstChild; row; row = row.nextSibling) {
+    if (row.localName == "separator")
+      continue;
+    if (row.id.substr(-18) != "@tests.mozilla.org")
+      continue;
+    is(row.id, "addon1@tests.mozilla.org", "Should get expected addon");
+    is(row.action, "incompatible", "Addon should be incompatible");
+    run_next_test();
+  }
+});
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_select_compatoverrides.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<searchresults total_results="1">
+  <addon_compatibility hosted="false">
+    <guid>addon1@tests.mozilla.org</guid>
+    <name>Addon1</name>
+    <version_ranges>
+      <version_range type="incompatible">
+        <min_version>1.0</min_version>
+        <max_version>2.0</max_version>
+        <compatible_applications>
+          <application>
+            <min_version>0.1</min_version>
+            <max_version>999.0</max_version>
+            <appID>toolkit@mozilla.org</appID>
+          </application>
+        </compatible_applications>
+      </version_range>
+    </version_ranges>
+  </addon_compatibility>
+</searchresults>