Bug 1170841 - Show warning in add-on manager for add-ons that aren't properly signed. r=liuche

--HG--
extra : rebase_source : d5a5380036f18c1897256e9719a4d6ded9c1e19b
This commit is contained in:
Margaret Leibovic 2015-06-17 17:46:27 -07:00
Родитель a4d68c0617
Коммит 54a2cf7196
6 изменённых файлов: 60 добавлений и 11 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -47,6 +47,7 @@
<div class="options-header">&aboutAddons.options;</div>
<div class="options-box"></div>
</div>
<div class="warn-unsigned">&addonUnsigned.message; <a id="unsigned-learn-more">&addonUnsigned.learnMore;</a></div>
<div class="status status-uninstalled show-on-uninstall"></div>
<div class="buttons">
<button id="enable-btn" class="show-on-disable hide-on-enable hide-on-uninstall" >&addonAction.enable;</button>

Просмотреть файл

@ -10,3 +10,6 @@
<!ENTITY addonAction.disable "Disable">
<!ENTITY addonAction.uninstall "Uninstall">
<!ENTITY addonAction.undo "Undo">
<!ENTITY addonUnsigned.message "This add-on could not be verified by &brandShortName;.">
<!ENTITY addonUnsigned.learnMore "Learn more">

Просмотреть файл

@ -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;

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.3.2 (12043) - http://www.bohemiancoding.com/sketch -->
<title>Rectangle 62</title>
<desc>Created with Sketch.</desc>
<defs/>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Artboard-16" sketch:type="MSArtboardGroup" transform="translate(-62.000000, -310.000000)" fill="#AFB1B3">
<g id="Insecure-icon-Copy" sketch:type="MSLayerGroup" transform="translate(60.000000, 308.000000)">
<path d="M34.6570853,3.89861537 L61.6191658,57.8227763 C62.6631009,60.0994422 61.4905756,62 58.9609325,62 L5.03677158,62 C2.50636943,62 1.33487292,60.0971201 2.37853829,57.8227763 L29.3406187,3.89861537 C30.6694576,1.36596731 33.3285163,1.36828938 34.6570853,3.89861537 Z M28.2013759,23.6360478 C28.2013759,21.5439751 29.9058314,19.8480151 31.998852,19.8480151 C34.0961402,19.8480151 35.7963281,21.5419679 35.7963281,23.6360478 L35.7963281,38.844839 C35.7963281,40.9369118 34.0918726,42.6328718 31.998852,42.6328718 C29.9015639,42.6328718 28.2013759,40.938919 28.2013759,38.844839 L28.2013759,23.6360478 Z M31.998852,54.7847954 C34.0961402,54.7847954 35.7963281,53.0846074 35.7963281,50.9873193 C35.7963281,48.8900311 34.0961402,47.1898431 31.998852,47.1898431 C29.9015639,47.1898431 28.2013759,48.8900311 28.2013759,50.9873193 C28.2013759,53.0846074 29.9015639,54.7847954 31.998852,54.7847954 Z" id="Rectangle-62" sketch:type="MSShapeGroup"/>
</g>
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Просмотреть файл

@ -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)