From 54a2cf71969356a4ae3daddba1997d80f19a994f Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 17 Jun 2015 17:46:27 -0700 Subject: [PATCH] Bug 1170841 - Show warning in add-on manager for add-ons that aren't properly signed. r=liuche --HG-- extra : rebase_source : d5a5380036f18c1897256e9719a4d6ded9c1e19b --- mobile/android/chrome/content/aboutAddons.js | 28 +++++++++++-------- .../android/chrome/content/aboutAddons.xhtml | 1 + .../locales/en-US/chrome/aboutAddons.dtd | 3 ++ mobile/android/themes/core/aboutAddons.css | 24 ++++++++++++++++ .../themes/core/images/grey-caution.svg | 14 ++++++++++ mobile/android/themes/core/jar.mn | 1 + 6 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 mobile/android/themes/core/images/grey-caution.svg diff --git a/mobile/android/chrome/content/aboutAddons.js b/mobile/android/chrome/content/aboutAddons.js index de1c796808ce..c6a634158e14 100644 --- a/mobile/android/chrome/content/aboutAddons.js +++ b/mobile/android/chrome/content/aboutAddons.js @@ -102,7 +102,6 @@ function init() { Addons.init(); showList(); ContextMenus.init(); - } @@ -111,14 +110,9 @@ function uninit() { AddonManager.removeAddonListener(Addons); } -function openLink(aEvent) { - try { - let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter); - - let url = formatter.formatURLPref(aEvent.currentTarget.getAttribute("pref")); - let BrowserApp = gChromeWin.BrowserApp; - BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }); - } catch (ex) {} +function openLink(url) { + let BrowserApp = gChromeWin.BrowserApp; + BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }); } function onPopState(aEvent) { @@ -194,8 +188,14 @@ var Addons = { let outer = document.createElement("div"); outer.className = "addon-item list-item"; outer.setAttribute("role", "button"); - outer.setAttribute("pref", "extensions.getAddons.browseAddons"); - outer.addEventListener("click", openLink, true); + outer.addEventListener("click", function(event) { + try { + let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter); + openLink(formatter.formatURLPref("extensions.getAddons.browseAddons")); + } catch (e) { + Cu.reportError(e); + } + }, true); let img = document.createElement("img"); img.className = "icon"; @@ -236,6 +236,7 @@ var Addons = { let item = this._createItem(aAddon); item.setAttribute("isDisabled", !aAddon.isActive); + item.setAttribute("isUnsigned", aAddon.signedState <= AddonManager.SIGNEDSTATE_MISSING); item.setAttribute("opType", opType); item.setAttribute("updateable", updateable); if (blocked) @@ -276,6 +277,10 @@ var Addons = { document.getElementById("cancel-btn").addEventListener("click", Addons.cancelUninstall.bind(this), false); document.getElementById("disable-btn").addEventListener("click", Addons.disable.bind(this), false); document.getElementById("enable-btn").addEventListener("click", Addons.enable.bind(this), false); + + document.getElementById("unsigned-learn-more").addEventListener("click", function() { + openLink(Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"); + }, false); }, _getOpTypeForOperations: function _getOpTypeForOperations(aOperations) { @@ -307,6 +312,7 @@ var Addons = { let detailItem = document.querySelector("#addons-details > .addon-item"); detailItem.setAttribute("isDisabled", aListItem.getAttribute("isDisabled")); + detailItem.setAttribute("isUnsigned", aListItem.getAttribute("isUnsigned")); detailItem.setAttribute("opType", aListItem.getAttribute("opType")); detailItem.setAttribute("optionsURL", aListItem.getAttribute("optionsURL")); let addon = detailItem.addon = aListItem.addon; diff --git a/mobile/android/chrome/content/aboutAddons.xhtml b/mobile/android/chrome/content/aboutAddons.xhtml index f5f00eb87ec5..42d9cfa9c105 100644 --- a/mobile/android/chrome/content/aboutAddons.xhtml +++ b/mobile/android/chrome/content/aboutAddons.xhtml @@ -47,6 +47,7 @@
&aboutAddons.options;
+
&addonUnsigned.message; &addonUnsigned.learnMore;
diff --git a/mobile/android/locales/en-US/chrome/aboutAddons.dtd b/mobile/android/locales/en-US/chrome/aboutAddons.dtd index 05405bbb2ccc..d4c89146b723 100644 --- a/mobile/android/locales/en-US/chrome/aboutAddons.dtd +++ b/mobile/android/locales/en-US/chrome/aboutAddons.dtd @@ -10,3 +10,6 @@ + + + diff --git a/mobile/android/themes/core/aboutAddons.css b/mobile/android/themes/core/aboutAddons.css index 83e11f19cd2c..69f2e51ea751 100644 --- a/mobile/android/themes/core/aboutAddons.css +++ b/mobile/android/themes/core/aboutAddons.css @@ -5,6 +5,15 @@ %filter substitution %include defines.inc +a { + text-decoration: none; + color: #0096DD; +} + +a:active { + color: #0082C6; +} + .details { width: 100%; } @@ -25,6 +34,21 @@ text-overflow: ellipsis; } +.warn-unsigned { + border-top: 1px solid @color_about_item_border@; + padding: 1em; + -moz-padding-start: calc(var(--icon-size) + var(--icon-margin) * 2); + background-image: url("chrome://browser/skin/images/grey-caution.svg"); + background-size: var(--icon-size); + background-position: var(--icon-margin); + background-repeat: no-repeat; + display: none; +} + +.addon-item[isUnsigned] .warn-unsigned { + display: block; +} + .status { border-top: 1px solid @color_about_item_border@; font-weight: bold; diff --git a/mobile/android/themes/core/images/grey-caution.svg b/mobile/android/themes/core/images/grey-caution.svg new file mode 100644 index 000000000000..1b810214fff7 --- /dev/null +++ b/mobile/android/themes/core/images/grey-caution.svg @@ -0,0 +1,14 @@ + + + + Rectangle 62 + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/mobile/android/themes/core/jar.mn b/mobile/android/themes/core/jar.mn index e9f966d10b43..088d8e68a6aa 100644 --- a/mobile/android/themes/core/jar.mn +++ b/mobile/android/themes/core/jar.mn @@ -73,6 +73,7 @@ chrome.jar: skin/images/errorpage-warning.png (images/errorpage-warning.png) skin/images/exitfullscreen-hdpi.png (images/exitfullscreen-hdpi.png) skin/images/fullscreen-hdpi.png (images/fullscreen-hdpi.png) + skin/images/grey-caution.svg (images/grey-caution.svg) skin/images/certerror-warning.png (images/certerror-warning.png) skin/images/errorpage-larry-white.png (images/errorpage-larry-white.png) skin/images/errorpage-larry-black.png (images/errorpage-larry-black.png)