Improve add-on manager to support lightweight themes

VERIFIED FIXED

Status

VERIFIED FIXED
8 years ago
8 years ago

People

(Reporter: fabrice, Assigned: fabrice)

Tracking

Trunk
All
Linux
Bug Flags:
in-testsuite ?

Details

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
Currently the add-on manager does nothing special for themes. For instance, it should take care of having only one theme enabled at most.
(Assignee)

Comment 1

8 years ago
Created attachment 492854 [details] [diff] [review]
fix
Assignee: nobody → fabrice
Attachment #492854 - Flags: review?(mark.finkle)
want!
Comment on attachment 492854 [details] [diff] [review]
fix

># HG changeset patch
># User Fabrice Desré <fabrice@mozilla.com>
># Parent abc1448defe9a447b112c624a38861d96fb660ac
>Bug 614442 - Improve add-on manager to support lightweight themes
>
>diff --git a/chrome/content/extensions.js b/chrome/content/extensions.js
>--- a/chrome/content/extensions.js
>+++ b/chrome/content/extensions.js
>@@ -313,7 +313,7 @@ var ExtensionsView = {
>         listitem.setAttribute("appDisabled", addon.appDisabled);
>         listitem.setAttribute("appManaged", appManaged);
>         listitem.setAttribute("description", addon.description);
>-        listitem.setAttribute("optionsURL", addon.optionsURL);
>+        listitem.setAttribute("optionsURL", addon.optionsURL ? addon.optionsURL : "");
>         listitem.setAttribute("opType", opType);
>         listitem.setAttribute("updateable", updateable);
>         listitem.setAttribute("isReadonly", !uninstallable);
>@@ -366,7 +366,23 @@ var ExtensionsView = {
>       aItem.setAttribute("isDisabled", false);
>       aItem._engine.hidden = false;
>       opType = "needs-enable";
>-    } else {
>+    } else if (aItem.getAttribute("type") == "theme") {
>+      // we can have only one theme enabled, so disable the current one if any
>+      let currentTheme = null;
>+      let cur = this._localItem.nextSibling;
>+      while (cur != this._repoItem) {
>+        if (cur.addon && (cur.addon.type == "theme") && (cur.addon.isActive)) {
>+          currentTheme = cur;
>+          break;
>+        }
>+        cur = cur.nextSibling;
>+      }
>+      if (currentTheme)
>+        this.disable(currentTheme);
>+      aItem.addon.userDisabled = false;
>+      aItem.setAttribute("isDisabled", false);
>+    }
>+    else {
>       aItem.addon.userDisabled = false;
>       opType = this._getOpTypeForOperations(aItem.addon.pendingOperations);
> 
>@@ -385,6 +401,9 @@ var ExtensionsView = {
>       aItem.setAttribute("isDisabled", true);
>       aItem._engine.hidden = true;
>       opType = "needs-disable";
>+    } else if (aItem.getAttribute("type") == "theme") {
>+      aItem.addon.userDisabled = true;
>+      aItem.setAttribute("isDisabled", true);
>     } else {
>       aItem.addon.userDisabled = true;
>       opType = this._getOpTypeForOperations(aItem.addon.pendingOperations);
Attachment #492854 - Flags: review?(mark.finkle) → review+
bah!

pushed:
http://hg.mozilla.org/mobile-browser/rev/8360ae1a01af
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
It'd be nice to have some testscripts associated to this patch.
Flags: in-testsuite?

Comment 6

8 years ago
VERIFIED FIXED on:

Mozilla /5.0 (Android;Linux armv7l;rv:7.0a1) Gecko/20110530 Firefox/7.0a1 Fennec/7.0a1 

Mozilla /5.0 (Android;Linux armv7l;rv:6.0a2) Gecko/20110530 Firefox/6.0a2 Fennec/6.0a2 

Device: HTC Desire Z (Android 2.2)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.