Bug 560451 - Fennec allows uninstall attempt of add-ons in readonly directories. r=mfinkle

This commit is contained in:
Wolfgang Rosenauer 2010-05-20 07:16:50 +02:00
Родитель 367e7def52
Коммит 4186e8225f
2 изменённых файлов: 7 добавлений и 1 удалений

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

@ -38,7 +38,7 @@
oncommand="ExtensionsView.enable(document.getBindingParent(this));"/>
<xul:button class="show-on-enable hide-on-disable hide-on-uninstall addon-disable" label="&addonDisable.label;"
oncommand="ExtensionsView.disable(document.getBindingParent(this));"/>
<xul:button class="hide-on-uninstall addon-uninstall" label="&addonUninstall.label;"
<xul:button anonid="uninstall-button" class="hide-on-uninstall addon-uninstall" label="&addonUninstall.label;"
oncommand="ExtensionsView.uninstall(document.getBindingParent(this));"/>
<xul:button class="show-on-uninstall addon-cancel" label="&addonCancel.label;"
oncommand="ExtensionsView.cancelUninstall(document.getBindingParent(this));"/>
@ -58,6 +58,10 @@
let appDisabled = this.getAttribute("appDisabled");
if (appDisabled == "true")
document.getAnonymousElementByAttribute(this, "anonid", "enable-button").setAttribute("disabled", "true");
let isReadOnly = this.getAttribute("isReadonly");
if (isReadOnly == "true")
document.getAnonymousElementByAttribute(this, "anonid", "uninstall-button").setAttribute("disabled", "true");
]]>
</constructor>

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

@ -294,6 +294,7 @@ var ExtensionsView = {
let appManaged = (addon.scope == AddonManager.SCOPE_APPLICATION);
let opType = self._getOpTypeForOperations(addon.pendingOperations);
let updateable = (addon.permissions & AddonManager.PERM_CAN_UPDATE) > 0;
let uninstallable = (addon.permissions & AddonManager.PERM_CAN_UNINSTALL) > 0;
let listitem = self._createItem(addon, "local");
listitem.setAttribute("isDisabled", !addon.isActive);
@ -303,6 +304,7 @@ var ExtensionsView = {
listitem.setAttribute("optionsURL", addon.optionsURL);
listitem.setAttribute("opType", opType);
listitem.setAttribute("updateable", updateable);
listitem.setAttribute("isReadonly", !uninstallable);
listitem.addon = addon;
self._list.insertBefore(listitem, self._repoItem);
}