Bug 1559112 - Do not check recommendations for builtin addons a=jcristau
authorRob Wu <rob@robwu.nl>
Mon, 17 Jun 2019 19:25:24 +0300
changeset 536990 19b174fe464eaa7e3e1bc5455883ab7fd8c7d12d
parent 536989 255b632c9f90cd1c8235eaf7346b5489c8c96afa
child 536991 4b218aa16867e650450a8700fa45333b1903811c
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcristau
bugs1559112
milestone68.0
Bug 1559112 - Do not check recommendations for builtin addons a=jcristau Reviewers: aswan Reviewed By: aswan Bug #: 1559112 Differential Revision: https://phabricator.services.mozilla.com/D34862
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/test/xpcshell/test_recommendations.js
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -627,17 +627,17 @@ var loadManifest = async function(aPacka
         throw new Error(`Extension is signed with an invalid id (${addon.id})`);
       }
     }
     if (!addon.id && aLocation.isTemporary) {
       addon.id = generateTemporaryInstallID(aPackage.file);
     }
   }
 
-  if (addon.type === "extension") {
+  if (addon.type === "extension" && !addon.location.isBuiltin) {
     addon.recommendationState = await readRecommendationStates(aPackage, addon.id);
   }
 
   addon.propagateDisabledState(aOldAddon);
   await addon.updateBlocklistState();
   addon.appDisabled = !XPIDatabase.isUsableAddon(addon);
 
   defineSyncGUID(addon);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_recommendations.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_recommendations.js
@@ -97,16 +97,38 @@ add_task(async function test_temporary()
   });
   let addon = await XPIInstall.installTemporaryAddon(xpi);
 
   ok(!addon.isRecommended, "The add-on is not recommended");
 
   await addon.uninstall();
 });
 
+add_task(async function test_builtin() {
+  const id = "builtin@test.web.extension";
+  let extension = await installBuiltinExtension({
+    manifest: {
+      applications: {gecko: {id}},
+    },
+    background: `browser.test.sendMessage("started");`,
+    files: {
+      [RECOMMENDATION_FILE_NAME]: {
+        addon_id: id,
+        states: ["recommended"],
+        validity: {not_before, not_after},
+      },
+    },
+  });
+  await extension.awaitMessage("started");
+
+  ok(!extension.addon.isRecommended, "The add-on is not recommended");
+
+  await extension.unload();
+});
+
 add_task(async function test_theme() {
   const id = "theme@test.web.extension";
   let xpi = AddonTestUtils.createTempWebExtensionFile({
     manifest: {
       applications: {gecko: {id}},
       theme: {},
     },
     files: {