From 6d346ce0428bb00dad39742707a89f422ab559d4 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Fri, 2 Jul 2010 07:48:26 -0700 Subject: [PATCH] Bug 574970: Import the skinnable property from install.rdf to the database and expose it through the API. r=robstrong --- .../install.rdf.in | 13 +++---------- .../extensions/test/addons/test_theme/install.rdf | 2 ++ .../extensions/test/xpcshell/head_addons.js | 2 +- .../extensions/test/xpcshell/test_theme.js | 15 +++++++++++++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in index 3335403f419..f8eccb46554 100644 --- a/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in +++ b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf.in @@ -23,20 +23,13 @@ Default The default theme. - - true - - true - Mozilla Mozilla Contributors + + true + classic/1.0 diff --git a/toolkit/mozapps/extensions/test/addons/test_theme/install.rdf b/toolkit/mozapps/extensions/test/addons/test_theme/install.rdf index 6ab808a018d..e1a37d0a49c 100644 --- a/toolkit/mozapps/extensions/test/addons/test_theme/install.rdf +++ b/toolkit/mozapps/extensions/test/addons/test_theme/install.rdf @@ -20,5 +20,7 @@ + true + diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js index 65c3fce3f12..356f9ab5938 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js +++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ -355,7 +355,7 @@ function writeInstallRDFToDir(aData, aDir) { rdf += '\n'; ["id", "version", "type", "internalName", "updateURL", "updateKey", - "optionsURL", "aboutURL", "iconURL"].forEach(function(aProp) { + "optionsURL", "aboutURL", "iconURL", "skinnable"].forEach(function(aProp) { if (aProp in aData) rdf += "" + escapeXML(aData[aProp]) + "\n"; }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_theme.js b/toolkit/mozapps/extensions/test/xpcshell/test_theme.js index 3dfe47d7ffd..647dfda940c 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_theme.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_theme.js @@ -42,6 +42,7 @@ function run_test() { version: "1.0", name: "Test 1", type: 4, + skinnable: true, internalName: "theme1/1.0", targetApplications: [{ id: "xpcshell@tests.mozilla.org", @@ -56,6 +57,7 @@ function run_test() { id: "theme2@tests.mozilla.org", version: "1.0", name: "Test 1", + skinnable: false, internalName: "theme2/1.0", targetApplications: [{ id: "xpcshell@tests.mozilla.org", @@ -88,12 +90,18 @@ function run_test() { AddonManager.addAddonListener(AddonListener); AddonManager.addInstallListener(InstallListener); - AddonManager.getAddonsByIDs(["theme1@tests.mozilla.org", - "theme2@tests.mozilla.org"], function([t1, t2]) { + AddonManager.getAddonsByIDs(["default@tests.mozilla.org", + "theme1@tests.mozilla.org", + "theme2@tests.mozilla.org"], + function([d, t1, t2]) { + do_check_neq(d, null); + do_check_false(d.skinnable); + do_check_neq(t1, null); do_check_false(t1.userDisabled); do_check_false(t1.appDisabled); do_check_true(t1.isActive); + do_check_true(t1.skinnable); do_check_eq(t1.screenshots.length, 0); do_check_true(isThemeInAddonsList(profileDir, t1.id)); do_check_false(hasFlag(t1.permissions, AddonManager.PERM_CAN_DISABLE)); @@ -103,6 +111,7 @@ function run_test() { do_check_true(t2.userDisabled); do_check_false(t2.appDisabled); do_check_false(t2.isActive); + do_check_false(t2.skinnable); do_check_eq(t2.screenshots.length, 0); do_check_false(isThemeInAddonsList(profileDir, t2.id)); do_check_false(hasFlag(t2.permissions, AddonManager.PERM_CAN_DISABLE)); @@ -643,6 +652,7 @@ function run_test_11() { do_check_eq(install.version, "1.0"); do_check_eq(install.name, "Test Theme 1"); do_check_eq(install.state, AddonManager.STATE_DOWNLOADED); + do_check_true(install.addon.skinnable, true); prepare_test({ "theme1@tests.mozilla.org": [ @@ -665,6 +675,7 @@ function check_test_11() { preview.append("preview.png"); do_check_eq(t1.screenshots.length, 1); do_check_eq(t1.screenshots[0], NetUtil.newURI(preview).spec); + do_check_true(t1.skinnable); do_check_false(gLWThemeChanged); run_test_12();