Closed Bug 610686 Opened 14 years ago Closed 14 years ago

Cached copies of Addon objects for lightweight themes don't have the correct permissions and pendingOperations during the onEnabling event

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla2.0b8
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: ahoza, Assigned: mossop)

Details

Attachments

(2 files)

Steps to reproduce: 1. Wear 2-3 lightweight themes from www.getpersonas.com 2. Install a theme from AMO. (e.g: https://addons.mozilla.org/en-US/firefox/addon/122/) 3. Open Add-ons Manager-> Appearance. 4. Enable one of the lightweight themes from step 1. Expected results: Lightweight themes is worn on top of the installed theme from AMO. or A restart is required and after restart the lightweight theme is worn on top of default theme. or "Enable" button is disabled for lightweight themes until "Default" theme is selected. Actual results: Nothing happens
Component: Theme → Add-ons Manager
Product: Firefox → Toolkit
QA Contact: theme → add-ons.manager
For me after step 4 I see Firefox using the lightweight theme on top of the default theme with no restart required. This is what I would expect. You said that "Nothing happens" for you, does that mean the lightweight theme you enabled in step 4 didn't get used?
The Restart Now button should appear for the theme you have installed from AMO, once you try to enable a Personas. Doesn't it happen? Can you please attach a screenshot? Also which build are you using?
If that is not obvious enough, bug 553460 could be the possible fix.
(In reply to comment #2) > The Restart Now button should appear for the theme you have installed from AMO, > once you try to enable a Personas. Doesn't it happen? Can you please attach a > screenshot? Also which build are you using? You're right, the Restart button appears for the theme installed from AMO. But this could be confusing as one chose to enable the lightweight persona and did nothing with the theme (Disable or Remove it) I'm using release candidate build for 4.0 beta 7, buildID: Mozilla/5.0 (Windows NT 6.1; rv:2.0b7) Gecko/20100101 Firefox/4.0b7
Attached image Screenshot
(In reply to comment #5) > Created attachment 489432 [details] > Screenshot At what point in the process is that? What themes did you install leading up to that?
Nevermind I see what is happening. The UI isn't updating properly when making changes that affect both a theme and a lightweight theme. Switching panes shows the correct display.
blocking2.0: --- → betaN+
Summary: Switch between a theme and a lightweight theme → UI needs to update correctly when switching between a custom theme and a lightweight theme.
The problem is that there is a small hack in place to ensure that the permissions and pendingOperations of an Addon for a lightweight theme are correct during the onEnabling event. This hack only applies to the object sent with the event, older cached versions of the Addon object do not have the right values. The UI works with cached copies so it fails to update the state correctly.
Assignee: nobody → dtownsend
Summary: UI needs to update correctly when switching between a custom theme and a lightweight theme. → Cached copies of Addon objects for lightweight themes don't have the correct permissions and pendingOperations during the onEnabling event
Attached patch patch rev 1Splinter Review
Rather than caching in the AddonWrapper instance that it is being enabled instead just cache it globally so old instances can see it.
Attachment #489530 - Flags: review?(robert.bugzilla)
Whiteboard: [has patch][needs review rs]
Comment on attachment 489530 [details] [diff] [review] patch rev 1 >diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm >--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm >+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm >@@ -82,16 +82,21 @@ __defineGetter__("_maxUsedThemes", funct > return this._maxUsedThemes; > }); > > __defineSetter__("_maxUsedThemes", function(aVal) { > delete this._maxUsedThemes; > return this._maxUsedThemes = aVal; > }); > >+// Holds the ID of the theme being enabled while sending out the events so >+// cached AddonWrapper instances can return correct values for permissions and >+// pendingOperations >+var _themeBeingEnabled = null; nit: might be better named as _themeIDBeingEnabled or _enablingThemeID but I'll leave that up to you since I think the comment is enough >... >@@ -396,17 +403,17 @@ var LightweightThemeManager = { > aCallback([new AddonWrapper(a) for each (a in this.usedThemes)]); > }, > }; > > /** > * The AddonWrapper wraps lightweight theme to provide the data visible to > * consumers of the AddonManager API. > */ nit: would be nice to cleanup the comments in this file so they specify param and return but last I looked there was enough cleanup to justify a bug for it. r=me with or without the above though I'd like either a bug to cleanup the comments or AddonWrapper cleaned up if a bug isn't filed.
Attachment #489530 - Flags: review?(robert.bugzilla) → review+
Whiteboard: [has patch][needs review rs] → [has patch]
(In reply to comment #10) > Comment on attachment 489530 [details] [diff] [review] > patch rev 1 > > >diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm > >--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm > >+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm > >@@ -82,16 +82,21 @@ __defineGetter__("_maxUsedThemes", funct > > return this._maxUsedThemes; > > }); > > > > __defineSetter__("_maxUsedThemes", function(aVal) { > > delete this._maxUsedThemes; > > return this._maxUsedThemes = aVal; > > }); > > > >+// Holds the ID of the theme being enabled while sending out the events so > >+// cached AddonWrapper instances can return correct values for permissions and > >+// pendingOperations > >+var _themeBeingEnabled = null; > nit: might be better named as _themeIDBeingEnabled or _enablingThemeID but I'll > leave that up to you since I think the comment is enough _themeIDBeingEnabled seems to be a better choice. > nit: would be nice to cleanup the comments in this file so they specify param > and return but last I looked there was enough cleanup to justify a bug for it. Filed bug 611380
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Flags: in-litmus-
Resolution: --- → FIXED
Whiteboard: [has patch]
Target Milestone: --- → mozilla2.0b8
Backed out due to windows debug test failures
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Re-landed as this wasn't the cause of the bustage: http://hg.mozilla.org/mozilla-central/rev/82da3fec03fc
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Verified fixed with Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b12pre) Gecko/20110209 Firefox/4.0b12pre ID:20110209030359
Status: RESOLVED → VERIFIED
Hardware: x86 → All
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: