-
Notifications
You must be signed in to change notification settings - Fork 330
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
document.head is null when @run-at document-start #2515
Comments
Last good: Firefox 55.0a1 (2017-03-17) First bad: Firefox 55.0a1 (2017-03-17) Bug 1333990 is the suspect. See also #1849 |
@janekptacijarabaci Found a workaround:
It looks unstable and unreliable, but that's the simplest way I can found currently that make things work. |
...and the documentation is still wrong. |
I don't think this is a bug. If you want to execute later just use |
@the8472
But this breaks many scripts that try to add style before the page is rendered (if you use I'm not sure this is intentionally |
GM_addStyle is silly anyway, it just inserts a But if that is the actual concern it could be patched to check for the presence of |
@the8472 If the behavior of current
is needed for every script that add a style before I hope |
Yes, gm_addstyle should be fixed. But everything else a script might do also has to jump through the same hoops at document-start too, adding styles not special in that regard. Nothing of the DOM is available, so you have to wait for whatever you need. I.e. you need to use observers anyway if you run things at document-start. |
Thanks for the detailed report, but this is WAI, and the 3.x branch is ~dead anyway. (I, for one, welcome our new web extension overlords.) Things like Scripts like https://arantius.com/misc/greasemonkey/amazon-url-cleaner.user.js exist which don't need a DOM at all, and should run ASAP. |
1) a recent change in Firefox has broken the pattern of styling a page before it's displayed by calling GM_addStyle at document-start. [1] a workaround hasn't been (and won't be) implemented in Greasemonkey work around this by using a mutation observer to detect the creation of the head element before adding the style 2) fix FOSC on /r/firefox (the blue background) by hiding <html> rather than <body> [1] greasemonkey/greasemonkey#2515
due to greasemonkey/greasemonkey#2515 this statement breaks the head injections on line 15 and 19. the script does not appear to require running at document start, and works fine with the default (document-end)
Environment
Test user script:
Expect Result:
Actual Result:
This issue also applies to
GM_addStyle
The text was updated successfully, but these errors were encountered: