Closed Bug 1164178 Opened 9 years ago Closed 9 years ago

DevEdition theme is being reverted after restart in Aurora40.0a2

Categories

(Firefox :: Theme, defect)

40 Branch
Unspecified
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 41
Tracking Status
firefox39 --- unaffected
firefox40 + fixed
firefox41 --- unaffected

People

(Reporter: alice0775, Assigned: bgrins)

References

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

Build Identifier:
https://hg.mozilla.org/releases/mozilla-aurora/rev/e2ce1aac996e
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 ID:20150511122607

Aurora40.0a2 theme is broken since last Marge.

Steps to reproduce:
1. Install Aurora40.0a2 from http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-aurora-win32/1431416426/
2. Attempt to change theme to default from developer theme.
   You should disable Developer them from options
3. Restart

Actual Results:
Not Aurora default theme

Expected Results:
Persist Aurora default theme

And Toolbox/Toolbar items are transparent and title bar is also transparent on Windows7 Classic Visual style.
The transparency issue is probably caused by Bug 1158872 and using an accentcolor for the lightweight theme
Blocks: 1158872
(In reply to Alice0775 White from comment #0)
> Build Identifier:
> https://hg.mozilla.org/releases/mozilla-aurora/rev/e2ce1aac996e
> Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
> ID:20150511122607
> 
> Aurora40.0a2 theme is broken since last Marge.
> 
> Steps to reproduce:
> 1. Install Aurora40.0a2 from
> http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-
> aurora-win32/1431416426/
> 2. Attempt to change theme to default from developer theme.
>    You should disable Developer them from options
> 3. Restart
> 
> Actual Results:
> Not Aurora default theme
> 
> Expected Results:
> Persist Aurora default theme

If you've selected a different theme, I'd expect that it does not reopen with the dev edition theme but rather persists your selection (in this case the default theme).  Note that this behavior has changed for 40 since Bug 1148996 - it used to be that you went to customize mode to turn the theme on and off but now you do it as if it were any other theme.
Cutomize > Themes > Default 
I cannot change Dev theme in most case.
Sometimes, the appearances changed to default, but The dev theme returns after restart the browser.
I forgot to mention that I was tested with newly created profile.
(In reply to Alice0775 White from comment #4)
> Cutomize > Themes > Default 
> I cannot change Dev theme in most case.
> Sometimes, the appearances changed to default, but The dev theme returns
> after restart the browser.

What do you mean it can't change in most cases?  Is the button disabled or does pressing it do nothing, or something else?
(In reply to Brian Grinstead [:bgrins] from comment #6)
> (In reply to Alice0775 White from comment #4)
> > Cutomize > Themes > Default 
> > I cannot change Dev theme in most case.
> > Sometimes, the appearances changed to default, but The dev theme returns
> > after restart the browser.
> 
> What do you mean it can't change in most cases?  Is the button disabled or
> does pressing it do nothing, or something else?

Hovering mouse over "Default" changes appearances, but after click it returns to Dev theme.
I can also reproduce the problem(except transparency problem) on Ubuntu14.04.

https://hg.mozilla.org/releases/mozilla-aurora/rev/e2ce1aac996e
Mozilla/5.0 (X11; Linux i686; rv:40.0) Gecko/20100101 Firefox/40.0 ID:20150511122607
Clean profile;
Customize > Themes > Default click does not change theme.
Add-ons > Appearance. Default is not disabled and has no enable button.

Customize > Themes > Developer Edition - followed by - Themes > Default works.
Alternatively Add-ons > Appearance. Disable then enable Developer Edition to get enable button on default.
(In reply to Jonathan Howard from comment #9)
> Clean profile;
> Customize > Themes > Default click does not change theme.
> Add-ons > Appearance. Default is not disabled and has no enable button.
> 

yep

> Customize > Themes > Developer Edition - followed by - Themes > Default
> works.
> Alternatively Add-ons > Appearance. Disable then enable Developer Edition to
> get enable button on default.

What is the appearance of the browser after restart?
(In reply to Alice0775 White from comment #10)
> (In reply to Jonathan Howard from comment #9)
> > Customize > Themes > Developer Edition - followed by - Themes > Default
> > works.
> > Alternatively Add-ons > Appearance. Disable then enable Developer Edition to
> > get enable button on default.
> 
> What is the appearance of the browser after restart?

Goes back to Developer Edition
OK, so I tested this today and there are some issues in Customize mode, but Addons -> Appearance seems to be working as normal.

In my initial testing (on a clean profile on osx), I'm able to switch between themes fine in customize mode, but there is something confusing happening in the UI where both 'default' and 'developer edition' appeared selected.
The reason it keeps coming back after restart is that the lightweightThemes.selectedThemeID doesn't seem to be updated at all when choosing the default theme (I believe that pref should be deleted if the default theme is applied)
It seems the calls to deleteBranch are ineffective in Aurora after a restart: https://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/LightweightThemeManager.jsm#305.

Once it restarts, the default value of the pref is copied back over.  The most straightforward thing seems to be providing a default value of "" in non-aurora channels and then setting it to that when a theme is unapplied.
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Attached patch selectedtheme-id.patch (obsolete) (deleted) — Splinter Review
I didn't realize that after deleting a branch it gets recreated on the next startup if there is a default value specified.  This fixes the problem of the DE theme disappearing upon startup.
Attachment #8605500 - Flags: review?(gijskruitbosch+bugs)
(In reply to Brian Grinstead [:bgrins] from comment #15)
> This fixes the problem of
> the DE theme disappearing upon startup.

I mean fixes the problem of the DE theme 'reappearing' on startup if you've selected another one
Comment on attachment 8605500 [details] [diff] [review]
selectedtheme-id.patch

Review of attachment 8605500 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good besides the test change, but I clearly didn't do a good job reviewing this last time, so going to 302 to Dão to make sure we're not missing something again.

::: browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
@@ -50,5 @@
>       "There should be two themes in the 'My Themes' section");
>  
>    let defaultTheme = header.nextSibling;
>    defaultTheme.doCommand();
> -  is(Services.prefs.prefHasUserValue("lightweightThemes.selectedThemeID"), false, "No lwtheme should be selected");

Why doesn't the existing assertion continue to work here?
Attachment #8605500 - Flags: review?(gijskruitbosch+bugs)
Attachment #8605500 - Flags: review?(dao)
Attachment #8605500 - Flags: feedback+
(In reply to :Gijs Kruitbosch from comment #17)
> @@ -50,5 @@
> >       "There should be two themes in the 'My Themes' section");
> >  
> >    let defaultTheme = header.nextSibling;
> >    defaultTheme.doCommand();
> > -  is(Services.prefs.prefHasUserValue("lightweightThemes.selectedThemeID"), false, "No lwtheme should be selected");
> 
> Why doesn't the existing assertion continue to work here?

Because when we call  _prefs.setCharPref("selectedThemeID", "") it gets set as a user value (even though it's matching the default value).  Unfortunately I don't think we can just clearUserPref instead since in Aurora the default is different.
Comment on attachment 8605500 [details] [diff] [review]
selectedtheme-id.patch

>+pref("lightweightThemes.selectedThemeID", "");
>+
> // Developer edition preferences
> #ifdef MOZ_DEV_EDITION
> sticky_pref("lightweightThemes.selectedThemeID", "firefox-devedition@mozilla.org");
> sticky_pref("browser.devedition.theme.enabled", true);
> #endif

pref("lightweightThemes.selectedThemeID", ""); should be in an #else branch, i.e. you shouldn't be setting that pref twice in dev edition.

I also can't see a good reason for using sticky_pref here, you should probably just use pref.
Attachment #8605500 - Flags: review?(dao) → review+
(In reply to Dão Gottwald [:dao] from comment #19)
> I also can't see a good reason for using sticky_pref here, you should
> probably just use pref.

You mean on the declarations in the #if?  That was done in Bug 1098343 so that you could have different defaults across channels and not have them be reverted when switching back to the default.  When a user set pref ends up matching the other channel's default it is reset to default after closing.

In fact, the more I think about it it seems we should maybe use a sticky_pref for the new one as well.  Mark, if we have a sticky_pref for the aurora channel, I'm assuming that the matching pref for non-aurora channels should also be sticky?

DE theme applied -> "lightweightThemes.selectedThemeID" = "firefox-devedition@mozilla.org" (default on aurora)
No theme applied -> "lightweightThemes.selectedThemeID" = "" (default on all other channels)

I could see a situation where you are on aurora and disable the DE theme, thus setting it to "".  Then if you open release with that same profile, it would match the default value of the pref.  Once closing release, it would reset the pref to the default value.  And opening aurora again, you'd have the theme back on.  Is this right?
Flags: needinfo?(markh)
Yeah, AIUI sticky_pref *should* be used here regardless of the branch/ifdef.
Attached patch selectedtheme-id.patch (deleted) — Splinter Review
Preemptively copying over r+ even though I've changed it to sticky_pref.  Awaiting feedback from Mark before landing though.

Try push on Aurora:  https://treeherder.mozilla.org/#/jobs?repo=try&revision=6f48645b3eb5
Try push on fx-team: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0352811effc9
Attachment #8605500 - Attachment is obsolete: true
Attachment #8605879 - Flags: review+
Blocks: 1164952
Blocks: 1148996
No longer blocks: 1164952, 1158872
Summary: Aurora40.0a2 theme is broken → DevEdition theme is being reverted after restart in Aurora40.0a2
Blocks: 1164954
(In reply to Brian Grinstead [:bgrins] from comment #20)
> sticky_pref for the new one as well.  Mark, if we have a sticky_pref for the
> aurora channel, I'm assuming that the matching pref for non-aurora channels
> should also be sticky?

Yep - it should be sticky everywhere or nowhere.
Flags: needinfo?(markh)
remote:   https://hg.mozilla.org/integration/fx-team/rev/b46196bd9469
Whiteboard: [fixed-in-fx-team]
Comment on attachment 8605879 [details] [diff] [review]
selectedtheme-id.patch

Approval Request Comment
[Feature/regressing bug #]: 1148996
[User impact if declined]: On Aurora, the Dev Edition theme will be reapplied after a browser restart, even if the user has disabled it
[Describe test coverage new/current, TreeHerder]: The lightweight theming system has existing test coverage (it just doesn't handle browser restarts which is what triggered this bug).
[Risks and why]: Changing the default lightweight theme pref from undefined to "".  The theming system already gracefully handles this change, but an addon could have assumed this pref didn't exist.  Although this pref was only introduced in 39 (Bug 1094821)
[String/UUID change made/needed]:
Attachment #8605879 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/b46196bd9469
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 41
Attachment #8605879 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: