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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 3 */
michael@0 4
michael@0 5 // Test that all bundled add-ons are compatible.
michael@0 6
michael@0 7 function test() {
michael@0 8 waitForExplicitFinish();
michael@0 9
michael@0 10 Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
michael@0 11 ok(AddonManager.strictCompatibility, "Strict compatibility should be enabled");
michael@0 12
michael@0 13 AddonManager.getAllAddons(function gAACallback(aAddons) {
michael@0 14 // Sort add-ons (by type and name) to improve output.
michael@0 15 aAddons.sort(function compareTypeName(a, b) {
michael@0 16 return a.type.localeCompare(b.type) || a.name.localeCompare(b.name);
michael@0 17 });
michael@0 18
michael@0 19 let allCompatible = true;
michael@0 20 for (let a of aAddons) {
michael@0 21 // Ignore plugins.
michael@0 22 if (a.type == "plugin")
michael@0 23 continue;
michael@0 24
michael@0 25 ok(a.isCompatible, a.type + " " + a.name + " " + a.version + " should be compatible");
michael@0 26 allCompatible = allCompatible && a.isCompatible;
michael@0 27 }
michael@0 28 // Add a reminder.
michael@0 29 if (!allCompatible)
michael@0 30 ok(false, "As this test failed, test browser_bug557956.js should have failed, too.");
michael@0 31
michael@0 32 finish();
michael@0 33 });
michael@0 34 }

mercurial