Bug 1553416 - Show system add-ons with shortcuts r=mixedpuppy,kmag
authorRob Wu <rob@robwu.nl>
Thu, 30 May 2019 22:44:41 +0000
changeset 476324 e2ec538a2cd8bd0c9bee7dc2e460da090ba80eb1
parent 476323 9a811a4d134d5e6e7d17457271d19c5ebc4891af
child 476325 08cc281fa75920202790232d39cf452b1893e209
push id36092
push userarchaeopteryx@coole-files.de
push dateFri, 31 May 2019 17:03:46 +0000
treeherdermozilla-central@8384972e1f6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, kmag
bugs1553416
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1553416 - Show system add-ons with shortcuts r=mixedpuppy,kmag Differential Revision: https://phabricator.services.mozilla.com/D32118
toolkit/mozapps/extensions/content/shortcuts.js
toolkit/mozapps/extensions/test/browser/browser_manage_shortcuts_hidden.js
--- a/toolkit/mozapps/extensions/content/shortcuts.js
+++ b/toolkit/mozapps/extensions/content/shortcuts.js
@@ -427,17 +427,17 @@ async function renderAddons(addons) {
 
   return frag;
 }
 
 async function render() {
   loadTemplates();
   let allAddons = await AddonManager.getAddonsByTypes(["extension"]);
   let addons = allAddons
-    .filter(addon => !addon.isSystem && addon.isActive)
+    .filter(addon => addon.isActive)
     .sort((a, b) => a.name.localeCompare(b.name));
   let frag;
 
   if (addons.length > 0) {
     frag = await renderAddons(addons);
   } else {
     frag = document.importNode(templates.noAddons.content, true);
   }
--- a/toolkit/mozapps/extensions/test/browser/browser_manage_shortcuts_hidden.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_manage_shortcuts_hidden.js
@@ -26,16 +26,17 @@ async function registerAndStartExtension
   mockProvider.createAddons([{
     id: extension.id,
     name: ext.manifest.name,
     type: "extension",
     version: "1",
     // We use MockProvider because the "hidden" property cannot
     // be set when "useAddonManager" is passed to loadExtension.
     hidden: ext.manifest.hidden,
+    isSystem: ext.isSystem,
   }]);
   return extension;
 }
 
 function getShortcutCard(doc, extension) {
   return doc.querySelector(`.shortcut[addon-id="${extension.id}"]`);
 }
 
@@ -122,8 +123,47 @@ add_task(async function hidden_extension
      "Hidden extension without shortcuts should not be listed");
 
   await closeShortcutsView(doc);
   await hiddenExt1.unload();
   await hiddenExt2.unload();
 
   mockProvider.unregister();
 });
+
+add_task(async function system_addons_and_shortcuts() {
+  let mockProvider = new MockProvider();
+  let systemExt1 = await registerAndStartExtension(mockProvider, {
+    isSystem: true,
+    manifest: {
+      name: "system with shortcuts",
+      // In practice, all XPIStateLocations with isSystem=true also have
+      // isBuiltin=true, which implies that hidden=true as well.
+      hidden: true,
+      commands: {
+        systemShortcut: {},
+      },
+    },
+  });
+  let systemExt2 = await registerAndStartExtension(mockProvider, {
+    isSystem: true,
+    manifest: {
+      name: "system without shortcuts",
+      hidden: true,
+    },
+  });
+
+  let doc = await loadShortcutsView();
+
+  ok(getShortcutByName(doc, systemExt1, "systemShortcut"),
+     "System add-on with shortcut should have a card");
+
+  is(getShortcutCard(doc, systemExt2), null,
+     "System add-on without shortcut should not have a card");
+  is(getNoShortcutListItem(doc, systemExt2), null,
+     "System add-on without shortcuts should not be listed");
+
+  await closeShortcutsView(doc);
+  await systemExt1.unload();
+  await systemExt2.unload();
+
+  mockProvider.unregister();
+});