Closed Bug 1964468 Opened 13 days ago Closed 10 days ago

Updating the theme sometimes fails

Categories

(Toolkit :: Startup and Profile System, defect)

defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: jhirsch, Unassigned)

Details

Seeing this in today's nightly.

Open up about:editprofile, open up the browser toolbox debugger and set a breakpoint at the line where we add the "windowlwthemeupdate" listener, and a breakpoint at the first line of the "windowlwthemeupdate" callback inside SelectableProfileService (or add a console.log line in both spots).

Try changing the theme to a bunch of different themes, including System Theme.

The "windowlwthemeupdate" (or "lightweight-theme-styling-update") events sometimes don't seem to fire when switching between themes. The "windowlwthemeupdate" especially seems to not fire in the case of update the theme from a light theme to the System Theme when the OS is set to light mode.


Idea for a fix #1: could it be the "once" listener for "windowlwthemeupdate" causing some missed events? is "once" removing the listener async and causing some collision if it's repeatedly added and removed?

Idea for a fix #2: for default Profiles themes, avoid relying on events emitted by the addons code. We know which theme the user selected. We could just hard-code the values of themeFg and themeBg in ProfilesParent, and when we get the theme updated message in Profiles:UpdateProfileTheme, just set themeFg and themeBg to those values. And if we do have to fall back to getting the colors from the window (like what we do in the current "windowlwthemeupdate" callback), maybe we add a timeout when we attach the window listener, so that if we don't get the event within, say, 300 milliseconds (probably longer if Cu.isInAutomation or if we're in a debug build), we cancel the listener and just call the callback directly, so that we figure out themeBg and themeFg and set SelectableProfile.theme.

Hm. This behavior went away after a restart--but I'm not sure why

I haven't been able to reproduce this bug; closing for now as incomplete.

Status: NEW → RESOLVED
Closed: 10 days ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.