michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // This tests that all properties are read from the install manifests and that michael@0: // items are correctly enabled/disabled based on them (blocklist tests are michael@0: // elsewhere) michael@0: michael@0: function run_test() { michael@0: createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); michael@0: const profileDir = gProfD.clone(); michael@0: profileDir.append("extensions"); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon1@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsURL: "chrome://test/content/options.xul", michael@0: aboutURL: "chrome://test/content/about.xul", michael@0: iconURL: "chrome://test/skin/icon.png", michael@0: icon64URL: "chrome://test/skin/icon64.png", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 1", michael@0: description: "Test Description", michael@0: creator: "Test Creator", michael@0: homepageURL: "http://www.example.com", michael@0: developer: [ michael@0: "Test Developer 1", michael@0: "Test Developer 2" michael@0: ], michael@0: translator: [ michael@0: "Test Translator 1", michael@0: "Test Translator 2" michael@0: ], michael@0: contributor: [ michael@0: "Test Contributor 1", michael@0: "Test Contributor 2" michael@0: ] michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon2@tests.mozilla.org", michael@0: version: "1.0", michael@0: updateURL: "https://www.foo.com", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 2" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon3@tests.mozilla.org", michael@0: version: "1.0", michael@0: updateURL: "http://www.foo.com", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 3" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon4@tests.mozilla.org", michael@0: version: "1.0", michael@0: updateURL: "http://www.foo.com", michael@0: updateKey: "foo", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 4" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon5@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "*" michael@0: }], michael@0: name: "Test Addon 5" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon6@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "0", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 6" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon7@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "0", michael@0: maxVersion: "0" michael@0: }], michael@0: name: "Test Addon 7" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon8@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1.1", michael@0: maxVersion: "*" michael@0: }], michael@0: name: "Test Addon 8" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon9@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9.2", michael@0: maxVersion: "1.9.*" michael@0: }], michael@0: name: "Test Addon 9" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon10@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9.2.1", michael@0: maxVersion: "1.9.*" michael@0: }], michael@0: name: "Test Addon 10" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon11@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9", michael@0: maxVersion: "1.9.2" michael@0: }], michael@0: name: "Test Addon 11" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon12@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9", michael@0: maxVersion: "1.9.1.*" michael@0: }], michael@0: name: "Test Addon 12" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon13@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9", michael@0: maxVersion: "1.9.*" michael@0: }, { michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "0", michael@0: maxVersion: "0.5" michael@0: }], michael@0: name: "Test Addon 13" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon14@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "toolkit@mozilla.org", michael@0: minVersion: "1.9", michael@0: maxVersion: "1.9.1" michael@0: }, { michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 14" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon15@tests.mozilla.org", michael@0: version: "1.0", michael@0: updateKey: "foo", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 15" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon16@tests.mozilla.org", michael@0: version: "1.0", michael@0: updateKey: "foo", michael@0: updateURL: "https://www.foo.com", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 16" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon17@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsURL: "chrome://test/content/options.xul", michael@0: optionsType: "2", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 17" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon18@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 18" michael@0: }, profileDir, null, "options.xul"); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon19@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "99", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 19" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon20@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "1", michael@0: optionsURL: "chrome://test/content/options.xul", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 20" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon21@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "3", michael@0: optionsURL: "chrome://test/content/options.xul", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 21" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon22@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "2", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 22" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon23@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "2", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 23" michael@0: }, profileDir, null, "options.xul"); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon24@tests.mozilla.org", michael@0: version: "1.0", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 24" michael@0: }, profileDir, null, "options.xul"); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon25@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "3", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 25" michael@0: }, profileDir); michael@0: michael@0: writeInstallRDFForExtension({ michael@0: id: "addon26@tests.mozilla.org", michael@0: version: "1.0", michael@0: optionsType: "4", michael@0: targetApplications: [{ michael@0: id: "xpcshell@tests.mozilla.org", michael@0: minVersion: "1", michael@0: maxVersion: "1" michael@0: }], michael@0: name: "Test Addon 26" michael@0: }, profileDir, null, "options.xul"); michael@0: michael@0: do_test_pending(); michael@0: startupManager(); michael@0: AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", michael@0: "addon2@tests.mozilla.org", michael@0: "addon3@tests.mozilla.org", michael@0: "addon4@tests.mozilla.org", michael@0: "addon5@tests.mozilla.org", michael@0: "addon6@tests.mozilla.org", michael@0: "addon7@tests.mozilla.org", michael@0: "addon8@tests.mozilla.org", michael@0: "addon9@tests.mozilla.org", michael@0: "addon10@tests.mozilla.org", michael@0: "addon11@tests.mozilla.org", michael@0: "addon12@tests.mozilla.org", michael@0: "addon13@tests.mozilla.org", michael@0: "addon14@tests.mozilla.org", michael@0: "addon15@tests.mozilla.org", michael@0: "addon16@tests.mozilla.org", michael@0: "addon17@tests.mozilla.org", michael@0: "addon18@tests.mozilla.org", michael@0: "addon19@tests.mozilla.org", michael@0: "addon20@tests.mozilla.org", michael@0: "addon21@tests.mozilla.org", michael@0: "addon22@tests.mozilla.org", michael@0: "addon23@tests.mozilla.org", michael@0: "addon24@tests.mozilla.org", michael@0: "addon25@tests.mozilla.org", michael@0: "addon26@tests.mozilla.org"], michael@0: function([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, michael@0: a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, michael@0: a21, a22, a23, a24, a25, a26]) { michael@0: michael@0: do_check_neq(a1, null); michael@0: do_check_eq(a1.id, "addon1@tests.mozilla.org"); michael@0: do_check_eq(a1.type, "extension"); michael@0: do_check_eq(a1.version, "1.0"); michael@0: do_check_eq(a1.optionsURL, "chrome://test/content/options.xul"); michael@0: do_check_eq(a1.optionsType, AddonManager.OPTIONS_TYPE_DIALOG); michael@0: do_check_eq(a1.aboutURL, "chrome://test/content/about.xul"); michael@0: do_check_eq(a1.iconURL, "chrome://test/skin/icon.png"); michael@0: do_check_eq(a1.icon64URL, "chrome://test/skin/icon64.png"); michael@0: do_check_eq(a1.icons[32], "chrome://test/skin/icon.png"); michael@0: do_check_eq(a1.icons[64], "chrome://test/skin/icon64.png"); michael@0: do_check_eq(a1.name, "Test Addon 1"); michael@0: do_check_eq(a1.description, "Test Description"); michael@0: do_check_eq(a1.creator, "Test Creator"); michael@0: do_check_eq(a1.homepageURL, "http://www.example.com"); michael@0: do_check_eq(a1.developers[0], "Test Developer 1"); michael@0: do_check_eq(a1.developers[1], "Test Developer 2"); michael@0: do_check_eq(a1.translators[0], "Test Translator 1"); michael@0: do_check_eq(a1.translators[1], "Test Translator 2"); michael@0: do_check_eq(a1.contributors[0], "Test Contributor 1"); michael@0: do_check_eq(a1.contributors[1], "Test Contributor 2"); michael@0: do_check_true(a1.isActive); michael@0: do_check_false(a1.userDisabled); michael@0: do_check_false(a1.appDisabled); michael@0: do_check_true(a1.isCompatible); michael@0: do_check_true(a1.providesUpdatesSecurely); michael@0: do_check_eq(a1.blocklistState, AM_Ci.nsIBlocklistService.STATE_NOT_BLOCKED); michael@0: michael@0: do_check_neq(a2, null); michael@0: do_check_eq(a2.id, "addon2@tests.mozilla.org"); michael@0: do_check_true(a2.isActive); michael@0: do_check_false(a2.userDisabled); michael@0: do_check_false(a2.appDisabled); michael@0: do_check_true(a2.providesUpdatesSecurely); michael@0: michael@0: do_check_neq(a3, null); michael@0: do_check_eq(a3.id, "addon3@tests.mozilla.org"); michael@0: do_check_false(a3.isActive); michael@0: do_check_false(a3.userDisabled); michael@0: do_check_true(a3.appDisabled); michael@0: do_check_false(a3.providesUpdatesSecurely); michael@0: michael@0: do_check_neq(a4, null); michael@0: do_check_eq(a4.id, "addon4@tests.mozilla.org"); michael@0: do_check_true(a4.isActive); michael@0: do_check_false(a4.userDisabled); michael@0: do_check_false(a4.appDisabled); michael@0: do_check_true(a4.providesUpdatesSecurely); michael@0: michael@0: do_check_neq(a5, null); michael@0: do_check_true(a5.isActive); michael@0: do_check_false(a5.userDisabled); michael@0: do_check_false(a5.appDisabled); michael@0: do_check_true(a5.isCompatible); michael@0: michael@0: do_check_neq(a6, null); michael@0: do_check_true(a6.isActive); michael@0: do_check_false(a6.userDisabled); michael@0: do_check_false(a6.appDisabled); michael@0: do_check_true(a6.isCompatible); michael@0: michael@0: do_check_neq(a7, null); michael@0: do_check_false(a7.isActive); michael@0: do_check_false(a7.userDisabled); michael@0: do_check_true(a7.appDisabled); michael@0: do_check_false(a7.isCompatible); michael@0: michael@0: do_check_neq(a8, null); michael@0: do_check_false(a8.isActive); michael@0: do_check_false(a8.userDisabled); michael@0: do_check_true(a8.appDisabled); michael@0: do_check_false(a8.isCompatible); michael@0: michael@0: do_check_neq(a9, null); michael@0: do_check_true(a9.isActive); michael@0: do_check_false(a9.userDisabled); michael@0: do_check_false(a9.appDisabled); michael@0: do_check_true(a9.isCompatible); michael@0: michael@0: do_check_neq(a10, null); michael@0: do_check_false(a10.isActive); michael@0: do_check_false(a10.userDisabled); michael@0: do_check_true(a10.appDisabled); michael@0: do_check_false(a10.isCompatible); michael@0: michael@0: do_check_neq(a11, null); michael@0: do_check_true(a11.isActive); michael@0: do_check_false(a11.userDisabled); michael@0: do_check_false(a11.appDisabled); michael@0: do_check_true(a11.isCompatible); michael@0: michael@0: do_check_neq(a12, null); michael@0: do_check_false(a12.isActive); michael@0: do_check_false(a12.userDisabled); michael@0: do_check_true(a12.appDisabled); michael@0: do_check_false(a12.isCompatible); michael@0: michael@0: do_check_neq(a13, null); michael@0: do_check_false(a13.isActive); michael@0: do_check_false(a13.userDisabled); michael@0: do_check_true(a13.appDisabled); michael@0: do_check_false(a13.isCompatible); michael@0: michael@0: do_check_neq(a14, null); michael@0: do_check_true(a14.isActive); michael@0: do_check_false(a14.userDisabled); michael@0: do_check_false(a14.appDisabled); michael@0: do_check_true(a14.isCompatible); michael@0: michael@0: do_check_neq(a15, null); michael@0: do_check_true(a15.isActive); michael@0: do_check_false(a15.userDisabled); michael@0: do_check_false(a15.appDisabled); michael@0: do_check_true(a15.isCompatible); michael@0: do_check_true(a15.providesUpdatesSecurely); michael@0: michael@0: do_check_neq(a16, null); michael@0: do_check_true(a16.isActive); michael@0: do_check_false(a16.userDisabled); michael@0: do_check_false(a16.appDisabled); michael@0: do_check_true(a16.isCompatible); michael@0: do_check_true(a16.providesUpdatesSecurely); michael@0: michael@0: do_check_neq(a17, null); michael@0: do_check_true(a17.isActive); michael@0: do_check_false(a17.userDisabled); michael@0: do_check_false(a17.appDisabled); michael@0: do_check_true(a17.isCompatible); michael@0: do_check_eq(a17.optionsURL, "chrome://test/content/options.xul"); michael@0: do_check_eq(a17.optionsType, AddonManager.OPTIONS_TYPE_INLINE); michael@0: michael@0: do_check_neq(a18, null); michael@0: do_check_true(a18.isActive); michael@0: do_check_false(a18.userDisabled); michael@0: do_check_false(a18.appDisabled); michael@0: do_check_true(a18.isCompatible); michael@0: if (Services.prefs.getBoolPref("extensions.alwaysUnpack")) { michael@0: do_check_eq(a18.optionsURL, Services.io.newFileURI(profileDir).spec + michael@0: "addon18@tests.mozilla.org/options.xul"); michael@0: } else { michael@0: do_check_eq(a18.optionsURL, "jar:" + Services.io.newFileURI(profileDir).spec + michael@0: "addon18@tests.mozilla.org.xpi!/options.xul"); michael@0: } michael@0: do_check_eq(a18.optionsType, AddonManager.OPTIONS_TYPE_INLINE); michael@0: michael@0: do_check_eq(a19, null); michael@0: michael@0: do_check_neq(a20, null); michael@0: do_check_true(a20.isActive); michael@0: do_check_false(a20.userDisabled); michael@0: do_check_false(a20.appDisabled); michael@0: do_check_true(a20.isCompatible); michael@0: do_check_eq(a20.optionsURL, "chrome://test/content/options.xul"); michael@0: do_check_eq(a20.optionsType, AddonManager.OPTIONS_TYPE_DIALOG); michael@0: michael@0: do_check_neq(a21, null); michael@0: do_check_true(a21.isActive); michael@0: do_check_false(a21.userDisabled); michael@0: do_check_false(a21.appDisabled); michael@0: do_check_true(a21.isCompatible); michael@0: do_check_eq(a21.optionsURL, "chrome://test/content/options.xul"); michael@0: do_check_eq(a21.optionsType, AddonManager.OPTIONS_TYPE_TAB); michael@0: michael@0: do_check_neq(a22, null); michael@0: do_check_eq(a22.optionsType, null); michael@0: do_check_eq(a22.optionsURL, null); michael@0: michael@0: do_check_neq(a23, null); michael@0: do_check_eq(a23.optionsType, AddonManager.OPTIONS_TYPE_INLINE); michael@0: do_check_neq(a23.optionsURL, null); michael@0: michael@0: do_check_neq(a24, null); michael@0: do_check_eq(a24.optionsType, AddonManager.OPTIONS_TYPE_INLINE); michael@0: do_check_neq(a24.optionsURL, null); michael@0: michael@0: do_check_neq(a25, null); michael@0: do_check_eq(a25.optionsType, null); michael@0: do_check_eq(a25.optionsURL, null); michael@0: michael@0: do_check_neq(a26, null); michael@0: do_check_eq(a26.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO); michael@0: do_check_neq(a26.optionsURL, null); michael@0: michael@0: do_execute_soon(do_test_finished); michael@0: }); michael@0: }