Bug 1093034 - fix add-on manager to cope with magical new add-on types, r=Mossop

--HG--
extra : rebase_source : b448a22f2781bca89a54d559dc63141532ef6c8d
This commit is contained in:
Gijs Kruitbosch 2014-12-11 00:46:56 +00:00
parent dc7b617e63
commit ef62d751ea
2 changed files with 41 additions and 3 deletions

View File

@ -844,6 +844,11 @@ this.AddonRepository = {
if (idIndex == -1)
continue;
// Ignore add-on if the add-on manager doesn't know about its type:
if (!(result.addon.type in AddonManager.addonTypes)) {
continue;
}
results.push(result);
// Ignore this add-on from now on
ids.splice(idIndex, 1);
@ -1089,10 +1094,8 @@ this.AddonRepository = {
addon.type = "search";
break;
case 5:
addon.type = "langpack";
break;
case 6:
addon.type = "langpack-addon";
addon.type = "locale";
break;
case 7:
addon.type = "plugin";
@ -1303,6 +1306,10 @@ this.AddonRepository = {
if (requiredAttributes.some(function parseAddons_attributeFilter(aAttribute) !result.addon[aAttribute]))
continue;
// Ignore add-on with a type AddonManager doesn't understand:
if (!(result.addon.type in AddonManager.addonTypes))
continue;
// Add only if the add-on is compatible with the platform
if (!result.addon.isPlatformCompatible)
continue;

View File

@ -31,6 +31,37 @@
<compatible_os>ALL</compatible_os>
<install size="1">http://example.com/addon1.xpi</install>
</addon>
<addon>
<name>FAIL</name>
<type id='9'>lightweight theme</type>
<guid>addon12345@tests.mozilla.org</guid>
<version>1.0</version>
<authors>
<author>
<name>Test Creator</name>
<link>http://example.com/creator.html</link>
</author>
</authors>
<status id='4'>Public</status>
<summary>Addon with uninstallable type shouldn't be visible in search</summary>
<description>Test description</description>
<compatible_applications>
<application>
<name>Firefox</name>
<appID>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</appID>
<min_version>0</min_version>
<max_version>*</max_version>
</application>
<application>
<name>SeaMonkey</name>
<appID>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</appID>
<min_version>0</min_version>
<max_version>*</max_version>
</application>
</compatible_applications>
<compatible_os>ALL</compatible_os>
<install size="1">http://example.com/addon1.xpi</install>
</addon>
<addon>
<name>FAIL</name>
<type id='1'>Extension</type>