Bug 1446868: Part 2 - Convert remaining update.rdf tests to JSON format. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Sun, 18 Mar 2018 22:21:46 -0700
changeset 462706 e0821b952a013e2fe551cb2a87973effe13167f7
parent 462705 48834182306edfb64a5e28d94ea83867780be32f
child 462707 885915481ec51089613bf2f36985bcd77b17e08a
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1446868
milestone61.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 1446868: Part 2 - Convert remaining update.rdf tests to JSON format. r=aswan MozReview-Commit-ID: 4ZIMdrvP5pJ
toolkit/components/extensions/test/xpcshell/test_ext_privacy_update.js
toolkit/mozapps/extensions/test/browser/browser.ini
toolkit/mozapps/extensions/test/browser/browser_install.rdf
toolkit/mozapps/extensions/test/browser/browser_updatessl.js
toolkit/mozapps/extensions/test/browser/browser_updatessl.json
toolkit/mozapps/extensions/test/browser/browser_updatessl.json^headers^
toolkit/mozapps/extensions/test/browser/browser_updatessl.rdf
toolkit/mozapps/extensions/test/browser/browser_updatessl.rdf^headers^
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.json
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.rdf
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.json
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.rdf
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.json
toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.json
toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.json
toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.json
toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete_legacy.json
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer_legacy.json
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore_legacy.json
toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.json
toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.json
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.json
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.rdf
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.json
toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.rdf
toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
toolkit/mozapps/extensions/test/xpcshell/test_badschema.js
toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js
toolkit/mozapps/extensions/test/xpcshell/test_bug559800.js
toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js
toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
toolkit/mozapps/extensions/test/xpcshell/test_corrupt_strictcompat.js
toolkit/mozapps/extensions/test/xpcshell/test_delay_update.js
toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
toolkit/mozapps/extensions/test/xpcshell/test_locked.js
toolkit/mozapps/extensions/test/xpcshell/test_locked_strictcompat.js
toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
toolkit/mozapps/extensions/test/xpcshell/test_update.js
toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_privacy_update.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_privacy_update.js
@@ -21,17 +21,17 @@ const {
   promiseStartupManager,
 } = AddonTestUtils;
 
 AddonTestUtils.init(this);
 
 // Allow for unsigned addons.
 AddonTestUtils.overrideCertDB();
 
-createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
+createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "42", "42");
 
 add_task(async function test_privacy_update() {
   // Create a object to hold the values to which we will initialize the prefs.
   const PREFS = {
     "network.predictor.enabled": true,
     "network.prefetch-next": true,
     "network.http.speculative-parallel-limit": 10,
     "network.dns.disablePrefetch": false,
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -10,18 +10,18 @@ support-files =
   head.js
   more_options.xul
   options.xul
   plugin_test.html
   redirect.sjs
   releaseNotes.xhtml
   blockNoPlugins.xml
   blockPluginHard.xml
-  browser_updatessl.rdf
-  browser_updatessl.rdf^headers^
+  browser_updatessl.json
+  browser_updatessl.json^headers^
   browser_install.rdf
   browser_install.rdf^headers^
   browser_install1_3.xpi
   webapi_addon_listener.html
   webapi_checkavailable.html
   webapi_checkchromeframe.xul
   webapi_checkframed.html
   webapi_checknavigatedwindow.html
--- a/toolkit/mozapps/extensions/test/browser/browser_install.rdf
+++ b/toolkit/mozapps/extensions/test/browser/browser_install.rdf
@@ -1,27 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:install1@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>https://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_install1_3.xpi</em:updateLink>
-                <em:updateHash>sha1:4f0f4391914e3e036beca50cbac33958e5269643</em:updateHash>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
-</RDF>
+{
+  "addons": {
+    "install1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2.0",
+          "update_link": "https://example.com/browser/toolkit/mozapps/extensions/test/browser/browser_install1_3.xpi",
+          "update_hash": "sha1:4f0f4391914e3e036beca50cbac33958e5269643"
+        }
+      ]
+    }
+  }
+}
--- a/toolkit/mozapps/extensions/test/browser/browser_updatessl.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_updatessl.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 var tempScope = {};
 ChromeUtils.import("resource://gre/modules/addons/AddonUpdateChecker.jsm", tempScope);
 var AddonUpdateChecker = tempScope.AddonUpdateChecker;
 
-const updaterdf = RELATIVE_DIR + "browser_updatessl.rdf";
+const updatejson = RELATIVE_DIR + "browser_updatessl.json";
 const redirect = RELATIVE_DIR + "redirect.sjs?";
 const SUCCESS = 0;
 const DOWNLOAD_ERROR = AddonManager.ERROR_DOWNLOAD_ERROR;
 
 const HTTP = "http://example.com/";
 const HTTPS = "https://example.com/";
 const NOCERT = "https://nocert.example.com/";
 const SELFSIGNED = "https://self-signed.example.com/";
@@ -73,21 +73,21 @@ function run_update_tests(callback) {
     if (gTests.length == 0) {
       callback();
       return;
     }
     gLast = Date.now();
 
     let [mainURL, redirectURL, expectedStatus] = gTests.shift();
     if (redirectURL) {
-      var url = mainURL + redirect + redirectURL + updaterdf;
+      var url = mainURL + redirect + redirectURL + updatejson;
       var message = "Should have seen the right result for an update check redirected from " +
                     mainURL + " to " + redirectURL;
     } else {
-      url = mainURL + updaterdf;
+      url = mainURL + updatejson;
       message = "Should have seen the right result for an update check from " +
                 mainURL;
     }
 
     AddonUpdateChecker.checkForUpdates("addon1@tests.mozilla.org", url, {
       onUpdateCheckComplete(updates) {
         is(updates.length, 1, "Should be the right number of results");
         is(SUCCESS, expectedStatus, message);
@@ -111,17 +111,17 @@ function addCertOverrides() {
   addCertOverride("nocert.example.com", Ci.nsICertOverrideService.ERROR_MISMATCH);
   addCertOverride("self-signed.example.com", Ci.nsICertOverrideService.ERROR_UNTRUSTED);
   addCertOverride("untrusted.example.com", Ci.nsICertOverrideService.ERROR_UNTRUSTED);
   addCertOverride("expired.example.com", Ci.nsICertOverrideService.ERROR_TIME);
 }
 
 // Runs tests with built-in certificates required and no certificate exceptions.
 add_test(function() {
-  // Tests that a simple update.rdf retrieval works as expected.
+  // Tests that a simple update.json retrieval works as expected.
   add_update_test(HTTP, null, SUCCESS);
   add_update_test(HTTPS, null, DOWNLOAD_ERROR);
   add_update_test(NOCERT, null, DOWNLOAD_ERROR);
   add_update_test(SELFSIGNED, null, DOWNLOAD_ERROR);
   add_update_test(UNTRUSTED, null, DOWNLOAD_ERROR);
   add_update_test(EXPIRED, null, DOWNLOAD_ERROR);
 
   // Tests that redirecting from http to other servers works as expected
@@ -175,17 +175,17 @@ add_test(function() {
   run_update_tests(run_next_test);
 });
 
 // Runs tests without requiring built-in certificates and no certificate
 // exceptions.
 add_test(function() {
   Services.prefs.setBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, false);
 
-  // Tests that a simple update.rdf retrieval works as expected.
+  // Tests that a simple update.json retrieval works as expected.
   add_update_test(HTTP, null, SUCCESS);
   add_update_test(HTTPS, null, SUCCESS);
   add_update_test(NOCERT, null, DOWNLOAD_ERROR);
   add_update_test(SELFSIGNED, null, DOWNLOAD_ERROR);
   add_update_test(UNTRUSTED, null, DOWNLOAD_ERROR);
   add_update_test(EXPIRED, null, DOWNLOAD_ERROR);
 
   // Tests that redirecting from http to other servers works as expected
@@ -239,17 +239,17 @@ add_test(function() {
   run_update_tests(run_next_test);
 });
 
 // Runs tests with built-in certificates required and all certificate exceptions.
 add_test(function() {
   Services.prefs.clearUserPref(PREF_UPDATE_REQUIREBUILTINCERTS);
   addCertOverrides();
 
-  // Tests that a simple update.rdf retrieval works as expected.
+  // Tests that a simple update.json retrieval works as expected.
   add_update_test(HTTP, null, SUCCESS);
   add_update_test(HTTPS, null, DOWNLOAD_ERROR);
   add_update_test(NOCERT, null, DOWNLOAD_ERROR);
   add_update_test(SELFSIGNED, null, DOWNLOAD_ERROR);
   add_update_test(UNTRUSTED, null, DOWNLOAD_ERROR);
   add_update_test(EXPIRED, null, DOWNLOAD_ERROR);
 
   // Tests that redirecting from http to other servers works as expected
@@ -303,17 +303,17 @@ add_test(function() {
   run_update_tests(run_next_test);
 });
 
 // Runs tests without requiring built-in certificates and all certificate
 // exceptions.
 add_test(function() {
   Services.prefs.setBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, false);
 
-  // Tests that a simple update.rdf retrieval works as expected.
+  // Tests that a simple update.json retrieval works as expected.
   add_update_test(HTTP, null, SUCCESS);
   add_update_test(HTTPS, null, SUCCESS);
   add_update_test(NOCERT, null, SUCCESS);
   add_update_test(SELFSIGNED, null, SUCCESS);
   add_update_test(UNTRUSTED, null, SUCCESS);
   add_update_test(EXPIRED, null, SUCCESS);
 
   // Tests that redirecting from http to other servers works as expected
rename from toolkit/mozapps/extensions/test/browser/browser_updatessl.rdf
rename to toolkit/mozapps/extensions/test/browser/browser_updatessl.json
--- a/toolkit/mozapps/extensions/test/browser/browser_updatessl.rdf
+++ b/toolkit/mozapps/extensions/test/browser/browser_updatessl.json
@@ -1,25 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:addon1@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>20</em:maxVersion>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
-</RDF>
+{
+  "addons": {
+    "addon1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "20"
+            }
+          },
+          "version": "2.0"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/browser/browser_updatessl.rdf^headers^
rename to toolkit/mozapps/extensions/test/browser/browser_updatessl.json^headers^
rename from toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update1.json
@@ -1,144 +1,102 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-  <RDF:Description about="urn:mozilla:extension:softblock1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft1_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock2@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft2_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock3@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft3_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock4@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft4_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:theme:softblock5@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft5_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:hardblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_hard1_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:regexpblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_regexp1_2.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-</RDF:RDF>
+{
+  "addons": {
+    "softblock1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft1_2.xpi"
+        }
+      ]
+    },
+    "softblock3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft3_2.xpi"
+        }
+      ]
+    },
+    "softblock5@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft5_2.xpi"
+        }
+      ]
+    },
+    "softblock4@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft4_2.xpi"
+        }
+      ]
+    },
+    "softblock2@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft2_2.xpi"
+        }
+      ]
+    },
+    "regexpblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_regexp1_2.xpi"
+        }
+      ]
+    },
+    "hardblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_hard1_2.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update2.json
@@ -1,144 +1,102 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-  <RDF:Description about="urn:mozilla:extension:softblock1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft1_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock2@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft2_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock3@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft3_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock4@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft4_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:theme:softblock5@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft5_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:hardblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_hard1_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:regexpblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>3</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_regexp1_3.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-</RDF:RDF>
+{
+  "addons": {
+    "softblock1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft1_3.xpi"
+        }
+      ]
+    },
+    "softblock3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft3_3.xpi"
+        }
+      ]
+    },
+    "regexpblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_regexp1_3.xpi"
+        }
+      ]
+    },
+    "hardblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_hard1_3.xpi"
+        }
+      ]
+    },
+    "softblock5@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft5_3.xpi"
+        }
+      ]
+    },
+    "softblock4@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft4_3.xpi"
+        }
+      ]
+    },
+    "softblock2@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "3",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft2_3.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/blocklistchange/addon_update3.json
@@ -1,144 +1,102 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-  <RDF:Description about="urn:mozilla:extension:softblock1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft1_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock2@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft2_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock3@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft3_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:softblock4@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft4_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:theme:softblock5@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_soft5_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:hardblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_hard1_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:regexpblock@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>4</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>0</em:minVersion>
-                <em:maxVersion>*</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/blocklist_regexp1_1.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-</RDF:RDF>
+{
+  "addons": {
+    "regexpblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_regexp1_1.xpi"
+        }
+      ]
+    },
+    "hardblock@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_hard1_1.xpi"
+        }
+      ]
+    },
+    "softblock5@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft5_1.xpi"
+        }
+      ]
+    },
+    "softblock4@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft4_1.xpi"
+        }
+      ]
+    },
+    "softblock3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft3_1.xpi"
+        }
+      ]
+    },
+    "softblock2@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft2_1.xpi"
+        }
+      ]
+    },
+    "softblock1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "0",
+              "advisory_max_version": "*"
+            }
+          },
+          "version": "4",
+          "update_link": "http://localhost:%PORT%/addons/blocklist_soft1_1.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_backgroundupdate.json
@@ -1,70 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:addon1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <!-- app id compatible update available -->
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:addon2@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <!-- app id compatible update available -->
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-  <RDF:Description about="urn:mozilla:extension:addon3@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <!-- app id compatible update available -->
-        <RDF:li>
-          <RDF:Description>
-            <em:version>2</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
-
+{
+  "addons": {
+    "addon2@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    },
+    "addon3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    },
+    "addon1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_1.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:test_bug470377_1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>unknown@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
+{
+  "addons": {
+    "test_bug470377_1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "unknown@tests.mozilla.org": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "1",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_2.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:test_bug470377_2@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
+{
+  "addons": {
+    "test_bug470377_2@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "1",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_3.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:test_bug470377_3@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
+{
+  "addons": {
+    "test_bug470377_3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "1",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_4.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:test_bug470377_4@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>toolkit@mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
+{
+  "addons": {
+    "test_bug470377_4@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "1",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug470377/update_5.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:test_bug470377_5@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>3</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/broken.xpi</em:updateLink>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
+{
+  "addons": {
+    "test_bug470377_5@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "3"
+            }
+          },
+          "version": "1",
+          "update_link": "http://localhost:%PORT%/broken.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.json
@@ -1,26 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <RDF:Description about="urn:mozilla:extension:addon1@tests.mozilla.org">
-    <em:updates>
-      <RDF:Seq>
-        <RDF:li>
-          <RDF:Description>
-            <em:version>1</em:version>
-            <em:targetApplication>
-              <RDF:Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-              </RDF:Description>
-            </em:targetApplication>
-          </RDF:Description>
-        </RDF:li>
-      </RDF:Seq>
-    </em:updates>
-  </RDF:Description>
-
-</RDF:RDF>
-
+{
+  "addons": {
+    "addon1@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "1"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_corrupt.json
@@ -1,44 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:addon3@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>1.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
-  <Description about="urn:mozilla:extension:addon4@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>1.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
-</RDF>
+{
+  "addons": {
+    "addon3@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "1.0"
+        }
+      ]
+    },
+    "addon4@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "1.0"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete_legacy.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_complete_legacy.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:test_delay_update_complete@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <!-- app id compatible update available -->
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_delay_update_complete_v2.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "test_delay_update_complete@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_delay_update_complete_v2.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer_legacy.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_defer_legacy.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:test_delay_update_defer@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <!-- app id compatible update available -->
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_delay_update_defer_v2.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "test_delay_update_defer@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_delay_update_defer_v2.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore_legacy.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_updates_ignore_legacy.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:test_delay_update_ignore@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <!-- app id compatible update available -->
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_delay_update_ignore_v2.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "test_delay_update_ignore@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_delay_update_ignore_v2.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_dictionary.json
@@ -1,65 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<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:extension:ab-CD@dictionaries.addons.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_dictionary_3.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
- <Description about="urn:mozilla:extension:ef@dictionaries.addons.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_dictionary_4.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-
- <Description about="urn:mozilla:extension:gh@dictionaries.addons.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>1</em:maxVersion>
-                <em:updateLink>http://localhost:%PORT%/addons/test_dictionary_5.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "ab-CD@dictionaries.addons.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_dictionary_3.xpi"
+        }
+      ]
+    },
+    "gh@dictionaries.addons.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_dictionary_5.xpi"
+        }
+      ]
+    },
+    "ef@dictionaries.addons.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "1"
+            }
+          },
+          "version": "2.0",
+          "update_link": "http://localhost:%PORT%/addons/test_dictionary_4.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_ignore.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <Description about="urn:mozilla:extension:compatmode-ignore@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-                <em:updateLink>https://localhost:%PORT%/addons/test1.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "compatmode-ignore@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "2.0",
+          "update_link": "https://localhost:%PORT%/addons/test1.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_normal.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <Description about="urn:mozilla:extension:compatmode-normal@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-                <em:updateLink>https://localhost:%PORT%/addons/test1.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "compatmode-normal@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "2.0",
+          "update_link": "https://localhost:%PORT%/addons/test1.xpi"
+        }
+      ]
+    }
+  }
+}
rename from toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.rdf
rename to toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.json
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.rdf
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_updatecompatmode_strict.json
@@ -1,26 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <Description about="urn:mozilla:extension:compatmode-strict@tests.mozilla.org">
-    <em:updates>
-      <Seq>
-        <li>
-          <Description>
-            <em:version>2.0</em:version>
-            <em:targetApplication>
-              <Description>
-                <em:id>xpcshell@tests.mozilla.org</em:id>
-                <em:minVersion>1</em:minVersion>
-                <em:maxVersion>2</em:maxVersion>
-                <em:updateLink>https://localhost:%PORT%/addons/test1.xpi</em:updateLink>
-              </Description>
-            </em:targetApplication>
-          </Description>
-        </li>
-      </Seq>
-    </em:updates>
-  </Description>
-</RDF>
+{
+  "addons": {
+    "compatmode-strict@tests.mozilla.org": {
+      "updates": [
+        {
+          "applications": {
+            "gecko": {
+              "strict_min_version": "1",
+              "advisory_max_version": "2"
+            }
+          },
+          "version": "2.0",
+          "update_link": "https://localhost:%PORT%/addons/test1.xpi"
+        }
+      ]
+    }
+  }
+}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
@@ -10,17 +10,17 @@ Services.prefs.setBoolPref(PREF_EM_CHECK
 ChromeUtils.import("resource://testing-common/httpd.js");
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 // register static files with server and interpolate port numbers in them
-mapFile("/data/test_backgroundupdate.rdf", testserver);
+mapFile("/data/test_backgroundupdate.json", testserver);
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   testserver.registerDirectory("/addons/", do_get_file("addons"));
 
   startupManager();
 
@@ -50,29 +50,29 @@ function run_test_1() {
 }
 
 // Verify that with two add-ons installed both of which claim to have updates
 // available we get the notification after both updates attempted to start
 function run_test_2() {
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_backgroundupdate.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_backgroundupdate.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon 1",
   }, profileDir);
 
   writeInstallRDFForExtension({
     id: "addon2@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_backgroundupdate.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_backgroundupdate.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon 2",
   }, profileDir);
 
@@ -87,17 +87,17 @@ function run_test_2() {
     name: "Test Addon 3",
   }, profileDir);
 
   // Disable rcwn to make cache behavior deterministic.
   Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
 
   // Background update uses a different pref, if set
   Services.prefs.setCharPref("extensions.update.background.url",
-                             "http://localhost:" + gPort + "/data/test_backgroundupdate.rdf");
+                             "http://localhost:" + gPort + "/data/test_backgroundupdate.json");
 
   restartManager();
 
   let installCount = 0;
   let completeCount = 0;
   let sawCompleteNotification = false;
 
   Services.obs.addObserver(function observer() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_badschema.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_badschema.js
@@ -6,17 +6,17 @@
 
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
 // register static files with server and interpolate port numbers in them
-mapFile("/data/test_corrupt.rdf", testserver);
+mapFile("/data/test_corrupt.json", testserver);
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
 
 // Will be enabled
 var addon1 = {
   id: "addon1@tests.mozilla.org",
   version: "1.0",
@@ -40,30 +40,30 @@ var addon2 = {
   }]
 };
 
 // Will get a compatibility update and be enabled
 var addon3 = {
   id: "addon3@tests.mozilla.org",
   version: "1.0",
   name: "Test 3",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Will get a compatibility update and be disabled
 var addon4 = {
   id: "addon4@tests.mozilla.org",
   version: "1.0",
   name: "Test 4",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Stays incompatible
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
@@ -30,237 +30,237 @@ ChromeUtils.import("resource://testing-c
 
 // Allow insecure updates
 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
 
 var testserver = createHttpServer();
 gPort = testserver.identity.primaryPort;
 
 // register static files with server and interpolate port numbers in them
-mapFile("/data/blocklistchange/addon_update1.rdf", testserver);
-mapFile("/data/blocklistchange/addon_update2.rdf", testserver);
-mapFile("/data/blocklistchange/addon_update3.rdf", testserver);
+mapFile("/data/blocklistchange/addon_update1.json", testserver);
+mapFile("/data/blocklistchange/addon_update2.json", testserver);
+mapFile("/data/blocklistchange/addon_update3.json", testserver);
 mapFile("/data/blocklistchange/addon_change.xml", testserver);
 mapFile("/data/blocklistchange/app_update.xml", testserver);
 mapFile("/data/blocklistchange/blocklist_update1.xml", testserver);
 mapFile("/data/blocklistchange/blocklist_update2.xml", testserver);
 mapFile("/data/blocklistchange/manual_update.xml", testserver);
 
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 
 var softblock1_1 = {
   id: "softblock1@tests.mozilla.org",
   version: "1.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock1_2 = {
   id: "softblock1@tests.mozilla.org",
   version: "2.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock1_3 = {
   id: "softblock1@tests.mozilla.org",
   version: "3.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock2_1 = {
   id: "softblock2@tests.mozilla.org",
   version: "1.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock2_2 = {
   id: "softblock2@tests.mozilla.org",
   version: "2.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock2_3 = {
   id: "softblock2@tests.mozilla.org",
   version: "3.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock3_1 = {
   id: "softblock3@tests.mozilla.org",
   version: "1.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock3_2 = {
   id: "softblock3@tests.mozilla.org",
   version: "2.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock3_3 = {
   id: "softblock3@tests.mozilla.org",
   version: "3.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock4_1 = {
   id: "softblock4@tests.mozilla.org",
   version: "1.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock4_2 = {
   id: "softblock4@tests.mozilla.org",
   version: "2.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var softblock4_3 = {
   id: "softblock4@tests.mozilla.org",
   version: "3.0",
   name: "Softblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var hardblock_1 = {
   id: "hardblock@tests.mozilla.org",
   version: "1.0",
   name: "Hardblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var hardblock_2 = {
   id: "hardblock@tests.mozilla.org",
   version: "2.0",
   name: "Hardblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var hardblock_3 = {
   id: "hardblock@tests.mozilla.org",
   version: "3.0",
   name: "Hardblocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var regexpblock_1 = {
   id: "regexpblock@tests.mozilla.org",
   version: "1.0",
   name: "RegExp-blocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update1.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var regexpblock_2 = {
   id: "regexpblock@tests.mozilla.org",
   version: "2.0",
   name: "RegExp-blocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update2.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 var regexpblock_3 = {
   id: "regexpblock@tests.mozilla.org",
   version: "3.0",
   name: "RegExp-blocked add-on",
-  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/blocklistchange/addon_update3.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "3"
   }]
 };
 
 const ADDON_IDS = ["softblock1@tests.mozilla.org",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js
@@ -2,17 +2,17 @@ const CLASS_ID = Components.ID("{1234567
 const CONTRACT_ID = "@mozilla.org/test-parameter-source;1";
 
 // Get and create the HTTP server.
 ChromeUtils.import("resource://testing-common/httpd.js");
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
-var gTestURL = "http://127.0.0.1:" + gPort + "/update.rdf?itemID=%ITEM_ID%&custom1=%CUSTOM1%&custom2=%CUSTOM2%";
+var gTestURL = "http://127.0.0.1:" + gPort + "/update.json?itemID=%ITEM_ID%&custom1=%CUSTOM1%&custom2=%CUSTOM2%";
 var gExpectedQuery = "itemID=test@mozilla.org&custom1=custom_parameter_1&custom2=custom_parameter_2";
 var gSeenExpectedURL = false;
 
 var gComponentRegistrar = Components.manager.QueryInterface(AM_Ci.nsIComponentRegistrar);
 var gCategoryManager = AM_Cc["@mozilla.org/categorymanager;1"].getService(AM_Ci.nsICategoryManager);
 
 // Factory for our parameter handler
 var paramHandlerFactory = {
@@ -33,17 +33,17 @@ var paramHandlerFactory = {
 };
 
 function initTest() {
   do_test_pending();
   // Setup extension manager
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
 
   // Configure the HTTP server.
-  testserver.registerPathHandler("/update.rdf", function(aRequest, aResponse) {
+  testserver.registerPathHandler("/update.json", function(aRequest, aResponse) {
     gSeenExpectedURL = aRequest.queryString == gExpectedQuery;
     aResponse.setStatusLine(null, 404, "Not Found");
   });
 
   // Register our parameter handlers
   gComponentRegistrar.registerFactory(CLASS_ID, "Test component", CONTRACT_ID, paramHandlerFactory);
   gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM1", CONTRACT_ID, false, false);
   gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM2", CONTRACT_ID, false, false);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug559800.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug559800.js
@@ -15,17 +15,17 @@ gServer.start(-1);
 gPort = gServer.identity.primaryPort;
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_update.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_update.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon 1",
   }, profileDir);
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js
@@ -12,17 +12,17 @@ Services.prefs.setIntPref("extensions.en
                           AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER);
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2");
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_bug655254.rdf", testserver);
+mapFile("/data/test_bug655254.json", testserver);
 
 var userDir = gProfD.clone();
 userDir.append("extensions2");
 userDir.append(gAppInfo.ID);
 
 var dirProvider = {
   getFile(aProp, aPersistent) {
     aPersistent.value = false;
@@ -35,17 +35,17 @@ var dirProvider = {
                                          AM_Ci.nsISupports])
 };
 Services.dirsvc.registerProvider(dirProvider);
 
 var addon1 = {
   id: "addon1@tests.mozilla.org",
   version: "1.0",
   name: "Test 1",
-  updateURL: "http://localhost:" + gPort + "/data/test_bug655254.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_bug655254.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Set up the profile
--- a/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_corrupt.js
@@ -8,17 +8,17 @@
 ChromeUtils.import("resource://testing-common/httpd.js");
 // Create and configure the HTTP server.
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
 // register files with server
 testserver.registerDirectory("/addons/", do_get_file("addons"));
-mapFile("/data/test_corrupt.rdf", testserver);
+mapFile("/data/test_corrupt.json", testserver);
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
 
 // Will be enabled
 var addon1 = {
   id: "addon1@tests.mozilla.org",
@@ -43,30 +43,30 @@ var addon2 = {
   }]
 };
 
 // Will get a compatibility update and stay enabled
 var addon3 = {
   id: "addon3@tests.mozilla.org",
   version: "1.0",
   name: "Test 3",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Will get a compatibility update and be enabled
 var addon4 = {
   id: "addon4@tests.mozilla.org",
   version: "1.0",
   name: "Test 4",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Would stay incompatible with strict compat
--- a/toolkit/mozapps/extensions/test/xpcshell/test_corrupt_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_corrupt_strictcompat.js
@@ -8,17 +8,17 @@
 ChromeUtils.import("resource://testing-common/httpd.js");
 // Create and configure the HTTP server.
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
 // register files with server
 testserver.registerDirectory("/addons/", do_get_file("addons"));
-mapFile("/data/test_corrupt.rdf", testserver);
+mapFile("/data/test_corrupt.json", testserver);
 
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
 
 // Will be enabled
 var addon1 = {
@@ -44,30 +44,30 @@ var addon2 = {
   }]
 };
 
 // Will get a compatibility update and be enabled
 var addon3 = {
   id: "addon3@tests.mozilla.org",
   version: "1.0",
   name: "Test 3",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Will get a compatibility update and be disabled
 var addon4 = {
   id: "addon4@tests.mozilla.org",
   version: "1.0",
   name: "Test 4",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Stays incompatible
--- a/toolkit/mozapps/extensions/test/xpcshell/test_delay_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_delay_update.js
@@ -21,28 +21,28 @@ const TEST_IGNORE_PREF = "delaytest.igno
 // the objects in `data` to be serializable, and we need a real reference to the
 // `instanceID` symbol to test.
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
 
 // Create and configure the HTTP server.
 let testserver = createHttpServer();
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_delay_updates_complete.rdf", testserver);
-mapFile("/data/test_delay_updates_ignore.rdf", testserver);
-mapFile("/data/test_delay_updates_defer.rdf", testserver);
+mapFile("/data/test_delay_updates_complete_legacy.json", testserver);
+mapFile("/data/test_delay_updates_ignore_legacy.json", testserver);
+mapFile("/data/test_delay_updates_defer_legacy.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 function createIgnoreAddon() {
   writeInstallRDFToDir({
     id: IGNORE_ID,
     version: "1.0",
     bootstrap: true,
     unpack: true,
-    updateURL: `http://localhost:${gPort}/data/test_delay_updates_ignore.rdf`,
+    updateURL: `http://localhost:${gPort}/data/test_delay_updates_ignore_legacy.json`,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Delay Update Ignore",
   }, profileDir, IGNORE_ID, "bootstrap.js");
 
@@ -53,17 +53,17 @@ function createIgnoreAddon() {
 }
 
 function createCompleteAddon() {
   writeInstallRDFToDir({
     id: COMPLETE_ID,
     version: "1.0",
     bootstrap: true,
     unpack: true,
-    updateURL: `http://localhost:${gPort}/data/test_delay_updates_complete.rdf`,
+    updateURL: `http://localhost:${gPort}/data/test_delay_updates_complete_legacy.json`,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Delay Update Complete",
   }, profileDir, COMPLETE_ID, "bootstrap.js");
 
@@ -74,17 +74,17 @@ function createCompleteAddon() {
 }
 
 function createDeferAddon() {
   writeInstallRDFToDir({
     id: DEFER_ID,
     version: "1.0",
     bootstrap: true,
     unpack: true,
-    updateURL: `http://localhost:${gPort}/data/test_delay_updates_defer.rdf`,
+    updateURL: `http://localhost:${gPort}/data/test_delay_updates_defer_legacy.json`,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Delay Update Defer",
   }, profileDir, DEFER_ID, "bootstrap.js");
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
@@ -24,17 +24,17 @@ registerDirectory("XREUSysExt", userExtD
 ChromeUtils.import("resource://testing-common/httpd.js");
 // Create and configure the HTTP server.
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
 // register files with server
 testserver.registerDirectory("/addons/", do_get_file("addons"));
-mapFile("/data/test_dictionary.rdf", testserver);
+mapFile("/data/test_dictionary.json", testserver);
 
 /**
  * This object is both a factory and an mozISpellCheckingEngine implementation (so, it
  * is de-facto a service). It's also an interface requestor that gives out
  * itself when asked for mozISpellCheckingEngine.
  */
 var HunspellEngine = {
   dictionaryDirs: [],
@@ -664,17 +664,17 @@ function run_test_26() {
 }
 
 // Tests that an update check from a normal add-on to a bootstrappable add-on works
 function run_test_27() {
   restartManager();
   writeInstallRDFForExtension({
     id: "ab-CD@dictionaries.addons.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Dictionary",
   }, profileDir);
   restartManager();
@@ -710,17 +710,17 @@ function check_test_27(install) {
 // Tests that an update check from a bootstrappable add-on to a normal add-on works
 function run_test_28() {
   restartManager();
 
   writeInstallRDFForExtension({
     id: "ef@dictionaries.addons.mozilla.org",
     version: "1.0",
     type: "64",
-    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Dictionary ef",
   }, profileDir);
   restartManager();
@@ -756,17 +756,17 @@ function check_test_28(install) {
 // Tests that an update check from a bootstrappable add-on to a bootstrappable add-on works
 function run_test_29() {
   restartManager();
 
   writeInstallRDFForExtension({
     id: "gh@dictionaries.addons.mozilla.org",
     version: "1.0",
     type: "64",
-    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_dictionary.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Dictionary gh",
   }, profileDir);
   restartManager();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locked.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locked.js
@@ -5,17 +5,17 @@
 // Checks that we rebuild something sensible from a corrupt database
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_corrupt.rdf", testserver);
+mapFile("/data/test_corrupt.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
 
 // Will be enabled
 var addon1 = {
@@ -41,30 +41,30 @@ var addon2 = {
   }]
 };
 
 // Will get a compatibility update and stay enabled
 var addon3 = {
   id: "addon3@tests.mozilla.org",
   version: "1.0",
   name: "Test 3",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Will get a compatibility update and be enabled
 var addon4 = {
   id: "addon4@tests.mozilla.org",
   version: "1.0",
   name: "Test 4",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Would stay incompatible with strict compat
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locked_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locked_strictcompat.js
@@ -5,17 +5,17 @@
 // Checks that we rebuild something sensible from a corrupt database
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_corrupt.rdf", testserver);
+mapFile("/data/test_corrupt.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
 
 // Will be enabled
 var addon1 = {
@@ -41,30 +41,30 @@ var addon2 = {
   }]
 };
 
 // Will get a compatibility update and be enabled
 var addon3 = {
   id: "addon3@tests.mozilla.org",
   version: "1.0",
   name: "Test 3",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Will get a compatibility update and be disabled
 var addon4 = {
   id: "addon4@tests.mozilla.org",
   version: "1.0",
   name: "Test 4",
-  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_corrupt.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }]
 };
 
 // Stays incompatible
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_install.js
@@ -77,29 +77,35 @@ function createBrokenAddonRemove(file) {
 }
 
 function createInstall(url) {
   return AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
 }
 
 function serveUpdateRDF(leafName) {
   gServer.registerPathHandler("/update.rdf", function(request, response) {
-    let updateData = {};
-    updateData[ID] = [{
-      version: "2.0",
-      targetApplications: [{
-        id: "xpcshell@tests.mozilla.org",
-        minVersion: "4",
-        maxVersion: "6",
-        updateLink: "http://localhost:4444/" + leafName
-      }]
-    }];
-
     response.setStatusLine(request.httpVersion, 200, "OK");
-    response.write(createUpdateRDF(updateData));
+    response.write(JSON.stringify({
+      addons: {
+        [ID]: {
+          updates: [
+            {
+              version: "2.0",
+              update_link: "http://localhost:4444/" + leafName,
+              applications: {
+                gecko: {
+                  strict_min_version: "4",
+                  advisory_max_version: "6",
+                },
+              },
+            },
+          ],
+        },
+      },
+    }));
   });
 }
 
 
 async function test_install_broken(file, expectedError) {
   gServer.registerFile("/" + file.leafName, file);
 
   let install = await createInstall("http://localhost:4444/" + file.leafName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js
@@ -18,17 +18,16 @@ ChromeUtils.import("resource://gre/modul
 const PARAMS = "?%REQ_VERSION%/%ITEM_ID%/%ITEM_VERSION%/%ITEM_MAXAPPVERSION%/" +
                "%ITEM_STATUS%/%APP_ID%/%APP_VERSION%/%CURRENT_APP_VERSION%/" +
                "%APP_OS%/%APP_ABI%/%APP_LOCALE%/%UPDATE_TYPE%";
 
 var gInstallDate;
 
 var testserver = createHttpServer();
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_update.rdf", testserver);
 mapFile("/data/test_update.json", testserver);
 mapFile("/data/test_update_addons.json", testserver);
 mapFile("/data/test_update_compat.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
@@ -37,1167 +36,1159 @@ var originalSyncGUID;
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   Services.locale.setRequestedLocales(["fr-FR"]);
 
   run_next_test();
 }
 
-let testParams = [
-  { updateFile: "test_update.rdf",
-    appId: "xpcshell@tests.mozilla.org" },
-  { updateFile: "test_update.json",
-    appId: "toolkit@mozilla.org" },
-];
-
-for (let test of testParams) {
-  let { updateFile, appId } = test;
-
-  add_test(function() {
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-
-    writeInstallRDFForExtension({
-      id: "addon2@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }],
-      name: "Test Addon 2",
-    }, profileDir);
+const updateFile = "test_update.json";
+const appId = "toolkit@mozilla.org";
 
-    writeInstallRDFForExtension({
-      id: "addon3@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "5",
-        maxVersion: "5"
-      }],
-      name: "Test Addon 3",
-    }, profileDir);
-
-    startupManager();
-
-    run_next_test();
-  });
+add_test(function() {
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-  // Verify that an update is available and can be installed.
-  let check_test_1;
-  add_test(function run_test_1() {
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "1.0");
-      Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT);
-      Assert.equal(a1.releaseNotesURI, null);
-      Assert.ok(a1.foreignInstall);
-      Assert.notEqual(a1.syncGUID, null);
-
-      originalSyncGUID = a1.syncGUID;
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
-
-      prepare_test({
-        "addon1@tests.mozilla.org": [
-          ["onPropertyChanged", ["applyBackgroundUpdates"]]
-        ]
-      });
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-      check_test_completed();
+  writeInstallRDFForExtension({
+    id: "addon2@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }],
+    name: "Test Addon 2",
+  }, profileDir);
 
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-
-      prepare_test({}, [
-        "onNewInstall",
-      ]);
-
-      a1.findUpdates({
-        onNoCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
-        },
-
-        onUpdateAvailable(addon, install) {
-          ensure_test_completed();
+  writeInstallRDFForExtension({
+    id: "addon3@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "5",
+      maxVersion: "5"
+    }],
+    name: "Test Addon 3",
+  }, profileDir);
 
-          AddonManager.getAllInstalls(function(aInstalls) {
-            Assert.equal(aInstalls.length, 1);
-            Assert.equal(aInstalls[0], install);
+  startupManager();
 
-            Assert.equal(addon, a1);
-            Assert.equal(install.name, addon.name);
-            Assert.equal(install.version, "2.0");
-            Assert.equal(install.state, AddonManager.STATE_AVAILABLE);
-            Assert.equal(install.existingAddon, addon);
-            Assert.equal(install.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
-
-            // Verify that another update check returns the same AddonInstall
-            a1.findUpdates({
-              onNoCompatibilityUpdateAvailable() {
-                ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
-              },
+  run_next_test();
+});
 
-              onUpdateAvailable(newAddon, newInstall) {
-                AddonManager.getAllInstalls(function(aInstalls2) {
-                  Assert.equal(aInstalls2.length, 1);
-                  Assert.equal(aInstalls2[0], install);
-                  Assert.equal(newAddon, addon);
-                  Assert.equal(newInstall, install);
+// Verify that an update is available and can be installed.
+let check_test_1;
+add_test(function run_test_1() {
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "1.0");
+    Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT);
+    Assert.equal(a1.releaseNotesURI, null);
+    Assert.ok(a1.foreignInstall);
+    Assert.notEqual(a1.syncGUID, null);
 
-                  prepare_test({}, [
-                    "onDownloadStarted",
-                    "onDownloadEnded",
-                  ], check_test_1);
-                  install.install();
-                });
-              },
+    originalSyncGUID = a1.syncGUID;
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
 
-              onNoUpdateAvailable() {
-                ok(false, "Should not have seen onNoUpdateAvailable notification");
-              }
-            }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-          });
-        },
-
-        onNoUpdateAvailable(addon) {
-          ok(false, "Should not have seen onNoUpdateAvailable notification");
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+    prepare_test({
+      "addon1@tests.mozilla.org": [
+        ["onPropertyChanged", ["applyBackgroundUpdates"]]
+      ]
     });
-  });
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
+    check_test_completed();
 
-  let run_test_2;
-  check_test_1 = (install) => {
-    ensure_test_completed();
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
-    run_test_2(install);
-    return false;
-  };
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
 
-  // Continue installing the update.
-  let check_test_2;
-  run_test_2 = (install) => {
-    // Verify that another update check returns no new update
-    install.existingAddon.findUpdates({
+    prepare_test({}, [
+      "onNewInstall",
+    ]);
+
+    a1.findUpdates({
       onNoCompatibilityUpdateAvailable(addon) {
         ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
       },
 
-      onUpdateAvailable() {
-        ok(false, "Should find no available update when one is already downloading");
-      },
+      onUpdateAvailable(addon, install) {
+        ensure_test_completed();
 
-      onNoUpdateAvailable(addon) {
         AddonManager.getAllInstalls(function(aInstalls) {
           Assert.equal(aInstalls.length, 1);
           Assert.equal(aInstalls[0], install);
 
-          prepare_test({
-            "addon1@tests.mozilla.org": [
-              "onInstalling"
-            ]
-          }, [
-            "onInstallStarted",
-            "onInstallEnded",
-          ], check_test_2);
-          install.install();
+          Assert.equal(addon, a1);
+          Assert.equal(install.name, addon.name);
+          Assert.equal(install.version, "2.0");
+          Assert.equal(install.state, AddonManager.STATE_AVAILABLE);
+          Assert.equal(install.existingAddon, addon);
+          Assert.equal(install.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+
+          // Verify that another update check returns the same AddonInstall
+          a1.findUpdates({
+            onNoCompatibilityUpdateAvailable() {
+              ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
+            },
+
+            onUpdateAvailable(newAddon, newInstall) {
+              AddonManager.getAllInstalls(function(aInstalls2) {
+                Assert.equal(aInstalls2.length, 1);
+                Assert.equal(aInstalls2[0], install);
+                Assert.equal(newAddon, addon);
+                Assert.equal(newInstall, install);
+
+                prepare_test({}, [
+                  "onDownloadStarted",
+                  "onDownloadEnded",
+                ], check_test_1);
+                install.install();
+              });
+            },
+
+            onNoUpdateAvailable() {
+              ok(false, "Should not have seen onNoUpdateAvailable notification");
+            }
+          }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
         });
+      },
+
+      onNoUpdateAvailable(addon) {
+        ok(false, "Should not have seen onNoUpdateAvailable notification");
       }
     }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  };
-
-  check_test_2 = () => {
-    ensure_test_completed();
-
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(olda1) {
-      await AddonTestUtils.loadAddonsList(true);
+  });
+});
 
-      Assert.notEqual(olda1, null);
-      Assert.equal(olda1.version, "1.0");
-      Assert.ok(isExtensionInAddonsList(profileDir, olda1.id));
-
-      shutdownManager();
-
-      await promiseStartupManager();
-
-      // Grab the current time so we can check the mtime of the add-on below
-      // without worrying too much about how long other tests take.
-      let startupTime = Date.now();
+let run_test_2;
+check_test_1 = (install) => {
+  ensure_test_completed();
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
+  run_test_2(install);
+  return false;
+};
 
-      Assert.ok(isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org"));
+// Continue installing the update.
+let check_test_2;
+run_test_2 = (install) => {
+  // Verify that another update check returns no new update
+  install.existingAddon.findUpdates({
+    onNoCompatibilityUpdateAvailable(addon) {
+      ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
+    },
+
+    onUpdateAvailable() {
+      ok(false, "Should find no available update when one is already downloading");
+    },
 
-      AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-        Assert.notEqual(a1, null);
-        Assert.equal(a1.version, "2.0");
-        Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
-        Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE);
-        Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
-        Assert.ok(a1.foreignInstall);
-        Assert.notEqual(a1.syncGUID, null);
-        Assert.equal(originalSyncGUID, a1.syncGUID);
+    onNoUpdateAvailable(addon) {
+      AddonManager.getAllInstalls(function(aInstalls) {
+        Assert.equal(aInstalls.length, 1);
+        Assert.equal(aInstalls[0], install);
 
-        // Make sure that the extension lastModifiedTime was updated.
-        let testURI = a1.getResourceURI(TEST_UNPACKED ? "install.rdf" : "");
-        let testFile = testURI.QueryInterface(Ci.nsIFileURL).file;
-        let difference = testFile.lastModifiedTime - startupTime;
-        Assert.ok(Math.abs(difference) < MAX_TIME_DIFFERENCE);
-
-        a1.uninstall();
-        run_next_test();
+        prepare_test({
+          "addon1@tests.mozilla.org": [
+            "onInstalling"
+          ]
+        }, [
+          "onInstallStarted",
+          "onInstallEnded",
+        ], check_test_2);
+        install.install();
       });
-    }));
-  };
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+};
 
-  // Check that an update check finds compatibility updates and applies them
-  let check_test_3;
-  add_test(function run_test_3() {
-    restartManager();
+check_test_2 = () => {
+  ensure_test_completed();
 
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-      Assert.notEqual(a2, null);
-      Assert.ok(a2.isActive);
-      Assert.ok(a2.isCompatible);
-      Assert.ok(!a2.appDisabled);
-      Assert.ok(a2.isCompatibleWith("0", "0"));
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(olda1) {
+    await AddonTestUtils.loadAddonsList(true);
 
-      a2.findUpdates({
-        onCompatibilityUpdateAvailable(addon) {
-          Assert.ok(a2.isCompatible);
-          Assert.ok(!a2.appDisabled);
-          Assert.ok(a2.isActive);
-        },
+    Assert.notEqual(olda1, null);
+    Assert.equal(olda1.version, "1.0");
+    Assert.ok(isExtensionInAddonsList(profileDir, olda1.id));
+
+    shutdownManager();
+
+    await promiseStartupManager();
 
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
+    // Grab the current time so we can check the mtime of the add-on below
+    // without worrying too much about how long other tests take.
+    let startupTime = Date.now();
+
+    Assert.ok(isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org"));
 
-        onNoUpdateAvailable(addon) {
-          Assert.equal(addon, a2);
-          executeSoon(check_test_3);
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
+    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
+      Assert.notEqual(a1, null);
+      Assert.equal(a1.version, "2.0");
+      Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
+      Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE);
+      Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+      Assert.ok(a1.foreignInstall);
+      Assert.notEqual(a1.syncGUID, null);
+      Assert.equal(originalSyncGUID, a1.syncGUID);
 
-  check_test_3 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-      Assert.notEqual(a2, null);
-      Assert.ok(a2.isActive);
-      Assert.ok(a2.isCompatible);
-      Assert.ok(!a2.appDisabled);
-      a2.uninstall();
+      // Make sure that the extension lastModifiedTime was updated.
+      let testURI = a1.getResourceURI(TEST_UNPACKED ? "install.rdf" : "");
+      let testFile = testURI.QueryInterface(Ci.nsIFileURL).file;
+      let difference = testFile.lastModifiedTime - startupTime;
+      Assert.ok(Math.abs(difference) < MAX_TIME_DIFFERENCE);
 
+      a1.uninstall();
       run_next_test();
     });
-  };
+  }));
+};
+
+// Check that an update check finds compatibility updates and applies them
+let check_test_3;
+add_test(function run_test_3() {
+  restartManager();
+
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
+    Assert.notEqual(a2, null);
+    Assert.ok(a2.isActive);
+    Assert.ok(a2.isCompatible);
+    Assert.ok(!a2.appDisabled);
+    Assert.ok(a2.isCompatibleWith("0", "0"));
+
+    a2.findUpdates({
+      onCompatibilityUpdateAvailable(addon) {
+        Assert.ok(a2.isCompatible);
+        Assert.ok(!a2.appDisabled);
+        Assert.ok(a2.isActive);
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onNoUpdateAvailable(addon) {
+        Assert.equal(addon, a2);
+        executeSoon(check_test_3);
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+check_test_3 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
+    Assert.notEqual(a2, null);
+    Assert.ok(a2.isActive);
+    Assert.ok(a2.isCompatible);
+    Assert.ok(!a2.appDisabled);
+    a2.uninstall();
+
+    run_next_test();
+  });
+};
+
+// Checks that we see no compatibility information when there is none.
+add_test(function run_test_4() {
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
+    Assert.ok(a3.isCompatibleWith("5", "5"));
+    Assert.ok(!a3.isCompatibleWith("2", "2"));
+
+    a3.findUpdates({
+      sawUpdate: false,
+      onCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should not have seen compatibility information");
+      },
+
+      onNoCompatibilityUpdateAvailable(addon) {
+        this.sawUpdate = true;
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onNoUpdateAvailable(addon) {
+        Assert.ok(this.sawUpdate);
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+// Checks that compatibility info for future apps are detected but don't make
+// the item compatibile.
+let check_test_5;
+add_test(function run_test_5() {
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
+    Assert.ok(a3.isCompatibleWith("5", "5"));
+    Assert.ok(!a3.isCompatibleWith("2", "2"));
 
-  // Checks that we see no compatibility information when there is none.
-  add_test(function run_test_4() {
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
-      Assert.ok(a3.isCompatibleWith("5", "5"));
-      Assert.ok(!a3.isCompatibleWith("2", "2"));
+    a3.findUpdates({
+      sawUpdate: false,
+      onCompatibilityUpdateAvailable(addon) {
+        Assert.ok(!a3.isCompatible);
+        Assert.ok(a3.appDisabled);
+        Assert.ok(!a3.isActive);
+        this.sawUpdate = true;
+      },
+
+      onNoCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should have seen some compatibility information");
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onNoUpdateAvailable(addon) {
+        Assert.ok(this.sawUpdate);
+        executeSoon(check_test_5);
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED, "3.0", "3.0");
+  });
+});
+
+check_test_5 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
+
+    a3.uninstall();
+    run_next_test();
+  });
+};
+
+// Test that background update checks work
+let continue_test_6;
+add_test(function run_test_6() {
+  restartManager();
+
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
+  restartManager();
+
+  prepare_test({}, [
+    "onNewInstall",
+    "onDownloadStarted",
+    "onDownloadEnded"
+  ], continue_test_6);
+
+  AddonManagerInternal.backgroundUpdateCheck();
+});
+
+let check_test_6;
+continue_test_6 = (install) => {
+  Assert.notEqual(install.existingAddon, null);
+  Assert.equal(install.existingAddon.id, "addon1@tests.mozilla.org");
+
+  prepare_test({
+    "addon1@tests.mozilla.org": [
+      "onInstalling"
+    ]
+  }, [
+    "onInstallStarted",
+    "onInstallEnded",
+  ], callback_soon(check_test_6));
+};
+
+check_test_6 = (install) => {
+  Assert.equal(install.existingAddon.pendingUpgrade.install, install);
+
+  restartManager();
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+    a1.uninstall();
+    run_next_test();
+  });
+};
 
-      a3.findUpdates({
-        sawUpdate: false,
-        onCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should not have seen compatibility information");
-        },
+// Verify the parameter escaping in update urls.
+add_test(function run_test_8() {
+  restartManager();
+
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "5.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "2"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon2@tests.mozilla.org",
+    version: "67.0.5b1",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: "toolkit@mozilla.org",
+      minVersion: "0",
+      maxVersion: "3"
+    }],
+    name: "Test Addon 2",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon3@tests.mozilla.org",
+    version: "1.3+",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }, {
+      id: "toolkit@mozilla.org",
+      minVersion: "0",
+      maxVersion: "3"
+    }],
+    name: "Test Addon 3",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon4@tests.mozilla.org",
+    version: "0.5ab6",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "5"
+    }],
+    name: "Test Addon 4",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon5@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 5",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon6@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 6",
+  }, profileDir);
+
+  restartManager();
+
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(function(a2) {
+    a2.userDisabled = true;
+    restartManager();
 
-        onNoCompatibilityUpdateAvailable(addon) {
-          this.sawUpdate = true;
-        },
+    testserver.registerPathHandler("/data/param_test.json", function(request, response) {
+      Assert.notEqual(request.queryString, "");
+      let [req_version, item_id, item_version,
+           item_maxappversion, item_status,
+           app_id, app_version, current_app_version,
+           app_os, app_abi, app_locale, update_type] =
+           request.queryString.split("/").map(a => decodeURIComponent(a));
+
+      Assert.equal(req_version, "2");
 
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
+      switch (item_id) {
+      case "addon1@tests.mozilla.org":
+        Assert.equal(item_version, "5.0");
+        Assert.equal(item_maxappversion, "2");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "97");
+        break;
+      case "addon2@tests.mozilla.org":
+        Assert.equal(item_version, "67.0.5b1");
+        Assert.equal(item_maxappversion, "3");
+        Assert.equal(item_status, "userDisabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "49");
+        break;
+      case "addon3@tests.mozilla.org":
+        Assert.equal(item_version, "1.3+");
+        Assert.equal(item_maxappversion, "0");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "112");
+        break;
+      case "addon4@tests.mozilla.org":
+        Assert.equal(item_version, "0.5ab6");
+        Assert.equal(item_maxappversion, "5");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "2");
+        Assert.equal(update_type, "98");
+        break;
+      case "addon5@tests.mozilla.org":
+        Assert.equal(item_version, "1.0");
+        Assert.equal(item_maxappversion, "1");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "35");
+        break;
+      case "addon6@tests.mozilla.org":
+        Assert.equal(item_version, "1.0");
+        Assert.equal(item_maxappversion, "1");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "99");
+        break;
+      default:
+        ok(false, "Update request for unexpected add-on " + item_id);
+      }
+
+      Assert.equal(app_id, "xpcshell@tests.mozilla.org");
+      Assert.equal(current_app_version, "1");
+      Assert.equal(app_os, "XPCShell");
+      Assert.equal(app_abi, "noarch-spidermonkey");
+      Assert.equal(app_locale, "fr-FR");
+
+      request.setStatusLine(null, 500, "Server Error");
+    });
+
+    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"],
+                                 function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
+      let count = 6;
+
+      function next_test() {
+        a1_2.uninstall();
+        a2_2.uninstall();
+        a3_2.uninstall();
+        a4_2.uninstall();
+        a5_2.uninstall();
+        a6_2.uninstall();
+
+        restartManager();
+        run_next_test();
+      }
+
+      let compatListener = {
+        onUpdateFinished(addon, error) {
+          if (--count == 0)
+            executeSoon(next_test);
+        }
+      };
+
+      let updateListener = {
+        onUpdateAvailable(addon, update) {
+          // Dummy so the update checker knows we care about new versions
         },
 
-        onNoUpdateAvailable(addon) {
-          Assert.ok(this.sawUpdate);
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-
-  // Checks that compatibility info for future apps are detected but don't make
-  // the item compatibile.
-  let check_test_5;
-  add_test(function run_test_5() {
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
-      Assert.ok(a3.isCompatibleWith("5", "5"));
-      Assert.ok(!a3.isCompatibleWith("2", "2"));
-
-      a3.findUpdates({
-        sawUpdate: false,
-        onCompatibilityUpdateAvailable(addon) {
-          Assert.ok(!a3.isCompatible);
-          Assert.ok(a3.appDisabled);
-          Assert.ok(!a3.isActive);
-          this.sawUpdate = true;
-        },
-
-        onNoCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should have seen some compatibility information");
-        },
-
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onNoUpdateAvailable(addon) {
-          Assert.ok(this.sawUpdate);
-          executeSoon(check_test_5);
+        onUpdateFinished(addon, error) {
+          if (--count == 0)
+            executeSoon(next_test);
         }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED, "3.0", "3.0");
+      };
+
+      a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+      a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
+      a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
+      a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
+      a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+      a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
     });
+  }));
+});
+
+// Tests that if an install.rdf claims compatibility then the add-on will be
+// seen as compatible regardless of what the update.rdf says.
+add_test(function run_test_9() {
+  writeInstallRDFForExtension({
+    id: "addon4@tests.mozilla.org",
+    version: "5.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
+
+  restartManager();
+
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    Assert.ok(a4.isActive, "addon4 is active");
+    Assert.ok(a4.isCompatible, "addon4 is compatible");
+
+    run_next_test();
   });
+});
+
+// Tests that a normal update check won't decrease a targetApplication's
+// maxVersion.
+add_test(function run_test_10() {
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    a4.findUpdates({
+      onUpdateFinished(addon) {
+        Assert.ok(addon.isCompatible, "addon4 is compatible");
+
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
+  });
+});
 
-  check_test_5 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
+// Tests that an update check for a new application will decrease a
+// targetApplication's maxVersion.
+add_test(function run_test_11() {
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    a4.findUpdates({
+      onUpdateFinished(addon) {
+        Assert.ok(addon.isCompatible, "addon4 is not compatible");
+
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+  });
+});
+
+// Check that the decreased maxVersion applied and disables the add-on
+add_test(function run_test_12() {
+  restartManager();
+
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    Assert.ok(a4.isActive);
+    Assert.ok(a4.isCompatible);
+
+    a4.uninstall();
+    run_next_test();
+  });
+});
 
-      a3.uninstall();
-      run_next_test();
-    });
-  };
+// Tests that a compatibility update is passed to the listener when there is
+// compatibility info for the current version of the app but not for the
+// version of the app that the caller requested an update check for, when
+// strict compatibility checking is disabled.
+let check_test_13;
+add_test(function run_test_13() {
+  restartManager();
+
+  // Not initially compatible but the update check will make it compatible
+  writeInstallRDFForExtension({
+    id: "addon7@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }],
+    name: "Test Addon 7",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
+    Assert.notEqual(a7, null);
+    Assert.ok(a7.isActive);
+    Assert.ok(a7.isCompatible);
+    Assert.ok(!a7.appDisabled);
+    Assert.ok(a7.isCompatibleWith("0", "0"));
 
-  // Test that background update checks work
-  let continue_test_6;
-  add_test(function run_test_6() {
-    restartManager();
+    a7.findUpdates({
+      sawUpdate: false,
+      onNoCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should have seen compatibility information");
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onUpdateFinished(addon) {
+        Assert.ok(addon.isCompatible);
+        executeSoon(check_test_13);
+      }
+    }, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "3.0", "3.0");
+  });
+});
+
+check_test_13 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
+    Assert.notEqual(a7, null);
+    Assert.ok(a7.isActive);
+    Assert.ok(a7.isCompatible);
+    Assert.ok(!a7.appDisabled);
+
+    a7.uninstall();
+    run_next_test();
+  });
+};
+
+// Test that background update checks doesn't update an add-on that isn't
+// allowed to update automatically.
+let check_test_14;
+add_test(function run_test_14() {
+  restartManager();
+
+  // Have an add-on there that will be updated so we see some events from it
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-    restartManager();
+  writeInstallRDFForExtension({
+    id: "addon8@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 8",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
+    a8.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
+
+    // The background update check will find updates for both add-ons but only
+    // proceed to install one of them.
+    AddonManager.addInstallListener({
+      onNewInstall(aInstall) {
+        let id = aInstall.existingAddon.id;
+        ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
+           "Saw unexpected onNewInstall for " + id);
+      },
+
+      onDownloadStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
 
-    prepare_test({}, [
-      "onNewInstall",
-      "onDownloadStarted",
-      "onDownloadEnded"
-    ], continue_test_6);
+      onDownloadEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onDownloadFailed(aInstall) {
+        ok(false, "Should not have seen onDownloadFailed event");
+      },
+
+      onDownloadCancelled(aInstall) {
+        ok(false, "Should not have seen onDownloadCancelled event");
+      },
+
+      onInstallStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onInstallEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+        Assert.equal(aInstall.existingAddon.pendingUpgrade.install, aInstall);
+
+        executeSoon(check_test_14);
+      },
+
+      onInstallFailed(aInstall) {
+        ok(false, "Should not have seen onInstallFailed event");
+      },
+
+      onInstallCancelled(aInstall) {
+        ok(false, "Should not have seen onInstallCancelled event");
+      },
+    });
 
     AddonManagerInternal.backgroundUpdateCheck();
   });
-
-  let check_test_6;
-  continue_test_6 = (install) => {
-    Assert.notEqual(install.existingAddon, null);
-    Assert.equal(install.existingAddon.id, "addon1@tests.mozilla.org");
+});
 
-    prepare_test({
-      "addon1@tests.mozilla.org": [
-        "onInstalling"
-      ]
-    }, [
-      "onInstallStarted",
-      "onInstallEnded",
-    ], callback_soon(check_test_6));
-  };
+check_test_14 = () => {
+  restartManager();
+  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                               "addon8@tests.mozilla.org"], function([a1, a8]) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    a1.uninstall();
 
-  check_test_6 = (install) => {
-    Assert.equal(install.existingAddon.pendingUpgrade.install, install);
+    Assert.notEqual(a8, null);
+    Assert.equal(a8.version, "1.0");
+    a8.uninstall();
+
+    run_next_test();
+  });
+};
 
-    restartManager();
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
-      a1.uninstall();
-      run_next_test();
-    });
-  };
+// Test that background update checks doesn't update an add-on that is
+// pending uninstall
+let check_test_15;
+add_test(function run_test_15() {
+  restartManager();
 
-  // Verify the parameter escaping in update urls.
-  add_test(function run_test_8() {
-    restartManager();
-
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "5.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "2"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
+  // Have an add-on there that will be updated so we see some events from it
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-    writeInstallRDFForExtension({
-      id: "addon2@tests.mozilla.org",
-      version: "67.0.5b1",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: "toolkit@mozilla.org",
-        minVersion: "0",
-        maxVersion: "3"
-      }],
-      name: "Test Addon 2",
-    }, profileDir);
+  writeInstallRDFForExtension({
+    id: "addon8@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 8",
+  }, profileDir);
+  restartManager();
 
-    writeInstallRDFForExtension({
-      id: "addon3@tests.mozilla.org",
-      version: "1.3+",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }, {
-        id: "toolkit@mozilla.org",
-        minVersion: "0",
-        maxVersion: "3"
-      }],
-      name: "Test Addon 3",
-    }, profileDir);
+  AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
+    a8.uninstall();
+    Assert.ok(!hasFlag(a8.permissions, AddonManager.PERM_CAN_UPGRADE));
+
+    // The background update check will find updates for both add-ons but only
+    // proceed to install one of them.
+    AddonManager.addInstallListener({
+      onNewInstall(aInstall) {
+        let id = aInstall.existingAddon.id;
+        ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
+           "Saw unexpected onNewInstall for " + id);
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon4@tests.mozilla.org",
-      version: "0.5ab6",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "5"
-      }],
-      name: "Test Addon 4",
-    }, profileDir);
+      onDownloadStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onDownloadEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onDownloadFailed(aInstall) {
+        ok(false, "Should not have seen onDownloadFailed event");
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon5@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 5",
-    }, profileDir);
+      onDownloadCancelled(aInstall) {
+        ok(false, "Should not have seen onDownloadCancelled event");
+      },
+
+      onInstallStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon6@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 6",
-    }, profileDir);
+      onInstallEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+        executeSoon(check_test_15);
+      },
 
-    restartManager();
+      onInstallFailed(aInstall) {
+        ok(false, "Should not have seen onInstallFailed event");
+      },
 
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(function(a2) {
-      a2.userDisabled = true;
-      restartManager();
+      onInstallCancelled(aInstall) {
+        ok(false, "Should not have seen onInstallCancelled event");
+      },
+    });
+
+    AddonManagerInternal.backgroundUpdateCheck();
+  });
+});
+
+check_test_15 = () => {
+  restartManager();
+  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                               "addon8@tests.mozilla.org"], function([a1, a8]) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    a1.uninstall();
+
+    Assert.equal(a8, null);
+
+    run_next_test();
+  });
+};
 
-      testserver.registerPathHandler("/data/param_test.rdf", function(request, response) {
-        Assert.notEqual(request.queryString, "");
-        let [req_version, item_id, item_version,
-             item_maxappversion, item_status,
-             app_id, app_version, current_app_version,
-             app_os, app_abi, app_locale, update_type] =
-             request.queryString.split("/").map(a => decodeURIComponent(a));
+add_test(function run_test_16() {
+  restartManager();
+
+  restartManager();
 
-        Assert.equal(req_version, "2");
+  let url = "http://localhost:" + gPort + "/addons/test_install2_1.xpi";
+  AddonManager.getInstallForURL(url, function(aInstall) {
+    aInstall.addListener({
+      onInstallEnded() {
+       executeSoon(function install_2_1_ended() {
+        restartManager();
+
+        AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a1) {
+          Assert.notEqual(a1.syncGUID, null);
+          let oldGUID = a1.syncGUID;
+
+          let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
+          AddonManager.getInstallForURL(url_2, function(aInstall_2) {
+            aInstall_2.addListener({
+              onInstallEnded() {
+               executeSoon(function install_2_2_ended() {
+                restartManager();
 
-        switch (item_id) {
-        case "addon1@tests.mozilla.org":
-          Assert.equal(item_version, "5.0");
-          Assert.equal(item_maxappversion, "2");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "97");
-          break;
-        case "addon2@tests.mozilla.org":
-          Assert.equal(item_version, "67.0.5b1");
-          Assert.equal(item_maxappversion, "3");
-          Assert.equal(item_status, "userDisabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "49");
-          break;
-        case "addon3@tests.mozilla.org":
-          Assert.equal(item_version, "1.3+");
-          Assert.equal(item_maxappversion, "0");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "112");
-          break;
-        case "addon4@tests.mozilla.org":
-          Assert.equal(item_version, "0.5ab6");
-          Assert.equal(item_maxappversion, "5");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "2");
-          Assert.equal(update_type, "98");
-          break;
-        case "addon5@tests.mozilla.org":
-          Assert.equal(item_version, "1.0");
-          Assert.equal(item_maxappversion, "1");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "35");
-          break;
-        case "addon6@tests.mozilla.org":
-          Assert.equal(item_version, "1.0");
-          Assert.equal(item_maxappversion, "1");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "99");
-          break;
-        default:
-          ok(false, "Update request for unexpected add-on " + item_id);
-        }
+                AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
+                  Assert.notEqual(a2.syncGUID, null);
+                  Assert.equal(oldGUID, a2.syncGUID);
+
+                  a2.uninstall();
+                  run_next_test();
+                });
+               });
+              }
+            });
+            aInstall_2.install();
+          }, "application/x-xpinstall");
+        });
+       });
+      }
+    });
+    aInstall.install();
+  }, "application/x-xpinstall");
+});
+
+// Test that the update check correctly observes the
+// extensions.strictCompatibility pref and compatibility overrides.
+add_test(function run_test_17() {
+  restartManager();
 
-        Assert.equal(app_id, "xpcshell@tests.mozilla.org");
-        Assert.equal(current_app_version, "1");
-        Assert.equal(app_os, "XPCShell");
-        Assert.equal(app_abi, "noarch-spidermonkey");
-        Assert.equal(app_locale, "fr-FR");
-
-        request.setStatusLine(null, 500, "Server Error");
-      });
-
-      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"],
-                                   function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
-        let count = 6;
-
-        function next_test() {
-          a1_2.uninstall();
-          a2_2.uninstall();
-          a3_2.uninstall();
-          a4_2.uninstall();
-          a5_2.uninstall();
-          a6_2.uninstall();
+  writeInstallRDFForExtension({
+    id: "addon9@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 9",
+  }, profileDir);
+  restartManager();
 
-          restartManager();
-          run_next_test();
-        }
-
-        let compatListener = {
-          onUpdateFinished(addon, error) {
-            if (--count == 0)
-              executeSoon(next_test);
-          }
-        };
-
-        let updateListener = {
-          onUpdateAvailable(addon, update) {
-            // Dummy so the update checker knows we care about new versions
-          },
-
-          onUpdateFinished(addon, error) {
-            if (--count == 0)
-              executeSoon(next_test);
-          }
-        };
-
-        a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-        a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
-        a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
-        a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
-        a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-        a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+  AddonManager.addInstallListener({
+    onNewInstall(aInstall) {
+      equal(aInstall.existingAddon.id, "addon9@tests.mozilla.org",
+            "Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
+      Assert.equal(aInstall.version, "3.0");
+    },
+    onDownloadFailed(aInstall) {
+      AddonManager.getAddonByID("addon9@tests.mozilla.org", function(a9) {
+        a9.uninstall();
+        run_next_test();
       });
-    }));
+    }
   });
 
-  // Tests that if an install.rdf claims compatibility then the add-on will be
-  // seen as compatible regardless of what the update.rdf says.
-  add_test(function run_test_9() {
-    writeInstallRDFForExtension({
-      id: "addon4@tests.mozilla.org",
-      version: "5.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
+  Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
+                             `http://localhost:${gPort}/data/test_update_addons.json`);
+  Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
+                             `http://localhost:${gPort}/data/test_update_compat.json`);
+  Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
+
+  AddonManagerInternal.backgroundUpdateCheck();
+});
+
+// Tests that compatibility updates are applied to addons when the updated
+// compatibility data wouldn't match with strict compatibility enabled.
+add_test(function run_test_18() {
+  restartManager();
+  writeInstallRDFForExtension({
+    id: "addon10@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 10",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon10@tests.mozilla.org", function(a10) {
+    Assert.notEqual(a10, null);
+
+    a10.findUpdates({
+      onNoCompatibilityUpdateAvailable() {
+        ok(false, "Should have seen compatibility information");
+      },
+
+      onUpdateAvailable() {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onUpdateFinished() {
+        a10.uninstall();
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+// Test that the update check correctly observes when an addon opts-in to
+// strict compatibility checking.
+add_test(function run_test_19() {
+  restartManager();
+  writeInstallRDFForExtension({
+    id: "addon11@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 11",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
+    Assert.notEqual(a11, null);
 
-    restartManager();
+    a11.findUpdates({
+      onCompatibilityUpdateAvailable() {
+        ok(false, "Should have not have seen compatibility information");
+      },
+
+      onUpdateAvailable() {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onUpdateFinished() {
+        a11.uninstall();
+        run_next_test();
+      }
+   }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+// Test that the update succeeds when the update.rdf URN contains a type prefix
+// different from the add-on type
+let continue_test_20;
+add_test(function run_test_20() {
+  restartManager();
+  writeInstallRDFForExtension({
+    id: "addon12@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 12",
+  }, profileDir);
+  restartManager();
 
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      Assert.ok(a4.isActive, "addon4 is active");
-      Assert.ok(a4.isCompatible, "addon4 is compatible");
+  prepare_test({}, [
+    "onNewInstall",
+    "onDownloadStarted",
+    "onDownloadEnded"
+  ], continue_test_20);
+
+  AddonManagerPrivate.backgroundUpdateCheck();
+});
+
+let check_test_20;
+continue_test_20 = (install) => {
+  Assert.notEqual(install.existingAddon, null);
+  Assert.equal(install.existingAddon.id, "addon12@tests.mozilla.org");
 
+  prepare_test({
+    "addon12@tests.mozilla.org": [
+      "onInstalling"
+    ]
+  }, [
+    "onInstallStarted",
+    "onInstallEnded",
+  ], callback_soon(check_test_20));
+};
+
+check_test_20 = (install) => {
+  Assert.equal(install.existingAddon.pendingUpgrade.install, install);
+
+  restartManager();
+  AddonManager.getAddonByID("addon12@tests.mozilla.org", function(a12) {
+    Assert.notEqual(a12, null);
+    Assert.equal(a12.version, "2.0");
+    Assert.equal(a12.type, "extension");
+    a12.uninstall();
+
+    executeSoon(() => {
+      restartManager();
       run_next_test();
     });
   });
-
-  // Tests that a normal update check won't decrease a targetApplication's
-  // maxVersion.
-  add_test(function run_test_10() {
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      a4.findUpdates({
-        onUpdateFinished(addon) {
-          Assert.ok(addon.isCompatible, "addon4 is compatible");
-
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
-    });
-  });
-
-  // Tests that an update check for a new application will decrease a
-  // targetApplication's maxVersion.
-  add_test(function run_test_11() {
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      a4.findUpdates({
-        onUpdateFinished(addon) {
-          Assert.ok(addon.isCompatible, "addon4 is not compatible");
-
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-    });
-  });
-
-  // Check that the decreased maxVersion applied and disables the add-on
-  add_test(function run_test_12() {
-    restartManager();
-
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      Assert.ok(a4.isActive);
-      Assert.ok(a4.isCompatible);
-
-      a4.uninstall();
-      run_next_test();
-    });
-  });
-
-  // Tests that a compatibility update is passed to the listener when there is
-  // compatibility info for the current version of the app but not for the
-  // version of the app that the caller requested an update check for, when
-  // strict compatibility checking is disabled.
-  let check_test_13;
-  add_test(function run_test_13() {
-    restartManager();
-
-    // Not initially compatible but the update check will make it compatible
-    writeInstallRDFForExtension({
-      id: "addon7@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }],
-      name: "Test Addon 7",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
-      Assert.notEqual(a7, null);
-      Assert.ok(a7.isActive);
-      Assert.ok(a7.isCompatible);
-      Assert.ok(!a7.appDisabled);
-      Assert.ok(a7.isCompatibleWith("0", "0"));
-
-      a7.findUpdates({
-        sawUpdate: false,
-        onNoCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should have seen compatibility information");
-        },
-
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onUpdateFinished(addon) {
-          Assert.ok(addon.isCompatible);
-          executeSoon(check_test_13);
-        }
-      }, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "3.0", "3.0");
-    });
-  });
-
-  check_test_13 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
-      Assert.notEqual(a7, null);
-      Assert.ok(a7.isActive);
-      Assert.ok(a7.isCompatible);
-      Assert.ok(!a7.appDisabled);
-
-      a7.uninstall();
-      run_next_test();
-    });
-  };
-
-  // Test that background update checks doesn't update an add-on that isn't
-  // allowed to update automatically.
-  let check_test_14;
-  add_test(function run_test_14() {
-    restartManager();
-
-    // Have an add-on there that will be updated so we see some events from it
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
+};
 
-    writeInstallRDFForExtension({
-      id: "addon8@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 8",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
-      a8.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-
-      // The background update check will find updates for both add-ons but only
-      // proceed to install one of them.
-      AddonManager.addInstallListener({
-        onNewInstall(aInstall) {
-          let id = aInstall.existingAddon.id;
-          ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
-             "Saw unexpected onNewInstall for " + id);
-        },
-
-        onDownloadStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadFailed(aInstall) {
-          ok(false, "Should not have seen onDownloadFailed event");
-        },
-
-        onDownloadCancelled(aInstall) {
-          ok(false, "Should not have seen onDownloadCancelled event");
-        },
-
-        onInstallStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onInstallEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-          Assert.equal(aInstall.existingAddon.pendingUpgrade.install, aInstall);
-
-          executeSoon(check_test_14);
-        },
-
-        onInstallFailed(aInstall) {
-          ok(false, "Should not have seen onInstallFailed event");
-        },
-
-        onInstallCancelled(aInstall) {
-          ok(false, "Should not have seen onInstallCancelled event");
-        },
-      });
-
-      AddonManagerInternal.backgroundUpdateCheck();
-    });
-  });
-
-  check_test_14 = () => {
-    restartManager();
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon8@tests.mozilla.org"], function([a1, a8]) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      a1.uninstall();
-
-      Assert.notEqual(a8, null);
-      Assert.equal(a8.version, "1.0");
-      a8.uninstall();
-
-      run_next_test();
-    });
-  };
-
-  // Test that background update checks doesn't update an add-on that is
-  // pending uninstall
-  let check_test_15;
-  add_test(function run_test_15() {
-    restartManager();
-
-    // Have an add-on there that will be updated so we see some events from it
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-
-    writeInstallRDFForExtension({
-      id: "addon8@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 8",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
-      a8.uninstall();
-      Assert.ok(!hasFlag(a8.permissions, AddonManager.PERM_CAN_UPGRADE));
-
-      // The background update check will find updates for both add-ons but only
-      // proceed to install one of them.
-      AddonManager.addInstallListener({
-        onNewInstall(aInstall) {
-          let id = aInstall.existingAddon.id;
-          ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
-             "Saw unexpected onNewInstall for " + id);
-        },
-
-        onDownloadStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadFailed(aInstall) {
-          ok(false, "Should not have seen onDownloadFailed event");
-        },
-
-        onDownloadCancelled(aInstall) {
-          ok(false, "Should not have seen onDownloadCancelled event");
-        },
+add_task(async function cleanup() {
+  let addons = await AddonManager.getAddonsByTypes(["extension"]);
 
-        onInstallStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onInstallEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-          executeSoon(check_test_15);
-        },
-
-        onInstallFailed(aInstall) {
-          ok(false, "Should not have seen onInstallFailed event");
-        },
-
-        onInstallCancelled(aInstall) {
-          ok(false, "Should not have seen onInstallCancelled event");
-        },
-      });
-
-      AddonManagerInternal.backgroundUpdateCheck();
-    });
-  });
-
-  check_test_15 = () => {
-    restartManager();
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon8@tests.mozilla.org"], function([a1, a8]) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      a1.uninstall();
-
-      Assert.equal(a8, null);
-
-      run_next_test();
-    });
-  };
-
-  add_test(function run_test_16() {
-    restartManager();
-
-    restartManager();
-
-    let url = "http://localhost:" + gPort + "/addons/test_install2_1.xpi";
-    AddonManager.getInstallForURL(url, function(aInstall) {
-      aInstall.addListener({
-        onInstallEnded() {
-         executeSoon(function install_2_1_ended() {
-          restartManager();
-
-          AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a1) {
-            Assert.notEqual(a1.syncGUID, null);
-            let oldGUID = a1.syncGUID;
-
-            let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
-            AddonManager.getInstallForURL(url_2, function(aInstall_2) {
-              aInstall_2.addListener({
-                onInstallEnded() {
-                 executeSoon(function install_2_2_ended() {
-                  restartManager();
+  for (let addon of addons)
+    addon.uninstall();
 
-                  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-                    Assert.notEqual(a2.syncGUID, null);
-                    Assert.equal(oldGUID, a2.syncGUID);
-
-                    a2.uninstall();
-                    run_next_test();
-                  });
-                 });
-                }
-              });
-              aInstall_2.install();
-            }, "application/x-xpinstall");
-          });
-         });
-        }
-      });
-      aInstall.install();
-    }, "application/x-xpinstall");
-  });
-
-  // Test that the update check correctly observes the
-  // extensions.strictCompatibility pref and compatibility overrides.
-  add_test(function run_test_17() {
-    restartManager();
-
-    writeInstallRDFForExtension({
-      id: "addon9@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 9",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.addInstallListener({
-      onNewInstall(aInstall) {
-        equal(aInstall.existingAddon.id, "addon9@tests.mozilla.org",
-              "Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
-        Assert.equal(aInstall.version, "3.0");
-      },
-      onDownloadFailed(aInstall) {
-        AddonManager.getAddonByID("addon9@tests.mozilla.org", function(a9) {
-          a9.uninstall();
-          run_next_test();
-        });
-      }
-    });
-
-    Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
-                               `http://localhost:${gPort}/data/test_update_addons.json`);
-    Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
-                               `http://localhost:${gPort}/data/test_update_compat.json`);
-    Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
-
-    AddonManagerInternal.backgroundUpdateCheck();
-  });
+  await promiseRestartManager();
 
-  // Tests that compatibility updates are applied to addons when the updated
-  // compatibility data wouldn't match with strict compatibility enabled.
-  add_test(function run_test_18() {
-    restartManager();
-    writeInstallRDFForExtension({
-      id: "addon10@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 10",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon10@tests.mozilla.org", function(a10) {
-      Assert.notEqual(a10, null);
-
-      a10.findUpdates({
-        onNoCompatibilityUpdateAvailable() {
-          ok(false, "Should have seen compatibility information");
-        },
-
-        onUpdateAvailable() {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onUpdateFinished() {
-          a10.uninstall();
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-
-  // Test that the update check correctly observes when an addon opts-in to
-  // strict compatibility checking.
-  add_test(function run_test_19() {
-    restartManager();
-    writeInstallRDFForExtension({
-      id: "addon11@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 11",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
-      Assert.notEqual(a11, null);
-
-      a11.findUpdates({
-        onCompatibilityUpdateAvailable() {
-          ok(false, "Should have not have seen compatibility information");
-        },
-
-        onUpdateAvailable() {
-          ok(false, "Should not have seen an available update");
-        },
+  shutdownManager();
 
-        onUpdateFinished() {
-          a11.uninstall();
-          run_next_test();
-        }
-     }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-
-  // Test that the update succeeds when the update.rdf URN contains a type prefix
-  // different from the add-on type
-  let continue_test_20;
-  add_test(function run_test_20() {
-    restartManager();
-    writeInstallRDFForExtension({
-      id: "addon12@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 12",
-    }, profileDir);
-    restartManager();
-
-    prepare_test({}, [
-      "onNewInstall",
-      "onDownloadStarted",
-      "onDownloadEnded"
-    ], continue_test_20);
-
-    AddonManagerPrivate.backgroundUpdateCheck();
-  });
-
-  let check_test_20;
-  continue_test_20 = (install) => {
-    Assert.notEqual(install.existingAddon, null);
-    Assert.equal(install.existingAddon.id, "addon12@tests.mozilla.org");
-
-    prepare_test({
-      "addon12@tests.mozilla.org": [
-        "onInstalling"
-      ]
-    }, [
-      "onInstallStarted",
-      "onInstallEnded",
-    ], callback_soon(check_test_20));
-  };
-
-  check_test_20 = (install) => {
-    Assert.equal(install.existingAddon.pendingUpgrade.install, install);
-
-    restartManager();
-    AddonManager.getAddonByID("addon12@tests.mozilla.org", function(a12) {
-      Assert.notEqual(a12, null);
-      Assert.equal(a12.version, "2.0");
-      Assert.equal(a12.type, "extension");
-      a12.uninstall();
-
-      executeSoon(() => {
-        restartManager();
-        run_next_test();
-      });
-    });
-  };
-
-  add_task(async function cleanup() {
-    let addons = await AddonManager.getAddonsByTypes(["extension"]);
-
-    for (let addon of addons)
-      addon.uninstall();
-
-    await promiseRestartManager();
-
-    shutdownManager();
-
-    await new Promise(executeSoon);
-  });
-}
+  await new Promise(executeSoon);
+});
 
 // Test that background update checks work for lightweight themes
 add_test(function run_test_7() {
   startupManager();
 
   LightweightThemeManager.currentTheme = {
     id: "1",
     version: "1",
@@ -1362,17 +1353,17 @@ add_test(async function run_test_locked_
   lockedDir.append("locked_extensions");
   registerDirectory("XREAppFeat", lockedDir);
 
   await promiseShutdownManager();
 
   writeInstallRDFToXPI({
     id: "addon13@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_update.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_update.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "0.1",
       maxVersion: "0.2"
     }],
     name: "Test Addon 13",
   }, lockedDir);
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
@@ -46,25 +46,25 @@ function makeCancelListener() {
 // Set up the HTTP server so that we can control when it responds
 var httpReceived = Promise.defer();
 function dataHandler(aRequest, aResponse) {
   aResponse.processAsync();
   httpReceived.resolve([aRequest, aResponse]);
 }
 var testserver = new HttpServer();
 testserver.registerDirectory("/addons/", do_get_file("addons"));
-testserver.registerPathHandler("/data/test_update.rdf", dataHandler);
+testserver.registerPathHandler("/data/test_update.json", dataHandler);
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
 
 // Set up an add-on for update check
 writeInstallRDFForExtension({
   id: "addon1@tests.mozilla.org",
   version: "1.0",
-  updateURL: "http://localhost:" + gPort + "/data/test_update.rdf",
+  updateURL: "http://localhost:" + gPort + "/data/test_update.json",
   targetApplications: [{
     id: "xpcshell@tests.mozilla.org",
     minVersion: "1",
     maxVersion: "1"
   }],
   name: "Test Addon 1",
 }, profileDir);
 
@@ -84,17 +84,17 @@ add_task(async function cancel_during_ch
   Assert.ok(a1.cancelUpdate());
 
   let updateResult = await listener.promise;
   Assert.equal(AddonManager.UPDATE_STATUS_CANCELLED, updateResult);
 
   // Now complete the HTTP request
   let file = do_get_cwd();
   file.append("data");
-  file.append("test_update.rdf");
+  file.append("test_update.json");
   let data = loadFile(file);
   response.write(data);
   response.finish();
 
   // trying to cancel again should return false, i.e. nothing to cancel
   Assert.ok(!a1.cancelUpdate());
 
   await true;
@@ -118,15 +118,15 @@ add_task(async function shutdown_during_
   shutdownManager();
 
   let updateResult = await listener.promise;
   Assert.equal(AddonManager.UPDATE_STATUS_CANCELLED, updateResult);
 
   // Now complete the HTTP request
   let file = do_get_cwd();
   file.append("data");
-  file.append("test_update.rdf");
+  file.append("test_update.json");
   let data = loadFile(file);
   response.write(data);
   response.finish();
 
   await testserver.stop(Promise.defer().resolve);
 });
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
@@ -8,69 +8,69 @@
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 
 ChromeUtils.import("resource://testing-common/httpd.js");
 var testserver = new HttpServer();
 testserver.start(-1);
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_updatecompatmode_ignore.rdf", testserver);
-mapFile("/data/test_updatecompatmode_normal.rdf", testserver);
-mapFile("/data/test_updatecompatmode_strict.rdf", testserver);
+mapFile("/data/test_updatecompatmode_ignore.json", testserver);
+mapFile("/data/test_updatecompatmode_normal.json", testserver);
+mapFile("/data/test_updatecompatmode_strict.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   writeInstallRDFForExtension({
     id: "compatmode-normal@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon - normal"
   }, profileDir);
 
   writeInstallRDFForExtension({
     id: "compatmode-strict@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon - strict"
   }, profileDir);
 
   writeInstallRDFForExtension({
     id: "compatmode-strict-optin@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon - strict opt-in",
     strictCompatibility: true
   }, profileDir);
 
   writeInstallRDFForExtension({
     id: "compatmode-ignore@tests.mozilla.org",
     version: "1.0",
-    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
+    updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.json",
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon - ignore",
   }, profileDir);
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_ignorecompat.js
@@ -8,103 +8,94 @@
 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
 
 // The test extension uses an insecure update url.
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
 
 var testserver = createHttpServer();
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_update.rdf", testserver);
 mapFile("/data/test_update.json", testserver);
 mapFile("/data/test_update_addons.json", testserver);
 mapFile("/data/test_update_compat.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
-let testParams = [
-  { updateFile: "test_update.rdf",
-    appId: "xpcshell@tests.mozilla.org" },
-  { updateFile: "test_update.json",
-    appId: "toolkit@mozilla.org" },
-];
+const updateFile = "test_update.json";
+const appId = "toolkit@mozilla.org";
 
-for (let test of testParams) {
-  let { updateFile, appId } = test;
+// Test that the update check correctly observes the
+// extensions.strictCompatibility pref and compatibility overrides.
+add_test(function() {
+  writeInstallRDFForExtension({
+    id: "addon9@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 9",
+  }, profileDir);
+
+  restartManager();
+
+  AddonManager.addInstallListener({
+    onNewInstall(aInstall) {
+      if (aInstall.existingAddon.id != "addon9@tests.mozilla.org")
+        do_throw("Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
+      Assert.equal(aInstall.version, "4.0");
+    },
+    onDownloadFailed(aInstall) {
+      run_next_test();
+    }
+  });
 
-  // Test that the update check correctly observes the
-  // extensions.strictCompatibility pref and compatibility overrides.
-  add_test(function() {
-    writeInstallRDFForExtension({
-      id: "addon9@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 9",
-    }, profileDir);
+  Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
+                             `http://localhost:${gPort}/data/test_update_addons.json`);
+  Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
+                             `http://localhost:${gPort}/data/test_update_compat.json`);
+  Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
+
+  AddonManagerInternal.backgroundUpdateCheck();
+});
 
-    restartManager();
+// Test that the update check correctly observes when an addon opts-in to
+// strict compatibility checking.
+add_test(function() {
+  writeInstallRDFForExtension({
+    id: "addon11@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 11",
+  }, profileDir);
 
-    AddonManager.addInstallListener({
-      onNewInstall(aInstall) {
-        if (aInstall.existingAddon.id != "addon9@tests.mozilla.org")
-          do_throw("Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
-        Assert.equal(aInstall.version, "4.0");
+  restartManager();
+
+  AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
+    Assert.notEqual(a11, null);
+
+    a11.findUpdates({
+      onCompatibilityUpdateAvailable() {
+        do_throw("Should not have seen compatibility information");
       },
-      onDownloadFailed(aInstall) {
+
+      onUpdateAvailable() {
+        do_throw("Should not have seen an available update");
+      },
+
+      onUpdateFinished() {
         run_next_test();
       }
-    });
-
-    Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
-                               `http://localhost:${gPort}/data/test_update_addons.json`);
-    Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
-                               `http://localhost:${gPort}/data/test_update_compat.json`);
-    Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
-
-    AddonManagerInternal.backgroundUpdateCheck();
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
   });
-
-  // Test that the update check correctly observes when an addon opts-in to
-  // strict compatibility checking.
-  add_test(function() {
-    writeInstallRDFForExtension({
-      id: "addon11@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 11",
-    }, profileDir);
-
-    restartManager();
-
-    AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
-      Assert.notEqual(a11, null);
-
-      a11.findUpdates({
-        onCompatibilityUpdateAvailable() {
-          do_throw("Should not have seen compatibility information");
-        },
-
-        onUpdateAvailable() {
-          do_throw("Should not have seen an available update");
-        },
-
-        onUpdateFinished() {
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-}
+});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_update_strictcompat.js
@@ -18,1028 +18,1019 @@ ChromeUtils.import("resource://gre/modul
 const PARAMS = "?%REQ_VERSION%/%ITEM_ID%/%ITEM_VERSION%/%ITEM_MAXAPPVERSION%/" +
                "%ITEM_STATUS%/%APP_ID%/%APP_VERSION%/%CURRENT_APP_VERSION%/" +
                "%APP_OS%/%APP_ABI%/%APP_LOCALE%/%UPDATE_TYPE%";
 
 var gInstallDate;
 
 var testserver = createHttpServer();
 gPort = testserver.identity.primaryPort;
-mapFile("/data/test_update.rdf", testserver);
 mapFile("/data/test_update.json", testserver);
 mapFile("/data/test_update_addons.json", testserver);
 mapFile("/data/test_update_compat.json", testserver);
 testserver.registerDirectory("/addons/", do_get_file("addons"));
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   Services.locale.setRequestedLocales(["fr-FR"]);
 
   run_next_test();
 }
 
-let testParams = [
-  { updateFile: "test_update.rdf",
-    appId: "xpcshell@tests.mozilla.org" },
-  { updateFile: "test_update.json",
-    appId: "toolkit@mozilla.org" },
-];
-
-for (let test of testParams) {
-  let { updateFile, appId } = test;
-
-  add_test(function() {
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-
-    writeInstallRDFForExtension({
-      id: "addon2@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }],
-      name: "Test Addon 2",
-    }, profileDir);
+const updateFile = "test_update.json";
+const appId = "toolkit@mozilla.org";
 
-    writeInstallRDFForExtension({
-      id: "addon3@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "5",
-        maxVersion: "5"
-      }],
-      name: "Test Addon 3",
-    }, profileDir);
-
-    startupManager();
-
-    run_next_test();
-  });
+add_test(function() {
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-  // Verify that an update is available and can be installed.
-  let check_test_1;
-  add_test(function run_test_1() {
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "1.0");
-      Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT);
-      Assert.equal(a1.releaseNotesURI, null);
-
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
-
-      prepare_test({
-        "addon1@tests.mozilla.org": [
-          ["onPropertyChanged", ["applyBackgroundUpdates"]]
-        ]
-      });
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-      check_test_completed();
+  writeInstallRDFForExtension({
+    id: "addon2@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }],
+    name: "Test Addon 2",
+  }, profileDir);
 
-      a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-
-      prepare_test({}, [
-        "onNewInstall",
-      ]);
-
-      a1.findUpdates({
-        onNoCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
-        },
-
-        onUpdateAvailable(addon, install) {
-          ensure_test_completed();
+  writeInstallRDFForExtension({
+    id: "addon3@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "5",
+      maxVersion: "5"
+    }],
+    name: "Test Addon 3",
+  }, profileDir);
 
-          AddonManager.getAllInstalls(function(aInstalls) {
-            Assert.equal(aInstalls.length, 1);
-            Assert.equal(aInstalls[0], install);
+  startupManager();
 
-            Assert.equal(addon, a1);
-            Assert.equal(install.name, addon.name);
-            Assert.equal(install.version, "2.0");
-            Assert.equal(install.state, AddonManager.STATE_AVAILABLE);
-            Assert.equal(install.existingAddon, addon);
-            Assert.equal(install.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
-
-            // Verify that another update check returns the same AddonInstall
-            a1.findUpdates({
-              onNoCompatibilityUpdateAvailable() {
-                ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
-              },
+  run_next_test();
+});
 
-              onUpdateAvailable(newAddon, newInstall) {
-                AddonManager.getAllInstalls(function(aInstalls2) {
-                  Assert.equal(aInstalls2.length, 1);
-                  Assert.equal(aInstalls2[0], install);
-                  Assert.equal(newAddon, addon);
-                  Assert.equal(newInstall, install);
+// Verify that an update is available and can be installed.
+let check_test_1;
+add_test(function run_test_1() {
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "1.0");
+    Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DEFAULT);
+    Assert.equal(a1.releaseNotesURI, null);
 
-                  prepare_test({}, [
-                    "onDownloadStarted",
-                    "onDownloadEnded",
-                  ], check_test_1);
-                  install.install();
-                });
-              },
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
 
-              onNoUpdateAvailable() {
-                ok(false, "Should not have seen onNoUpdateAvailable notification");
-              }
-            }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-          });
-        },
-
-        onNoUpdateAvailable(addon) {
-          ok(false, "Should not have seen onNoUpdateAvailable notification");
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+    prepare_test({
+      "addon1@tests.mozilla.org": [
+        ["onPropertyChanged", ["applyBackgroundUpdates"]]
+      ]
     });
-  });
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
+    check_test_completed();
 
-  let run_test_2;
-  check_test_1 = (install) => {
-    ensure_test_completed();
-    Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
-    run_test_2(install);
-    return false;
-  };
+    a1.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
 
-  // Continue installing the update.
-  let check_test_2;
-  run_test_2 = (install) => {
-    // Verify that another update check returns no new update
-    install.existingAddon.findUpdates({
+    prepare_test({}, [
+      "onNewInstall",
+    ]);
+
+    a1.findUpdates({
       onNoCompatibilityUpdateAvailable(addon) {
         ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
       },
 
-      onUpdateAvailable() {
-        ok(false, "Should find no available update when one is already downloading");
-      },
+      onUpdateAvailable(addon, install) {
+        ensure_test_completed();
 
-      onNoUpdateAvailable(addon) {
         AddonManager.getAllInstalls(function(aInstalls) {
           Assert.equal(aInstalls.length, 1);
           Assert.equal(aInstalls[0], install);
 
-          prepare_test({
-            "addon1@tests.mozilla.org": [
-              "onInstalling"
-            ]
-          }, [
-            "onInstallStarted",
-            "onInstallEnded",
-          ], check_test_2);
-          install.install();
+          Assert.equal(addon, a1);
+          Assert.equal(install.name, addon.name);
+          Assert.equal(install.version, "2.0");
+          Assert.equal(install.state, AddonManager.STATE_AVAILABLE);
+          Assert.equal(install.existingAddon, addon);
+          Assert.equal(install.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+
+          // Verify that another update check returns the same AddonInstall
+          a1.findUpdates({
+            onNoCompatibilityUpdateAvailable() {
+              ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
+            },
+
+            onUpdateAvailable(newAddon, newInstall) {
+              AddonManager.getAllInstalls(function(aInstalls2) {
+                Assert.equal(aInstalls2.length, 1);
+                Assert.equal(aInstalls2[0], install);
+                Assert.equal(newAddon, addon);
+                Assert.equal(newInstall, install);
+
+                prepare_test({}, [
+                  "onDownloadStarted",
+                  "onDownloadEnded",
+                ], check_test_1);
+                install.install();
+              });
+            },
+
+            onNoUpdateAvailable() {
+              ok(false, "Should not have seen onNoUpdateAvailable notification");
+            }
+          }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
         });
+      },
+
+      onNoUpdateAvailable(addon) {
+        ok(false, "Should not have seen onNoUpdateAvailable notification");
       }
     }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-  };
-
-  check_test_2 = () => {
-    ensure_test_completed();
-
-    AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(olda1) {
-      await AddonTestUtils.loadAddonsList(true);
-
-      Assert.notEqual(olda1, null);
-      Assert.equal(olda1.version, "1.0");
-      Assert.ok(isExtensionInAddonsList(profileDir, olda1.id));
-
-      shutdownManager();
-
-      await promiseStartupManager();
-
-      Assert.ok(isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org"));
+  });
+});
 
-      AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
-        Assert.notEqual(a1, null);
-        Assert.equal(a1.version, "2.0");
-        Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
-        Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE);
-        Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
-
-        a1.uninstall();
-        run_next_test();
-      });
-    }));
-  };
-
-
-  // Check that an update check finds compatibility updates and applies them
-  let check_test_3;
-  add_test(function run_test_3() {
-    restartManager();
-
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-      Assert.notEqual(a2, null);
-      Assert.ok(!a2.isActive);
-      Assert.ok(!a2.isCompatible);
-      Assert.ok(a2.appDisabled);
-      Assert.ok(a2.isCompatibleWith("0", "0"));
+let run_test_2;
+check_test_1 = (install) => {
+  ensure_test_completed();
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOADED);
+  run_test_2(install);
+  return false;
+};
 
-      a2.findUpdates({
-        onCompatibilityUpdateAvailable(addon) {
-          Assert.ok(a2.isCompatible);
-          Assert.ok(!a2.appDisabled);
-          Assert.ok(!a2.isActive);
-        },
-
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onNoUpdateAvailable(addon) {
-          Assert.equal(addon, a2);
-          executeSoon(check_test_3);
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-
-  check_test_3 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
-      Assert.notEqual(a2, null);
-      Assert.ok(a2.isActive);
-      Assert.ok(a2.isCompatible);
-      Assert.ok(!a2.appDisabled);
-      a2.uninstall();
+// Continue installing the update.
+let check_test_2;
+run_test_2 = (install) => {
+  // Verify that another update check returns no new update
+  install.existingAddon.findUpdates({
+    onNoCompatibilityUpdateAvailable(addon) {
+      ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
+    },
 
-      run_next_test();
-    });
-  };
-
-  // Checks that we see no compatibility information when there is none.
-  add_test(function run_test_4() {
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
-      Assert.ok(a3.isCompatibleWith("5", "5"));
-      Assert.ok(!a3.isCompatibleWith("2", "2"));
+    onUpdateAvailable() {
+      ok(false, "Should find no available update when one is already downloading");
+    },
 
-      a3.findUpdates({
-        sawUpdate: false,
-        onCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should not have seen compatibility information");
-        },
-
-        onNoCompatibilityUpdateAvailable(addon) {
-          this.sawUpdate = true;
-        },
-
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
+    onNoUpdateAvailable(addon) {
+      AddonManager.getAllInstalls(function(aInstalls) {
+        Assert.equal(aInstalls.length, 1);
+        Assert.equal(aInstalls[0], install);
 
-        onNoUpdateAvailable(addon) {
-          Assert.ok(this.sawUpdate);
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
-  });
-
-  // Checks that compatibility info for future apps are detected but don't make
-  // the item compatibile.
-  let check_test_5;
-  add_test(function run_test_5() {
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
-      Assert.ok(a3.isCompatibleWith("5", "5"));
-      Assert.ok(!a3.isCompatibleWith("2", "2"));
-
-      a3.findUpdates({
-        sawUpdate: false,
-        onCompatibilityUpdateAvailable(addon) {
-          Assert.ok(!a3.isCompatible);
-          Assert.ok(a3.appDisabled);
-          Assert.ok(!a3.isActive);
-          this.sawUpdate = true;
-        },
-
-        onNoCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should have seen some compatibility information");
-        },
-
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onNoUpdateAvailable(addon) {
-          Assert.ok(this.sawUpdate);
-          executeSoon(check_test_5);
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED, "3.0", "3.0");
-    });
-  });
+        prepare_test({
+          "addon1@tests.mozilla.org": [
+            "onInstalling"
+          ]
+        }, [
+          "onInstallStarted",
+          "onInstallEnded",
+        ], check_test_2);
+        install.install();
+      });
+    }
+  }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+};
 
-  check_test_5 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
+check_test_2 = () => {
+  ensure_test_completed();
 
-      a3.uninstall();
-      run_next_test();
-    });
-  };
-
-  // Test that background update checks work
-  let continue_test_6;
-  add_test(function run_test_6() {
-    restartManager();
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(olda1) {
+    await AddonTestUtils.loadAddonsList(true);
 
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-    restartManager();
-
-    prepare_test({}, [
-      "onNewInstall",
-      "onDownloadStarted",
-      "onDownloadEnded"
-    ], continue_test_6);
+    Assert.notEqual(olda1, null);
+    Assert.equal(olda1.version, "1.0");
+    Assert.ok(isExtensionInAddonsList(profileDir, olda1.id));
 
-    AddonManagerInternal.backgroundUpdateCheck();
-  });
-
-  let check_test_6;
-  continue_test_6 = (install) => {
-    Assert.notEqual(install.existingAddon, null);
-    Assert.equal(install.existingAddon.id, "addon1@tests.mozilla.org");
+    shutdownManager();
 
-    prepare_test({
-      "addon1@tests.mozilla.org": [
-        "onInstalling"
-      ]
-    }, [
-      "onInstallStarted",
-      "onInstallEnded",
-    ], callback_soon(check_test_6));
-  };
+    await promiseStartupManager();
 
-  check_test_6 = (install) => {
-    Assert.equal(install.existingAddon.pendingUpgrade.install, install);
+    Assert.ok(isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org"));
 
-    restartManager();
     AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
       Assert.notEqual(a1, null);
       Assert.equal(a1.version, "2.0");
+      Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
+      Assert.equal(a1.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE);
       Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+
       a1.uninstall();
       run_next_test();
     });
-  };
+  }));
+};
+
 
-  // Verify the parameter escaping in update urls.
-  add_test(function run_test_8() {
-    restartManager();
+// Check that an update check finds compatibility updates and applies them
+let check_test_3;
+add_test(function run_test_3() {
+  restartManager();
 
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "5.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "2"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
+    Assert.notEqual(a2, null);
+    Assert.ok(!a2.isActive);
+    Assert.ok(!a2.isCompatible);
+    Assert.ok(a2.appDisabled);
+    Assert.ok(a2.isCompatibleWith("0", "0"));
+
+    a2.findUpdates({
+      onCompatibilityUpdateAvailable(addon) {
+        Assert.ok(a2.isCompatible);
+        Assert.ok(!a2.appDisabled);
+        Assert.ok(!a2.isActive);
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon2@tests.mozilla.org",
-      version: "67.0.5b1",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: "toolkit@mozilla.org",
-        minVersion: "0",
-        maxVersion: "3"
-      }],
-      name: "Test Addon 2",
-    }, profileDir);
+      onNoUpdateAvailable(addon) {
+        Assert.equal(addon, a2);
+        executeSoon(check_test_3);
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+check_test_3 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
+    Assert.notEqual(a2, null);
+    Assert.ok(a2.isActive);
+    Assert.ok(a2.isCompatible);
+    Assert.ok(!a2.appDisabled);
+    a2.uninstall();
 
-    writeInstallRDFForExtension({
-      id: "addon3@tests.mozilla.org",
-      version: "1.3+",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }, {
-        id: "toolkit@mozilla.org",
-        minVersion: "0",
-        maxVersion: "3"
-      }],
-      name: "Test Addon 3",
-    }, profileDir);
+    run_next_test();
+  });
+};
+
+// Checks that we see no compatibility information when there is none.
+add_test(function run_test_4() {
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
+    Assert.ok(a3.isCompatibleWith("5", "5"));
+    Assert.ok(!a3.isCompatibleWith("2", "2"));
+
+    a3.findUpdates({
+      sawUpdate: false,
+      onCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should not have seen compatibility information");
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon4@tests.mozilla.org",
-      version: "0.5ab6",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "5"
-      }],
-      name: "Test Addon 4",
-    }, profileDir);
+      onNoCompatibilityUpdateAvailable(addon) {
+        this.sawUpdate = true;
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
 
-    writeInstallRDFForExtension({
-      id: "addon5@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 5",
-    }, profileDir);
+      onNoUpdateAvailable(addon) {
+        Assert.ok(this.sawUpdate);
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+  });
+});
+
+// Checks that compatibility info for future apps are detected but don't make
+// the item compatibile.
+let check_test_5;
+add_test(function run_test_5() {
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
+    Assert.ok(a3.isCompatibleWith("5", "5"));
+    Assert.ok(!a3.isCompatibleWith("2", "2"));
 
-    writeInstallRDFForExtension({
-      id: "addon6@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/param_test.rdf" + PARAMS,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 6",
-    }, profileDir);
+    a3.findUpdates({
+      sawUpdate: false,
+      onCompatibilityUpdateAvailable(addon) {
+        Assert.ok(!a3.isCompatible);
+        Assert.ok(a3.appDisabled);
+        Assert.ok(!a3.isActive);
+        this.sawUpdate = true;
+      },
 
-    restartManager();
+      onNoCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should have seen some compatibility information");
+      },
+
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
 
-    AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(function(a2) {
-      a2.userDisabled = true;
-      restartManager();
+      onNoUpdateAvailable(addon) {
+        Assert.ok(this.sawUpdate);
+        executeSoon(check_test_5);
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED, "3.0", "3.0");
+  });
+});
 
-      testserver.registerPathHandler("/data/param_test.rdf", function(request, response) {
-        Assert.notEqual(request.queryString, "");
-        let [req_version, item_id, item_version,
-             item_maxappversion, item_status,
-             app_id, app_version, current_app_version,
-             app_os, app_abi, app_locale, update_type] =
-             request.queryString.split("/").map(a => decodeURIComponent(a));
+check_test_5 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) {
+    Assert.notEqual(a3, null);
+    Assert.ok(!a3.isActive);
+    Assert.ok(!a3.isCompatible);
+    Assert.ok(a3.appDisabled);
 
-        Assert.equal(req_version, "2");
+    a3.uninstall();
+    run_next_test();
+  });
+};
+
+// Test that background update checks work
+let continue_test_6;
+add_test(function run_test_6() {
+  restartManager();
 
-        switch (item_id) {
-        case "addon1@tests.mozilla.org":
-          Assert.equal(item_version, "5.0");
-          Assert.equal(item_maxappversion, "2");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "97");
-          break;
-        case "addon2@tests.mozilla.org":
-          Assert.equal(item_version, "67.0.5b1");
-          Assert.equal(item_maxappversion, "3");
-          Assert.equal(item_status, "userDisabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "49");
-          break;
-        case "addon3@tests.mozilla.org":
-          Assert.equal(item_version, "1.3+");
-          Assert.equal(item_maxappversion, "0");
-          Assert.equal(item_status, "userEnabled,incompatible");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "112");
-          break;
-        case "addon4@tests.mozilla.org":
-          Assert.equal(item_version, "0.5ab6");
-          Assert.equal(item_maxappversion, "5");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "2");
-          Assert.equal(update_type, "98");
-          break;
-        case "addon5@tests.mozilla.org":
-          Assert.equal(item_version, "1.0");
-          Assert.equal(item_maxappversion, "1");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "35");
-          break;
-        case "addon6@tests.mozilla.org":
-          Assert.equal(item_version, "1.0");
-          Assert.equal(item_maxappversion, "1");
-          Assert.equal(item_status, "userEnabled");
-          Assert.equal(app_version, "1");
-          Assert.equal(update_type, "99");
-          break;
-        default:
-          ok(false, "Update request for unexpected add-on " + item_id);
-        }
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
+  restartManager();
+
+  prepare_test({}, [
+    "onNewInstall",
+    "onDownloadStarted",
+    "onDownloadEnded"
+  ], continue_test_6);
+
+  AddonManagerInternal.backgroundUpdateCheck();
+});
+
+let check_test_6;
+continue_test_6 = (install) => {
+  Assert.notEqual(install.existingAddon, null);
+  Assert.equal(install.existingAddon.id, "addon1@tests.mozilla.org");
 
-        Assert.equal(app_id, "xpcshell@tests.mozilla.org");
-        Assert.equal(current_app_version, "1");
-        Assert.equal(app_os, "XPCShell");
-        Assert.equal(app_abi, "noarch-spidermonkey");
-        Assert.equal(app_locale, "fr-FR");
-
-        request.setStatusLine(null, 500, "Server Error");
-      });
+  prepare_test({
+    "addon1@tests.mozilla.org": [
+      "onInstalling"
+    ]
+  }, [
+    "onInstallStarted",
+    "onInstallEnded",
+  ], callback_soon(check_test_6));
+};
 
-      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"],
-                                   function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
-        let count = 6;
+check_test_6 = (install) => {
+  Assert.equal(install.existingAddon.pendingUpgrade.install, install);
 
-        function next_test() {
-          a1_2.uninstall();
-          a2_2.uninstall();
-          a3_2.uninstall();
-          a4_2.uninstall();
-          a5_2.uninstall();
-          a6_2.uninstall();
+  restartManager();
+  AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    Assert.equal(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
+    a1.uninstall();
+    run_next_test();
+  });
+};
 
-          restartManager();
-          run_next_test();
-        }
+// Verify the parameter escaping in update urls.
+add_test(function run_test_8() {
+  restartManager();
 
-        let compatListener = {
-          onUpdateFinished(addon, error) {
-            if (--count == 0)
-              executeSoon(next_test);
-          }
-        };
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "5.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "2"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-        let updateListener = {
-          onUpdateAvailable(addon, update) {
-            // Dummy so the update checker knows we care about new versions
-          },
-
-          onUpdateFinished(addon, error) {
-            if (--count == 0)
-              executeSoon(next_test);
-          }
-        };
-
-        a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-        a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
-        a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
-        a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
-        a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-        a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-      });
-    }));
-  });
+  writeInstallRDFForExtension({
+    id: "addon2@tests.mozilla.org",
+    version: "67.0.5b1",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: "toolkit@mozilla.org",
+      minVersion: "0",
+      maxVersion: "3"
+    }],
+    name: "Test Addon 2",
+  }, profileDir);
 
-  // Tests that if an install.rdf claims compatibility then the add-on will be
-  // seen as compatible regardless of what the update.rdf says.
-  add_test(function run_test_9() {
-    writeInstallRDFForExtension({
-      id: "addon4@tests.mozilla.org",
-      version: "5.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-
-    restartManager();
-
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      Assert.ok(a4.isActive, "addon4 is active");
-      Assert.ok(a4.isCompatible, "addon4 is compatible");
-
-      run_next_test();
-    });
-  });
+  writeInstallRDFForExtension({
+    id: "addon3@tests.mozilla.org",
+    version: "1.3+",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }, {
+      id: "toolkit@mozilla.org",
+      minVersion: "0",
+      maxVersion: "3"
+    }],
+    name: "Test Addon 3",
+  }, profileDir);
 
-  // Tests that a normal update check won't decrease a targetApplication's
-  // maxVersion.
-  add_test(function run_test_10() {
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      a4.findUpdates({
-        onUpdateFinished(addon) {
-          Assert.ok(addon.isCompatible, "addon4 is compatible");
-
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
-    });
-  });
-
-  // Tests that an update check for a new application will decrease a
-  // targetApplication's maxVersion.
-  add_test(function run_test_11() {
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      a4.findUpdates({
-        onUpdateFinished(addon) {
-          Assert.ok(!addon.isCompatible, "addon4 is compatible");
+  writeInstallRDFForExtension({
+    id: "addon4@tests.mozilla.org",
+    version: "0.5ab6",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "5"
+    }],
+    name: "Test Addon 4",
+  }, profileDir);
 
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
-    });
-  });
-
-  // Check that the decreased maxVersion applied and disables the add-on
-  add_test(function run_test_12() {
-    restartManager();
+  writeInstallRDFForExtension({
+    id: "addon5@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 5",
+  }, profileDir);
 
-    AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
-      Assert.ok(!a4.isActive, "addon4 is active");
-      Assert.ok(!a4.isCompatible, "addon4 is compatible");
+  writeInstallRDFForExtension({
+    id: "addon6@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/param_test.json" + PARAMS,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 6",
+  }, profileDir);
 
-      a4.uninstall();
-      run_next_test();
-    });
-  });
+  restartManager();
 
-  // Tests that no compatibility update is passed to the listener when there is
-  // compatibility info for the current version of the app but not for the
-  // version of the app that the caller requested an update check for.
-  let check_test_13;
-  add_test(function run_test_13() {
+  AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(function(a2) {
+    a2.userDisabled = true;
     restartManager();
 
-    // Not initially compatible but the update check will make it compatible
-    writeInstallRDFForExtension({
-      id: "addon7@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0",
-        maxVersion: "0"
-      }],
-      name: "Test Addon 7",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
-      Assert.notEqual(a7, null);
-      Assert.ok(!a7.isActive);
-      Assert.ok(!a7.isCompatible);
-      Assert.ok(a7.appDisabled);
-      Assert.ok(a7.isCompatibleWith("0", "0"));
-
-      a7.findUpdates({
-        sawUpdate: false,
-        onCompatibilityUpdateAvailable(addon) {
-          ok(false, "Should not have seen compatibility information");
-        },
+    testserver.registerPathHandler("/data/param_test.json", function(request, response) {
+      Assert.notEqual(request.queryString, "");
+      let [req_version, item_id, item_version,
+           item_maxappversion, item_status,
+           app_id, app_version, current_app_version,
+           app_os, app_abi, app_locale, update_type] =
+           request.queryString.split("/").map(a => decodeURIComponent(a));
 
-        onUpdateAvailable(addon, install) {
-          ok(false, "Should not have seen an available update");
-        },
-
-        onUpdateFinished(addon) {
-          Assert.ok(addon.isCompatible);
-          executeSoon(check_test_13);
-        }
-      }, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "3.0", "3.0");
-    });
-  });
-
-  check_test_13 = () => {
-    restartManager();
-    AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
-      Assert.notEqual(a7, null);
-      Assert.ok(a7.isActive);
-      Assert.ok(a7.isCompatible);
-      Assert.ok(!a7.appDisabled);
-
-      a7.uninstall();
-      run_next_test();
-    });
-  };
-
-  // Test that background update checks doesn't update an add-on that isn't
-  // allowed to update automatically.
-  let check_test_14;
-  add_test(function run_test_14() {
-    restartManager();
+      Assert.equal(req_version, "2");
 
-    // Have an add-on there that will be updated so we see some events from it
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
-
-    writeInstallRDFForExtension({
-      id: "addon8@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 8",
-    }, profileDir);
-    restartManager();
-
-    AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
-      a8.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
+      switch (item_id) {
+      case "addon1@tests.mozilla.org":
+        Assert.equal(item_version, "5.0");
+        Assert.equal(item_maxappversion, "2");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "97");
+        break;
+      case "addon2@tests.mozilla.org":
+        Assert.equal(item_version, "67.0.5b1");
+        Assert.equal(item_maxappversion, "3");
+        Assert.equal(item_status, "userDisabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "49");
+        break;
+      case "addon3@tests.mozilla.org":
+        Assert.equal(item_version, "1.3+");
+        Assert.equal(item_maxappversion, "0");
+        Assert.equal(item_status, "userEnabled,incompatible");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "112");
+        break;
+      case "addon4@tests.mozilla.org":
+        Assert.equal(item_version, "0.5ab6");
+        Assert.equal(item_maxappversion, "5");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "2");
+        Assert.equal(update_type, "98");
+        break;
+      case "addon5@tests.mozilla.org":
+        Assert.equal(item_version, "1.0");
+        Assert.equal(item_maxappversion, "1");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "35");
+        break;
+      case "addon6@tests.mozilla.org":
+        Assert.equal(item_version, "1.0");
+        Assert.equal(item_maxappversion, "1");
+        Assert.equal(item_status, "userEnabled");
+        Assert.equal(app_version, "1");
+        Assert.equal(update_type, "99");
+        break;
+      default:
+        ok(false, "Update request for unexpected add-on " + item_id);
+      }
 
-      // The background update check will find updates for both add-ons but only
-      // proceed to install one of them.
-      AddonManager.addInstallListener({
-        onNewInstall(aInstall) {
-          let id = aInstall.existingAddon.id;
-          ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
-             "Saw unexpected onNewInstall for " + id);
-        },
+      Assert.equal(app_id, "xpcshell@tests.mozilla.org");
+      Assert.equal(current_app_version, "1");
+      Assert.equal(app_os, "XPCShell");
+      Assert.equal(app_abi, "noarch-spidermonkey");
+      Assert.equal(app_locale, "fr-FR");
+
+      request.setStatusLine(null, 500, "Server Error");
+    });
 
-        onDownloadStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
+    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"],
+                                 function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
+      let count = 6;
 
-        onDownloadFailed(aInstall) {
-          ok(false, "Should not have seen onDownloadFailed event");
-        },
-
-        onDownloadCancelled(aInstall) {
-          ok(false, "Should not have seen onDownloadCancelled event");
-        },
+      function next_test() {
+        a1_2.uninstall();
+        a2_2.uninstall();
+        a3_2.uninstall();
+        a4_2.uninstall();
+        a5_2.uninstall();
+        a6_2.uninstall();
 
-        onInstallStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
+        restartManager();
+        run_next_test();
+      }
 
-        onInstallEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-          Assert.equal(aInstall.existingAddon.pendingUpgrade.install, aInstall);
+      let compatListener = {
+        onUpdateFinished(addon, error) {
+          if (--count == 0)
+            executeSoon(next_test);
+        }
+      };
 
-          executeSoon(check_test_14);
-        },
-
-        onInstallFailed(aInstall) {
-          ok(false, "Should not have seen onInstallFailed event");
+      let updateListener = {
+        onUpdateAvailable(addon, update) {
+          // Dummy so the update checker knows we care about new versions
         },
 
-        onInstallCancelled(aInstall) {
-          ok(false, "Should not have seen onInstallCancelled event");
-        },
-      });
+        onUpdateFinished(addon, error) {
+          if (--count == 0)
+            executeSoon(next_test);
+        }
+      };
 
-      AddonManagerInternal.backgroundUpdateCheck();
+      a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
+      a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
+      a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
+      a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
+      a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+      a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
     });
-  });
+  }));
+});
 
-  check_test_14 = () => {
-    restartManager();
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon8@tests.mozilla.org"], function([a1, a8]) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      a1.uninstall();
+// Tests that if an install.rdf claims compatibility then the add-on will be
+// seen as compatible regardless of what the update.json says.
+add_test(function run_test_9() {
+  writeInstallRDFForExtension({
+    id: "addon4@tests.mozilla.org",
+    version: "5.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-      Assert.notEqual(a8, null);
-      Assert.equal(a8.version, "1.0");
-      a8.uninstall();
+  restartManager();
 
-      run_next_test();
-    });
-  };
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    Assert.ok(a4.isActive, "addon4 is active");
+    Assert.ok(a4.isCompatible, "addon4 is compatible");
 
-  // Test that background update checks doesn't update an add-on that is
-  // pending uninstall
-  let check_test_15;
-  add_test(function run_test_15() {
-    restartManager();
+    run_next_test();
+  });
+});
 
-    // Have an add-on there that will be updated so we see some events from it
-    writeInstallRDFForExtension({
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 1",
-    }, profileDir);
+// Tests that a normal update check won't decrease a targetApplication's
+// maxVersion.
+add_test(function run_test_10() {
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    a4.findUpdates({
+      onUpdateFinished(addon) {
+        Assert.ok(addon.isCompatible, "addon4 is compatible");
+
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
+  });
+});
+
+// Tests that an update check for a new application will decrease a
+// targetApplication's maxVersion.
+add_test(function run_test_11() {
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    a4.findUpdates({
+      onUpdateFinished(addon) {
+        Assert.ok(!addon.isCompatible, "addon4 is compatible");
 
-    writeInstallRDFForExtension({
-      id: "addon8@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "1",
-        maxVersion: "1"
-      }],
-      name: "Test Addon 8",
-    }, profileDir);
-    restartManager();
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
+  });
+});
+
+// Check that the decreased maxVersion applied and disables the add-on
+add_test(function run_test_12() {
+  restartManager();
 
-    AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
-      a8.uninstall();
-      Assert.ok(!hasFlag(a8.permissions, AddonManager.PERM_CAN_UPGRADE));
+  AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) {
+    Assert.ok(!a4.isActive, "addon4 is active");
+    Assert.ok(!a4.isCompatible, "addon4 is compatible");
 
-      // The background update check will find updates for both add-ons but only
-      // proceed to install one of them.
-      AddonManager.addInstallListener({
-        onNewInstall(aInstall) {
-          let id = aInstall.existingAddon.id;
-          ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
-             "Saw unexpected onNewInstall for " + id);
-        },
+    a4.uninstall();
+    run_next_test();
+  });
+});
+
+// Tests that no compatibility update is passed to the listener when there is
+// compatibility info for the current version of the app but not for the
+// version of the app that the caller requested an update check for.
+let check_test_13;
+add_test(function run_test_13() {
+  restartManager();
 
-        onDownloadStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onDownloadFailed(aInstall) {
-          ok(false, "Should not have seen onDownloadFailed event");
-        },
-
-        onDownloadCancelled(aInstall) {
-          ok(false, "Should not have seen onDownloadCancelled event");
-        },
+  // Not initially compatible but the update check will make it compatible
+  writeInstallRDFForExtension({
+    id: "addon7@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0",
+      maxVersion: "0"
+    }],
+    name: "Test Addon 7",
+  }, profileDir);
+  restartManager();
 
-        onInstallStarted(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-        },
-
-        onInstallEnded(aInstall) {
-          Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
-          executeSoon(check_test_15);
-        },
+  AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
+    Assert.notEqual(a7, null);
+    Assert.ok(!a7.isActive);
+    Assert.ok(!a7.isCompatible);
+    Assert.ok(a7.appDisabled);
+    Assert.ok(a7.isCompatibleWith("0", "0"));
 
-        onInstallFailed(aInstall) {
-          ok(false, "Should not have seen onInstallFailed event");
-        },
+    a7.findUpdates({
+      sawUpdate: false,
+      onCompatibilityUpdateAvailable(addon) {
+        ok(false, "Should not have seen compatibility information");
+      },
 
-        onInstallCancelled(aInstall) {
-          ok(false, "Should not have seen onInstallCancelled event");
-        },
-      });
+      onUpdateAvailable(addon, install) {
+        ok(false, "Should not have seen an available update");
+      },
+
+      onUpdateFinished(addon) {
+        Assert.ok(addon.isCompatible);
+        executeSoon(check_test_13);
+      }
+    }, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "3.0", "3.0");
+  });
+});
 
-      AddonManagerInternal.backgroundUpdateCheck();
-    });
-  });
+check_test_13 = () => {
+  restartManager();
+  AddonManager.getAddonByID("addon7@tests.mozilla.org", function(a7) {
+    Assert.notEqual(a7, null);
+    Assert.ok(a7.isActive);
+    Assert.ok(a7.isCompatible);
+    Assert.ok(!a7.appDisabled);
 
-  check_test_15 = () => {
-    restartManager();
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon8@tests.mozilla.org"], function([a1, a8]) {
-      Assert.notEqual(a1, null);
-      Assert.equal(a1.version, "2.0");
-      a1.uninstall();
+    a7.uninstall();
+    run_next_test();
+  });
+};
 
-      Assert.equal(a8, null);
-
-      run_next_test();
-    });
-  };
+// Test that background update checks doesn't update an add-on that isn't
+// allowed to update automatically.
+let check_test_14;
+add_test(function run_test_14() {
+  restartManager();
 
-  // Test that the update check correctly observes the
-  // extensions.strictCompatibility pref and compatibility overrides.
-  add_test(function run_test_17() {
-    restartManager();
+  // Have an add-on there that will be updated so we see some events from it
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
 
-    writeInstallRDFForExtension({
-      id: "addon9@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 9",
-    }, profileDir);
-    restartManager();
+  writeInstallRDFForExtension({
+    id: "addon8@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 8",
+  }, profileDir);
+  restartManager();
 
+  AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
+    a8.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
+
+    // The background update check will find updates for both add-ons but only
+    // proceed to install one of them.
     AddonManager.addInstallListener({
       onNewInstall(aInstall) {
-        equal(aInstall.existingAddon.id, "addon9@tests.mozilla.org",
-              "Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
-        Assert.equal(aInstall.version, "2.0");
+        let id = aInstall.existingAddon.id;
+        ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
+           "Saw unexpected onNewInstall for " + id);
       },
+
+      onDownloadStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onDownloadEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
       onDownloadFailed(aInstall) {
-        AddonManager.getAddonByID("addon9@tests.mozilla.org", function(a9) {
-          a9.uninstall();
-          run_next_test();
-        });
-      }
+        ok(false, "Should not have seen onDownloadFailed event");
+      },
+
+      onDownloadCancelled(aInstall) {
+        ok(false, "Should not have seen onDownloadCancelled event");
+      },
+
+      onInstallStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onInstallEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+        Assert.equal(aInstall.existingAddon.pendingUpgrade.install, aInstall);
+
+        executeSoon(check_test_14);
+      },
+
+      onInstallFailed(aInstall) {
+        ok(false, "Should not have seen onInstallFailed event");
+      },
+
+      onInstallCancelled(aInstall) {
+        ok(false, "Should not have seen onInstallCancelled event");
+      },
     });
 
-    Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
-                               `http://localhost:${gPort}/data/test_update_addons.json`);
-    Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
-                               `http://localhost:${gPort}/data/test_update_compat.json`);
-    Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
-
     AddonManagerInternal.backgroundUpdateCheck();
   });
+});
 
-  // Test that the update check correctly observes when an addon opts-in to
-  // strict compatibility checking.
-  add_test(function run_test_19() {
-    restartManager();
-    writeInstallRDFForExtension({
-      id: "addon11@tests.mozilla.org",
-      version: "1.0",
-      updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
-      targetApplications: [{
-        id: appId,
-        minVersion: "0.1",
-        maxVersion: "0.2"
-      }],
-      name: "Test Addon 11",
-    }, profileDir);
-    restartManager();
+check_test_14 = () => {
+  restartManager();
+  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                               "addon8@tests.mozilla.org"], function([a1, a8]) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    a1.uninstall();
+
+    Assert.notEqual(a8, null);
+    Assert.equal(a8.version, "1.0");
+    a8.uninstall();
+
+    run_next_test();
+  });
+};
+
+// Test that background update checks doesn't update an add-on that is
+// pending uninstall
+let check_test_15;
+add_test(function run_test_15() {
+  restartManager();
+
+  // Have an add-on there that will be updated so we see some events from it
+  writeInstallRDFForExtension({
+    id: "addon1@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 1",
+  }, profileDir);
+
+  writeInstallRDFForExtension({
+    id: "addon8@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "1",
+      maxVersion: "1"
+    }],
+    name: "Test Addon 8",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon8@tests.mozilla.org", function(a8) {
+    a8.uninstall();
+    Assert.ok(!hasFlag(a8.permissions, AddonManager.PERM_CAN_UPGRADE));
+
+    // The background update check will find updates for both add-ons but only
+    // proceed to install one of them.
+    AddonManager.addInstallListener({
+      onNewInstall(aInstall) {
+        let id = aInstall.existingAddon.id;
+        ok((id == "addon1@tests.mozilla.org" || id == "addon8@tests.mozilla.org"),
+           "Saw unexpected onNewInstall for " + id);
+      },
+
+      onDownloadStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
+
+      onDownloadEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
 
-    AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
-      Assert.notEqual(a11, null);
+      onDownloadFailed(aInstall) {
+        ok(false, "Should not have seen onDownloadFailed event");
+      },
+
+      onDownloadCancelled(aInstall) {
+        ok(false, "Should not have seen onDownloadCancelled event");
+      },
+
+      onInstallStarted(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+      },
 
-      a11.findUpdates({
-        onCompatibilityUpdateAvailable() {
-          ok(false, "Should have not have seen compatibility information");
-        },
+      onInstallEnded(aInstall) {
+        Assert.equal(aInstall.existingAddon.id, "addon1@tests.mozilla.org");
+        executeSoon(check_test_15);
+      },
+
+      onInstallFailed(aInstall) {
+        ok(false, "Should not have seen onInstallFailed event");
+      },
+
+      onInstallCancelled(aInstall) {
+        ok(false, "Should not have seen onInstallCancelled event");
+      },
+    });
+
+    AddonManagerInternal.backgroundUpdateCheck();
+  });
+});
 
-        onUpdateAvailable() {
-          ok(false, "Should not have seen an available update");
-        },
+check_test_15 = () => {
+  restartManager();
+  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
+                               "addon8@tests.mozilla.org"], function([a1, a8]) {
+    Assert.notEqual(a1, null);
+    Assert.equal(a1.version, "2.0");
+    a1.uninstall();
+
+    Assert.equal(a8, null);
+
+    run_next_test();
+  });
+};
+
+// Test that the update check correctly observes the
+// extensions.strictCompatibility pref and compatibility overrides.
+add_test(function run_test_17() {
+  restartManager();
 
-        onUpdateFinished() {
-          run_next_test();
-        }
-      }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
-    });
+  writeInstallRDFForExtension({
+    id: "addon9@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 9",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.addInstallListener({
+    onNewInstall(aInstall) {
+      equal(aInstall.existingAddon.id, "addon9@tests.mozilla.org",
+            "Saw unexpected onNewInstall for " + aInstall.existingAddon.id);
+      Assert.equal(aInstall.version, "2.0");
+    },
+    onDownloadFailed(aInstall) {
+      AddonManager.getAddonByID("addon9@tests.mozilla.org", function(a9) {
+        a9.uninstall();
+        run_next_test();
+      });
+    }
   });
 
-  add_task(async function cleanup() {
-    let addons = await AddonManager.getAddonsByTypes(["extension"]);
+  Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
+                             `http://localhost:${gPort}/data/test_update_addons.json`);
+  Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
+                             `http://localhost:${gPort}/data/test_update_compat.json`);
+  Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
+
+  AddonManagerInternal.backgroundUpdateCheck();
+});
 
-    for (let addon of addons)
-      addon.uninstall();
+// Test that the update check correctly observes when an addon opts-in to
+// strict compatibility checking.
+add_test(function run_test_19() {
+  restartManager();
+  writeInstallRDFForExtension({
+    id: "addon11@tests.mozilla.org",
+    version: "1.0",
+    updateURL: "http://localhost:" + gPort + "/data/" + updateFile,
+    targetApplications: [{
+      id: appId,
+      minVersion: "0.1",
+      maxVersion: "0.2"
+    }],
+    name: "Test Addon 11",
+  }, profileDir);
+  restartManager();
+
+  AddonManager.getAddonByID("addon11@tests.mozilla.org", function(a11) {
+    Assert.notEqual(a11, null);
 
-    await promiseRestartManager();
+    a11.findUpdates({
+      onCompatibilityUpdateAvailable() {
+        ok(false, "Should have not have seen compatibility information");
+      },
 
-    shutdownManager();
+      onUpdateAvailable() {
+        ok(false, "Should not have seen an available update");
+      },
 
-    await new Promise(executeSoon);
+      onUpdateFinished() {
+        run_next_test();
+      }
+    }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
   });
-}
+});
+
+add_task(async function cleanup() {
+  let addons = await AddonManager.getAddonsByTypes(["extension"]);
+
+  for (let addon of addons)
+    addon.uninstall();
+
+  await promiseRestartManager();
+
+  shutdownManager();
+
+  await new Promise(executeSoon);
+});
 
 // Test that background update checks work for lightweight themes
 add_test(function run_test_7() {
   startupManager();
 
   LightweightThemeManager.currentTheme = {
     id: "1",
     version: "1",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
@@ -27,31 +27,31 @@ function checkUpdates(aId, aUpdateFile) 
 }
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
 
   run_next_test();
 }
 
+const UPDATE_FILE = "test_updatecheck.json";
+
 // Test that a basic update check returns the expected available updates
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    let updates = await checkUpdates("updatecheck1@tests.mozilla.org", file);
+  let updates = await checkUpdates("updatecheck1@tests.mozilla.org", UPDATE_FILE);
 
-    equal(updates.length, 5);
-    let update = AddonUpdateChecker.getNewestCompatibleUpdate(updates);
-    notEqual(update, null);
-    equal(update.version, "3.0");
-    update = AddonUpdateChecker.getCompatibilityUpdate(updates, "2");
-    notEqual(update, null);
-    equal(update.version, "2.0");
-    equal(update.targetApplications[0].minVersion, "1");
-    equal(update.targetApplications[0].maxVersion, "2");
-  }
+  equal(updates.length, 5);
+  let update = AddonUpdateChecker.getNewestCompatibleUpdate(updates);
+  notEqual(update, null);
+  equal(update.version, "3.0");
+  update = AddonUpdateChecker.getCompatibilityUpdate(updates, "2");
+  notEqual(update, null);
+  equal(update.version, "2.0");
+  equal(update.targetApplications[0].minVersion, "1");
+  equal(update.targetApplications[0].maxVersion, "2");
 });
 
 /*
  * Tests that the security checks are applied correctly
  *
  * Test     signature   updateHash  updateLink   expected
  *--------------------------------------------------------
  * 2        absent      absent      http         fail
@@ -60,173 +60,141 @@ add_task(async function() {
  * 5        correct     sha1        http         update
  * 6        corrent     absent      https        update
  * 7        corrent     sha1        https        update
  * 8        corrent     md2         http         no update
  * 9        corrent     md2         https        update
  */
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    try {
-      await checkUpdates("test_bug378216_5@tests.mozilla.org",
-                         file);
-      throw "Expected the update check to fail";
-    } catch (e) {}
-  }
+  try {
+    await checkUpdates("test_bug378216_5@tests.mozilla.org",
+                       UPDATE_FILE);
+    throw "Expected the update check to fail";
+  } catch (e) {}
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    try {
-      await checkUpdates("test_bug378216_7@tests.mozilla.org",
-                         file);
+  try {
+    await checkUpdates("test_bug378216_7@tests.mozilla.org",
+                       UPDATE_FILE);
 
-      throw "Expected the update check to fail";
-    } catch (e) {}
-  }
+    throw "Expected the update check to fail";
+  } catch (e) {}
 });
 
 add_task(async function() {
   // Make sure that the JSON manifest is rejected when an update key is
   // required, but perform the remaining tests which aren't expected to fail
   // because of the update key, without requiring one for the JSON variant.
 
   try {
     await checkUpdates("test_bug378216_8@tests.mozilla.org",
                        "test_updatecheck.json");
 
     throw "Expected the update check to fail";
   } catch (e) {}
 
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_8@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    ok(!("updateURL" in updates[0]));
-  }
+  let updates = await checkUpdates("test_bug378216_8@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  ok(!("updateURL" in updates[0]));
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_9@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    equal(updates[0].version, "2.0");
-    ok("updateURL" in updates[0]);
-  }
+  let updates = await checkUpdates("test_bug378216_9@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  equal(updates[0].version, "2.0");
+  ok("updateURL" in updates[0]);
+});
+
+add_task(async function() {
+  let updates = await checkUpdates("test_bug378216_10@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  equal(updates[0].version, "2.0");
+  ok("updateURL" in updates[0]);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_10@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    equal(updates[0].version, "2.0");
-    ok("updateURL" in updates[0]);
-  }
+  let updates = await checkUpdates("test_bug378216_11@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  equal(updates[0].version, "2.0");
+  ok("updateURL" in updates[0]);
+});
+
+add_task(async function() {
+  let updates = await checkUpdates("test_bug378216_12@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  Assert.equal(false, "updateURL" in updates[0]);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_11@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    equal(updates[0].version, "2.0");
-    ok("updateURL" in updates[0]);
-  }
+  let updates = await checkUpdates("test_bug378216_13@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  equal(updates[0].version, "2.0");
+  ok("updateURL" in updates[0]);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_12@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    Assert.equal(false, "updateURL" in updates[0]);
-  }
+  let updates = await checkUpdates("test_bug378216_14@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 0);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf",
-                    "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_13@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    equal(updates[0].version, "2.0");
-    ok("updateURL" in updates[0]);
+  try {
+    await checkUpdates("test_bug378216_15@tests.mozilla.org",
+                       UPDATE_FILE);
+
+    throw "Update check should have failed";
+  } catch (e) {
+    equal(e.status, AddonManager.ERROR_PARSE_ERROR);
   }
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    let updates = await checkUpdates("test_bug378216_14@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 0);
-  }
-});
-
-add_task(async function() {
-  for (let file of ["test_updatecheck.json"]) {
-    try {
-      await checkUpdates("test_bug378216_15@tests.mozilla.org",
-                         file);
-
-      throw "Update check should have failed";
-    } catch (e) {
-      equal(e.status, AddonManager.ERROR_PARSE_ERROR);
-    }
-  }
-});
-
-add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    let updates = await checkUpdates("ignore-compat@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 3);
-    let update = AddonUpdateChecker.getNewestCompatibleUpdate(
-      updates, null, null, true);
-    notEqual(update, null);
-    equal(update.version, 2);
-  }
+  let updates = await checkUpdates("ignore-compat@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 3);
+  let update = AddonUpdateChecker.getNewestCompatibleUpdate(
+    updates, null, null, true);
+  notEqual(update, null);
+  equal(update.version, 2);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    let updates = await checkUpdates("compat-override@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 3);
-    let overrides = [{
-      type: "incompatible",
-      minVersion: 1,
-      maxVersion: 2,
-      appID: "xpcshell@tests.mozilla.org",
-      appMinVersion: 0.1,
-      appMaxVersion: 0.2
-    }, {
-      type: "incompatible",
-      minVersion: 2,
-      maxVersion: 2,
-      appID: "xpcshell@tests.mozilla.org",
-      appMinVersion: 1,
-      appMaxVersion: 2
-    }];
-    let update = AddonUpdateChecker.getNewestCompatibleUpdate(
-      updates, null, null, true, false, overrides);
-    notEqual(update, null);
-    equal(update.version, 1);
-  }
+  let updates = await checkUpdates("compat-override@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 3);
+  let overrides = [{
+    type: "incompatible",
+    minVersion: 1,
+    maxVersion: 2,
+    appID: "xpcshell@tests.mozilla.org",
+    appMinVersion: 0.1,
+    appMaxVersion: 0.2
+  }, {
+    type: "incompatible",
+    minVersion: 2,
+    maxVersion: 2,
+    appID: "xpcshell@tests.mozilla.org",
+    appMinVersion: 1,
+    appMaxVersion: 2
+  }];
+  let update = AddonUpdateChecker.getNewestCompatibleUpdate(
+    updates, null, null, true, false, overrides);
+  notEqual(update, null);
+  equal(update.version, 1);
 });
 
 add_task(async function() {
-  for (let file of ["test_updatecheck.rdf", "test_updatecheck.json"]) {
-    let updates = await checkUpdates("compat-strict-optin@tests.mozilla.org",
-                                     file);
-    equal(updates.length, 1);
-    let update = AddonUpdateChecker.getNewestCompatibleUpdate(
-      updates, null, null, true, false);
-    equal(update, null);
-  }
+  let updates = await checkUpdates("compat-strict-optin@tests.mozilla.org",
+                                   UPDATE_FILE);
+  equal(updates.length, 1);
+  let update = AddonUpdateChecker.getNewestCompatibleUpdate(
+    updates, null, null, true, false);
+  equal(update, null);
 });