toolkit/mozapps/extensions/test/browser/browser_checkAddonCompatibility.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/browser/browser_checkAddonCompatibility.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +// Test that all bundled add-ons are compatible.
     1.9 +
    1.10 +function test() {
    1.11 +  waitForExplicitFinish();
    1.12 +
    1.13 +  Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
    1.14 +  ok(AddonManager.strictCompatibility, "Strict compatibility should be enabled");
    1.15 +
    1.16 +  AddonManager.getAllAddons(function gAACallback(aAddons) {
    1.17 +    // Sort add-ons (by type and name) to improve output.
    1.18 +    aAddons.sort(function compareTypeName(a, b) {
    1.19 +      return a.type.localeCompare(b.type) || a.name.localeCompare(b.name);
    1.20 +    });
    1.21 +
    1.22 +    let allCompatible = true;
    1.23 +    for (let a of aAddons) {
    1.24 +      // Ignore plugins.
    1.25 +      if (a.type == "plugin")
    1.26 +        continue;
    1.27 +
    1.28 +      ok(a.isCompatible, a.type + " " + a.name + " " + a.version + " should be compatible");
    1.29 +      allCompatible = allCompatible && a.isCompatible;
    1.30 +    }
    1.31 +    // Add a reminder.
    1.32 +    if (!allCompatible)
    1.33 +      ok(false, "As this test failed, test browser_bug557956.js should have failed, too.");
    1.34 +
    1.35 +    finish();
    1.36 +  });
    1.37 +}

mercurial