Bug 1520164 - Include a fallback icon for extension shortcuts r=aswan
authorMark Striemer <mstriemer@mozilla.com>
Tue, 15 Jan 2019 18:01:46 +0000
changeset 453957 c7f31b684841a1302d98bbe0e45415d15668bd6f
parent 453955 a51d26029042fb10cca386c3150fc2c912a442a2
child 453958 81873890e8b7d43fa291b54fe506f9b1e4fb4ee2
push id35382
push userdvarga@mozilla.com
push dateWed, 16 Jan 2019 04:47:18 +0000
treeherdermozilla-central@b46d5d689c8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1520164
milestone66.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 1520164 - Include a fallback icon for extension shortcuts r=aswan Differential Revision: https://phabricator.services.mozilla.com/D16579
toolkit/mozapps/extensions/content/shortcuts.js
--- a/toolkit/mozapps/extensions/content/shortcuts.js
+++ b/toolkit/mozapps/extensions/content/shortcuts.js
@@ -8,16 +8,18 @@
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   AddonManager: "resource://gre/modules/AddonManager.jsm",
   AppConstants: "resource://gre/modules/AppConstants.jsm",
   ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
 });
 
+const FALLBACK_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
+
 let templatesLoaded = false;
 const templates = {};
 
 function loadTemplates() {
   if (templatesLoaded) return;
   templatesLoaded = true;
 
   templates.card = document.getElementById("card-template");
@@ -261,17 +263,17 @@ async function renderAddons(addons) {
 
     // Skip this extension if it isn't a webextension.
     if (!extension) continue;
 
     let card = document.importNode(
       templates.card.content, true).firstElementChild;
     let icon = AddonManager.getPreferredIconURL(addon, 24, window);
     card.setAttribute("addon-id", addon.id);
-    card.querySelector(".addon-icon").src = icon;
+    card.querySelector(".addon-icon").src = icon || FALLBACK_ICON;
     card.querySelector(".addon-name").textContent = addon.name;
 
     if (extension.shortcuts) {
       let commands = await extension.shortcuts.allCommands();
 
       for (let command of commands) {
         let row = document.importNode(templates.row.content, true);
         let label = row.querySelector(".shortcut-label");