-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some sites show as completely white after a fraction of second (Firefox 102) #41
Comments
I just tried https://github.com/jaatroko/link-status-redux, https://www.microsoft.com/fi-fi/ and https://www.bugzilla.org/ with Firefox 102.0b3 (Linux 64-bit) and they all work normal for me. Did you try with a clean profile with only LSR installed? |
Just now, and this is very strange indeed. Have both processes with -no-remote open and in fresh one everything does indeed work correctly but not with my old one, both having only this plugin enabled. Hmmm... |
Let me know if you find the cause. |
Got it, occurs with the dark firefox theme.
|
With Firefox 102.0b3 using LSR with dark theme on certain pages (I'm guessing those that have certain kind of adjustments for light/dark mode) makes the whole page white. The culprit is a (pseudo-)layer between the overlay iframe and the overlay document that is white with dark theme but (properly) transparent with light theme. This seems to be a Firefox bug as it affects only the dark theme(s) and it was not present in earlier versions. The color/transparency of the layer cannot be directly addressed in CSS, but setting the property "color-scheme: light dark" for both the iframe *and* the overlay document root seems to fix the problem.
After some digging I found the cause and pushed a workaround, see commit b4f3cdf for details. This seems to be a Firefox bug. Seeing as you are using Firefox Beta, I think you are more prepared to file a Firefox bug than I, so I will leave it to you. Before I publish a new version at AMO I will check if there is some code cleanup I could do, so it will take from a few days to a week. In the meantime you can load the Github master as a temporary addon for testing. |
Firefox bug report filed: https://bugzilla.mozilla.org/show_bug.cgi?id=1772740 |
Version 3.15 now available from AMO. |
Don't know it that will help, but I've also encountered a "white problem". I initially thought that it was a conflict between "Link Status Redux" and "SingleFile" (another extension). There's a thread about it here: The problem started today, after both SingleFile and Firefox were updated (I've been using both SingleFile and Link Status Redux for a while, and never had a problem with either). Reverting to a previous version of SingleFile didn't fix the problem. So Firefox becomes the main suspect (since Link Status Redux wasn't updated today). But SingleFile's author also mentioned, in the same thread, that there's a "Link Status Redux" tag that might be involved in the problem. A problem that was latent before today's Firefox update. |
As switching to a light theme fixes the problem with SingleFile, this is indeed the same Firefox bug but the CSS workaround does not work with SingleFile. I have not looked at the code, but my guess is that SingleFile does something (possibly modifying the color-scheme property?) to the page HTML/CSS which breaks the workaround. I'll reopen and leave this issue open until the Firefox bug is properly resolved, so it will be more easily found by people encountering similar problems. |
Hi @jaatroko, author of SingleFile here. I tried to understand what could cause this issue on my end. For example, I tried to remove all the CSS injected by SingleFile in the editor and its iframe. I also removed |
My bad, I did not see there was a shadow root content... The issue can be circumvented by removing BTW, when your extension is installed on my machine, I see white flashes when refreshing pages on Github. This might be related to this issue. I use Firefox Nightly. |
While it may have worked with the conflict with SingleFile (did you test with light theme?), the color-scheme property cannot be removed without breaking the workaround. Let me elaborate a bit on the comments (and content) of the workaround commit b4f3cdf. First I determined that there is a CSS-inaccessible layer between the iframe and its content: setting the iframe content background to red results in a red screen always, but setting instead the iframe background to red results in a white screen on affected sites when using a dark theme and a red screen otherwise. With this information I stumbled upon the workaround as follows: search the web for CSS and light/dark theme => ah-ha! color-scheme property, what's this? => let's try it => seems to work with some combinations, though I'm not quite sure why. Originally I did not test all the color-scheme combinations. I did that now (Firefox 102) with an unaffected "normal" site (www.example.com) and an affected (presumably those that conform to browser light/dark theme) site (this issue page) with the following results:
So there are in fact four combinations with which the workaround works. The color-scheme documentation is a bit vague, but I would say for an addon with fixed colors (determined by addon preferences) the semantically correct value would be either "normal" or "light dark", so that makes "light dark" the one to use. Looking at the results it seems that when the color-scheme of the iframe (possibly inherited from the enclosing page) and the iframe content disagree, Firefox 102+ tries to "fix" it by setting the background to white or black, when the background (probably) should be transparent like it was for Firefox 101 and earlier. |
This could be caused by the iframe content CSS not being applied immediately, resulting in a transient "light dark"-"normal" combination from the table above. |
Is iframe really necessary? Wasn't absolutely positioned div enough to show the visited link information? (just asking, having no clue myself) EDIT: Sorry, wrong button. |
Purely for layout, no. For privacy protection and resistance to tampering, yes. If the addon UI elements are directly in the page DOM, then the page javascript can (maliciously, carelessly, or otherwise) a) change the UI elements and b) read their content. The content of the elements can include private information, in the case of LSR link visit/bookmarked/open status and visit time. A closed shadow DOM is supposed to offer the same protections, but apperently it does not, not quite anyway. See issue #7 for more information. |
I see. So not only this method is not perfectly secure but we now also have Firefox behave incorrectly when it's used in conjunction with certain Firefox personalization, like themes. |
Change the color-scheme combination so that the workaround works even when the iframe content is not (yet) loaded, in which case the empty content will have the default "normal" color-scheme. This should fix white flickering with dark theme when (re)loading a page, and hopefully also compatibility issues with web pages and other addons (such as SingleFile mentioned in the issue).
Version 3.17 now available from AMO. It uses the "light"-"normal" color-scheme combination, which should fix the SingleFile issue and the refresh-flickering, and also be more robust with other similar situations (provided that Firefox does not change its behavior about this). I will still leave this issue open for a few weeks so that it is easier to find in case of possible problems that are not covered by this fix. |
Just updated to LSR v3.17, and I confirm that it does fix the problem with SingleFIle. Thank you so much! :-) |
I'm beginning to understand the reasoning here. It is about the default document colors, the color of the page "canvas". In theory, the coloring of unstyled (with CSS, or with HTML color properties before CSS) documents has always been up to the browser (or the user of the browser). E.g. Netscape Navigator in the nineties had black-on-grey default colors, at least on some platforms. But then, now a long time ago, black-on-white (with blue links and purple visited links) became the de-facto standard default color scheme. Where this becomes problematic is when website authors specify colors only for some elements and assume that everything left unstyled is black-on-white. Then more recently light/dark theming gains popularity, and the new (implemented 2019 and later) CSS color-scheme property is added. In theory there should be no problems just changing the page color scheme according to the theme, but due to the assumptions mentioned above there needs to be the default/legacy value "normal", which is in effect equivalent to "light". The default background of an iframe is transparent (like it is for a normal div), meaning that the iframe content page is in effect drawn on the "canvas" of the page containing the iframe. However, the enclosing page and the iframe content may not have any relation to each other, so light/dark-theming the enclosing page can cause problems if the (implicit, in case of "normal"/default) color-scheme of the iframe content disagrees with it. In this case Firefox 102+ inserts a second "canvas" between the iframe and its content, colored white or black according to the (active) color-scheme of the iframe content. Unfortunately this breaks designs that rely on transparent iframes. I don't know whether this change in Firefox 102 is the right thing to do, as it breaks existing functionality, but it does seem to have a logic behind it. And, being intentional, it may not be a "bug" in that sense. |
I was searching their bugzilla a bit before and stumbled upon this: https://bugzilla.mozilla.org/show_bug.cgi?id=1738380 ("Figure out what we want to do wrt color-scheme and iframes.") |
After reading that bug report, as well as the linked w3c/csswg-drafts#4772, https://www.w3.org/TR/css-color-adjust-1/#color-scheme-effect and https://fvsch.com/transparent-iframes, this seems to be exactly it. If I was an actual, full-time web developer, then maybe I would know more about what is happening in the web standards world, because what I was able to reverse-engineer above about Firefox behavior is exactly what was added to the CSS spec. As Firefox 102 is doing what the CSS spec says it should do, this is technically a LSR bug, so updating the labels accordingly. Reading through section 2 of the CSS spec (the second link above) it seems that to be safe the div+iframe color-scheme should be "light only" instead of just "light" so it cannot be overridden. I will publish a new version with this change. As we are dealing with spec-conformant behavior, I can be reasonably confident that this fixes the issue "permanently", so no need to keep the issue open for better visibilty. |
Actually reading the relevant part of the CSS spec (https://www.w3.org/TR/css-color-adjust-1/ section 2) indicates that we should additionally use the "only" keyword so that the color-scheme cannot be overridden by the browser.
Version 3.18 now available from AMO. |
In Firefox v102.0b3 some sites flash with content and go completely blank (white) when this plugin is enabled (github repository view, microsoft, bugzilla). After turning the plugin off the site shows normally (tried with all plugins disabled, just toggling this one).
Console records: "Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”)."
A list of blacklisted domains may be sufficient if this problem can't be fixed.
The text was updated successfully, but these errors were encountered: