diff --git a/toolkit/mozapps/extensions/AbuseReporter.jsm b/toolkit/mozapps/extensions/AbuseReporter.jsm index 509cc336ab24..907786443010 100644 --- a/toolkit/mozapps/extensions/AbuseReporter.jsm +++ b/toolkit/mozapps/extensions/AbuseReporter.jsm @@ -253,12 +253,17 @@ const AbuseReporter = { const getAuthorField = fieldName => details.authors && details.authors[0] && details.authors[0][fieldName]; + // Normalize type "statictheme" (which is the type used on the AMO API side) + // into "theme" (because it is the type we use and expect on the Firefox side + // for this addon type). + const addonType = details.type === "statictheme" ? "theme" : details.type; + return { id: addonId, name: getTranslatedValue(details.name), version: details.current_version.version, description: getTranslatedValue(details.summary), - type: details.type, + type: addonType, iconURL: details.icon_url, homepageURL: getTranslatedValue(details.homepage), supportURL: getTranslatedValue(details.support_url), diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js b/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js index 3045b89c89f0..522d59ce25e9 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js @@ -863,3 +863,18 @@ add_task(async function test_query_amo_details() { amoAddonDetailsMap.clear(); }); + +add_task(async function test_statictheme_normalized_into_type_theme() { + const themeId = "not-installed-statictheme@mochi.test"; + amoAddonDetailsMap.set(themeId, { + ...FAKE_AMO_DETAILS, + type: "statictheme", + }); + + const report = await AbuseReporter.createAbuseReport(themeId, REPORT_OPTIONS); + + equal(report.addon.id, themeId, "Got a report for the expected theme id"); + equal(report.addon.type, "theme", "Got the expected addon type"); + + amoAddonDetailsMap.clear(); +});