rugk/website-dark-mode-switcher

Interference with other addons/settings? (privacy.resistFingerprinting)

ArchangeGabriel opened this issue · 15 comments

Bug description

On my system, it works on some websites (https://bugzilla.mozilla.org/, https://stuffandnonsense.co.uk), but not on most (https://kde.org, https://emojipedia.org/, https://webkit.org/, https://pinafore.social/…).

Steps to reproduce

  1. I have several add-ons like uBlock Origin, uMatrix, Dencentraleyes.
  2. I have numerous settings from https://github.com/ghacksuserjs/ghacks-user.js/ including privacy.resistFingerprinting (which overrides ui.systemUsesDarkTheme and makes this add-on necessary for dark theme to work at all).

Actual behaviour

Most websites that are supposed don’t get dark theme.

Expected behaviour

Those websites get dark theme.

System

Operating system and version: Arch Linux
Browser and version: Firefox Nightly
Add-on version: 1.1

Other example of non-working website (much simpler, so maybe interesting to understand what is happening): https://septatrix.github.io/cpython-dark-docs/

rugk commented

Hmm, are you really sure it is an incompatibility, i.e. with all these add-ons disabled it works? May also just depend on the website.

For me it works like this:

Also note the issue #9 has been fixed in master, but not yet released on AMO. 🤔 (did not notice a difference with the site you've provided)


So if it is true that other add-ons/settings cause this, could you please try to disable them one by one and test which one exactly is causing this?

rugk commented

Also notice that websites could detect the presence of this add-on (due to such bugs) and at least detect whether you have a dark theme enabled, which obviously goes against the aim of privacy.resistFingerprinting. 😃

Yes I know that this goes against privacy.resistFingerprinting, but this is trade-off I can accept.

If I disable privacy.resistFingerprinting, all websites work excepted https://pinafore.social/ (but I do have ui.systemUsesDarkTheme set to 1). So likely not an add-on, but just this option is causing the issue.

So if I set ui.systemUsesDarkTheme to 0 and disable privacy.resistFingerprinting, I get only the first two working. I suppose that without a proper API there’s not so much we can do.

rugk commented

FYI: AFAIK, Firefox usually prevents ui.systemUsesDarkTheme (and a dark theme in general) from working, if privacy.resistFingerprinting is enabled.

Also an update on #22 (comment): The fix for issue #9 has now been released with v1.2 of this add-on.

AFAICT:

https://kde.org/ works (now).

https://pinafore.social/ doesn't attach any "change" event listeners.

https://septatrix.github.io/cpython-dark-docs/ does not work due to #24.

https://stuffandnonsense.co.uk/ is currently "not working" due to the site's own fault: it specifies the color white (#fff) for the background in dark mode, for example.

I don't think this has anything to do with privacy.resistFingerprinting; I'm running with it turned on myself.

The main problem this addon has, is that it only adds css overrides extracted from media query preferred dark, but seems to be unable to remove the css from media query preferred light.

See how it here says "light dark":
https://codepen.io/kleinfreund/pen/NmpKZM

rugk commented

The main problem this addon has, is that it only adds css overrides extracted from media query preferred dark, but seems to be unable to remove the css from media query preferred light.

That is correct. This is unfortunately a fundamental technical limitation, as explained in the Readme.

rugk commented

So I have good news and bad news:

I'm sorry for that, but there is nothing I can do about that with a reasonable future support path. You can continue using v1.3 if that works for you that uses the old mechanism of manually reading and re-injecting the style-sets etc.
However, the new API provides more possibilities and also fixes a lot of edge-cases, where the old version just reached it's limits (see all the bug reports that were close, cf. #41). It did never work that well as it does now, and was always considered a workaround until a real API is available.
As such, I am very sorry, but as it seems this add-on currently cannot support and work with privacy.resistFingerprinting.

If your are affected by this and want to have this issue fixed, please feel free to look or open a Bugzilla report and make it possible for add-ons, or the layout.css.prefers-color-scheme.content-override config option in general, to override the chosen theme.

rugk commented

BTW opened #52 to show an inline-warning when this setting is enabled.