From 4186e8225fab894270172c63491060e6328f8224 Mon Sep 17 00:00:00 2001 From: Wolfgang Rosenauer Date: Thu, 20 May 2010 07:16:50 +0200 Subject: [PATCH] Bug 560451 - Fennec allows uninstall attempt of add-ons in readonly directories. r=mfinkle --- mobile/chrome/content/bindings/extensions.xml | 6 +++++- mobile/chrome/content/extensions.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/chrome/content/bindings/extensions.xml b/mobile/chrome/content/bindings/extensions.xml index 7f2aa4d1fc3..31eeba7feed 100644 --- a/mobile/chrome/content/bindings/extensions.xml +++ b/mobile/chrome/content/bindings/extensions.xml @@ -38,7 +38,7 @@ oncommand="ExtensionsView.enable(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"); ]]> diff --git a/mobile/chrome/content/extensions.js b/mobile/chrome/content/extensions.js index 200a21118ac..bf28d185f4a 100644 --- a/mobile/chrome/content/extensions.js +++ b/mobile/chrome/content/extensions.js @@ -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); }