From 6c31e9dfec3eefef2277f99f175a8a9df2bde395 Mon Sep 17 00:00:00 2001 From: "dtownsend@oxymoronical.com" Date: Mon, 9 Jul 2007 13:53:20 -0700 Subject: [PATCH] Bug 342579: Can update an extension meant for uninstalling. r=robstrong --- .../mozapps/extensions/content/extensions.js | 21 ++++++++++++++----- .../extensions/src/nsExtensionManager.js.in | 4 +--- .../mozapps/extensions/extensions.css | 12 ++++------- .../mozapps/extensions/extensions.css | 12 ++++------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index eea1ff3f2697..08347bb46921 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -312,7 +312,8 @@ function showView(aView) { ["updateURL", "?updateURL"], ["version", "?version"], ["typeName", "update"] ]; - types = [ [ ["availableUpdateVersion", "?availableUpdateVersion", null] ] ]; + types = [ [ ["availableUpdateVersion", "?availableUpdateVersion", null], + [ "updateable", "true", null ] ] ]; break; case "installs": document.getElementById("installs-view").hidden = false; @@ -1345,8 +1346,13 @@ function updateOptionalViews() { if (!showUpdates) { var updateURLArc = rdfs.GetResource(PREFIX_NS_EM + "availableUpdateURL"); var updateURL = ds.GetTarget(e, updateURLArc, true); - if (updateURL) - var showUpdates = true; + if (updateURL) { + var updateableArc = rdfs.GetResource(PREFIX_NS_EM + "updateable"); + var updateable = ds.GetTarget(e, updateableArc, true); + updateable = updateable.QueryInterface(Components.interfaces.nsIRDFLiteral); + if (updateable.Value == "true") + var showUpdates = true; + } } if (showInstalls) @@ -1400,8 +1406,10 @@ function checkUpdatesAll() { // To support custom views we check the add-ons displayed in the list var items = []; var children = gExtensionsView.children; - for (var i = 0; i < children.length; ++i) - items.push(gExtensionManager.getItemForID(getIDFromResourceURI(children[i].id))); + for (var i = 0; i < children.length; ++i) { + if (children[i].getAttribute("updateable") != "false") + items.push(gExtensionManager.getItemForID(getIDFromResourceURI(children[i].id))); + } if (items.length > 0) { showProgressBar(); @@ -1757,6 +1765,7 @@ var gExtensionsViewController = { gExtensionsViewController.onCommandUpdate(); updateGlobalCommands(); gExtensionsView.selectedItem.focus(); + updateOptionalViews(); }, cmd_disable: function (aSelectedItem) @@ -1789,6 +1798,7 @@ var gExtensionsViewController = { gExtensionManager.disableItem(id); gExtensionsViewController.onCommandUpdate(); gExtensionsView.selectedItem.focus(); + updateOptionalViews(); }, cmd_enable: function (aSelectedItem) @@ -1796,6 +1806,7 @@ var gExtensionsViewController = { gExtensionManager.enableItem(getIDFromResourceURI(aSelectedItem.id)); gExtensionsViewController.onCommandUpdate(); gExtensionsView.selectedItem.focus(); + updateOptionalViews(); } } }; diff --git a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in index 73d7ebd98965..edd9e9c52980 100644 --- a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in +++ b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in @@ -8134,9 +8134,7 @@ ExtensionsDataSource.prototype = { _rdfGet_updateable: function(item, property) { var id = stripPrefix(item.Value, PREFIX_ITEM_URI); var opType = this.getItemProperty(id, "opType"); - if (opType == OP_NEEDS_INSTALL || opType == OP_NEEDS_UNINSTALL || - opType == OP_NEEDS_UPGRADE || - this.getItemProperty(id, "appManaged") == "true") + if (opType != OP_NONE || this.getItemProperty(id, "appManaged") == "true") return EM_L("false"); if (getPref("getBoolPref", (PREF_EM_ITEM_UPDATE_ENABLED.replace(/%UUID%/, id), false)) == true) diff --git a/toolkit/themes/pinstripe/mozapps/extensions/extensions.css b/toolkit/themes/pinstripe/mozapps/extensions/extensions.css index b549f0bf1150..6ce513648b32 100644 --- a/toolkit/themes/pinstripe/mozapps/extensions/extensions.css +++ b/toolkit/themes/pinstripe/mozapps/extensions/extensions.css @@ -67,7 +67,7 @@ richlistbox[focused] richlistitem[selected="true"][isDisabled="true"] { margin-bottom: 2px; } -richlistitem[selected="true"][opType="none"] .descriptionCrop { +richlistitem[selected="true"]:not([opType]) .descriptionCrop { display: none; } @@ -128,11 +128,13 @@ richlistitem .notifyBadge { } .updateBadge, +.updateAvailableBox, .notifyBadge { display: none; } -richlistitem[availableUpdateURL] .updateBadge, +richlistitem[availableUpdateURL][updateable="true"] .updateBadge, +richlistitem[availableUpdateURL][updateable="true"] .updateAvailableBox, richlistitem[compatible="false"] .notifyBadge, richlistitem[blocklisted="true"] .notifyBadge, richlistitem[satisfiesDependencies="false"] .notifyBadge { @@ -205,11 +207,6 @@ richlistitem[opType="needs-uninstall"] .blocklistedBox { display: none; } -richlistitem[opType="needs-uninstall"] .updateAvailableBox, -richlistitem[availableUpdateURL="none"] .updateAvailableBox { - display: none; -} - richlistitem[loading="true"] .updateBadge { display: -moz-box; width: 16px; @@ -252,7 +249,6 @@ richlistitem[opType="needs-disable"] .needsDisable { display: -moz-box; } -richlistitem[opType="needs-uninstall"] .updateBadge, richlistitem[opType="needs-uninstall"] .notifyBadge { display: none; } diff --git a/toolkit/themes/winstripe/mozapps/extensions/extensions.css b/toolkit/themes/winstripe/mozapps/extensions/extensions.css index ca5d59c308b5..0fd5db632404 100644 --- a/toolkit/themes/winstripe/mozapps/extensions/extensions.css +++ b/toolkit/themes/winstripe/mozapps/extensions/extensions.css @@ -125,7 +125,7 @@ richlistbox[focused] richlistitem[selected="true"][isDisabled="true"] { margin-bottom: 2px; } -richlistitem[selected="true"][opType="none"] .descriptionCrop { +richlistitem[selected="true"]:not([opType]) .descriptionCrop { display: none; } @@ -197,11 +197,13 @@ richlistitem .notifyBadge { } .updateBadge, +.updateAvailableBox, .notifyBadge { display: none; } -richlistitem[availableUpdateURL] .updateBadge, +richlistitem[availableUpdateURL][updateable="true"] .updateBadge, +richlistitem[availableUpdateURL][updateable="true"] .updateAvailableBox, richlistitem[compatible="false"] .notifyBadge, richlistitem[blocklisted="true"] .notifyBadge, richlistitem[satisfiesDependencies="false"] .notifyBadge { @@ -274,11 +276,6 @@ richlistitem[opType="needs-uninstall"] .blocklistedBox { display: none; } -richlistitem[opType="needs-uninstall"] .updateAvailableBox, -richlistitem[availableUpdateURL="none"] .updateAvailableBox { - display: none; -} - richlistitem[loading="true"] .updateBadge { display: -moz-box; width: 16px; @@ -321,7 +318,6 @@ richlistitem[opType="needs-disable"] .needsDisable { display: -moz-box; } -richlistitem[opType="needs-uninstall"] .updateBadge, richlistitem[opType="needs-uninstall"] .notifyBadge { display: none; }