Repository navigation
Description
### What is the problem?
Just noticed the latest update (v2.12.8) for ViolentMonkey in Firefox is rather broken (to what extent the new issues affect other userscripts, I am unsure). There are no issues in Chromium based browsers as far as I can tell. I might not have noticed anything if a userscript for a radio site that I use was not working because of it. It is not an issue with the userscript I am using (presumably), as it has not been updated since October, and it works correctly in ViolentMonkey in chromium based browsers (it also works correctly in TamperMonkey, etc, in either browser). I verified this on multiple versions of Windows using the latest Firefox ESR channel.
Why Firefox ESR (Extended Support Release)? The main release channel for Firefox is cancer IMO, rapid lifecycle development (aka rapid issue development), too many changes/features/preferences to keep up with between updates (and issues/problems as a result - like its a forever beta version).
As a note, downgrading ViolentMonkey to the last working version v2.12.7 (from February, before the update) fixes the issue (for now).
New Warning (with v2.12.8) from the Remote Debugging panel:
Reading manifest: Warning processing permissions: Error processing permissions.9: Value "declarativeContent" must either: must either [must either [must either [must either [be one of ["idle"], be one of ["menus.overrideContext"], be one of ["search"], be one of ["activeTab"], be one of ["cookies"], or be one of ["webRequest", "webRequestBlocking"]], be one of ["clipboardRead", "clipboardWrite", "geolocation", "notifications"], be one of ["bookmarks"], be one of ["browsingData"], be one of ["devtools"], be one of ["find"], be one of ["history"], be one of ["pkcs11"], be one of ["sessions"], be one of ["tabs", "tabHide"], be one of ["topSites"], be one of ["browserSettings"], be one of ["downloads", "downloads.open"], be one of ["management"], be one of ["privacy"], be one of ["proxy"], or be one of ["webNavigation"]], be one of ["alarms", "mozillaAddons", "storage", "unlimitedStorage"], be one of ["captivePortal"], be one of ["identity"], be one of ["menus", "contextMenus"], be one of ["normandyAddonStudy"], be one of ["geckoProfiler"], be one of ["urlbar"], be one of ["contextualIdentities"], be one of ["dns"], be one of ["activityLog"], be one of ["networkStatus"], be one of ["telemetry"], or be one of ["theme"]], must either [must either [be one of ["idle"], be one of ["menus.overrideContext"], be one of ["search"], be one of ["activeTab"], be one of ["cookies"], or be one of ["webRequest", "webRequestBlocking"]], be one of ["clipboardRead", "clipboardWrite", "geolocation", "notifications"], be one of ["bookmarks"], be one of ["browsingData"], be one of ["devtools"], be one of ["find"], be one of ["history"], be one of ["pkcs11"], be one of ["sessions"], be one of ["tabs", "tabHide"], be one of ["topSites"], be one of ["browserSettings"], be one of ["downloads", "downloads.open"], be one of ["management"], be one of ["privacy"], be one of ["proxy"], or be one of ["webNavigation"]], be one of ["nativeMessaging"], or match the pattern /^experiments(\.\w+)+$/], or must either [be one of ["<all_urls>"], must either [match the pattern /^(https?|wss?|file|ftp|\*):\/\/(\*|\*\.[^*/]+|[^*/]+)\/.*$/, or match the pattern /^file:\/\/\/.*$/], or match the pattern /^resource:\/\/(\*|\*\.[^*/]+|[^*/]+)\/.*$|^about:/]
### How to reproduce it?
- Install Firefox ESR http://www.mozilla.org/en-US/firefox/organizations/all.html
- Install or update ViolentMonkey to v2.12.8 (in Firefox), grant the extension whatever permissions it needs
- View the Remote Debugging panel from the URL bar 'about:debugging#/runtime/this-firefox'
- Notice the new Warning listed for ViolentMonkey with errors about processing permissions etc. (this new Warning, posted above for reference, did not exist in the previous v2.12.7)
- Install https://github.com/lethak/LTKDIFMU-userscript by @lethak
- Navigate the internet, with Firefox, to any of the destination sites supported from the LTKDIFMU userscript by @lethak (the supported sites that the script functions on, are mentioned on the github page - all are affected).
### What is the expected result?
When the script has been initialized, any trial banners are removed from the page, new buttons/functions are added on the control bar at the bottom of the page, and it prompts with a short notification (in page) that says "DIUserscript: Enjoy free uninterrupted music and enhanced features"
### What is the actual result?
The script basically does not load nor function. No functions of the script appear to be injected. The 'Start Free Premium Trial' banner remains in the header, none of the buttons/functions the script adds are loaded, and there is no notification from the script that it has even initialized.
As noted above, everything appears to be functioning correctly in Chromium based browsers (with the latest version of ViolentMonkey), AND when downgrading to the previous v2.12.7 release (in Firefox only), everything appears to be functioning correctly as well.
### Environment
- Browser: Firefox ESR
- Browser version: 78.6.0esr
- Violentmonkey version: 2.12.8
- OS: Win7sp1 / Win10 1809-20H2 Home/Pro (x64)
Activity
tophf commentedon Dec 29, 2020
document.headbeing available but@run-at document-startby definition doesn't give a guarantee thatheadorbodyexist because this mode runs userscripts as early as possible, when onlydocument.documentElementis guaranteed to be present so the userscript should use it instead ofdocument.head. Old Violentmonkey was simply slower to inject userscripts whereas the new Violentmonkey is faster so now it implements userscript specification correctly.bunkhub commentedon Dec 29, 2020
So it is working as intended to cause the script to fail to function in firefox? When the issue doesn't exist in other browsers, nor other userscript managers? I should divert the problem (in question) to the developer of the userscript (in question), even though (apparently and/or presumably) it is not an issue with their userscript (either), since it functions in other browsers and other userscript managers (as well as ViolentMonkey, but in chromium source browsers only)? OR would you suggest maybe it is just an issue with FirefoxESR - because the issue is definitely able to be replicated, and with an unmodified Firefox profile as well (meaning freshly installed, no settings changed, only ViolentMonkey installed after + the userscript in question).
tophf commentedon Dec 29, 2020
Are you trying to be sarcastic? Because if you are, I'll consider you a troll and just lock down the issue. The "working as intended" refers to the specified behavior of
@run-at document-start. It's not something we invented. Just because the author of that userscript or you didn't encounter the same problem in other managers or browsers doesn't mean that always has been so or will always be. The only guaranteed element in DOM at this stage isdocument.documentElement.bunkhub commentedon Dec 29, 2020
No, I am genuinely not trying to be sarcastic, this is meant to be legitimate questions based on the issue that I am experiencing with the extension - in terms of isolating the experience relative to the ViolentMonkey userscript manager. My apologies if it comes off some other way.
I will consider the topic closed, I will just await an update or something in the future that maybe resolves itself. Thanks for the replies.
tophf commentedon Dec 29, 2020
Thing is, the only proper solution is for the userscript author to use
document.documentElementor wait fordocument.headto appear (using MutationObserver). Their current approach works only by accident, thanks to the inherently bugged implementation ofdocument-startin some userscript managers. If you set Tampermonkey to "instant" injection mode, which implementsdocument-startproperly, the userscript will also fail. It will also fail in any Firefox userscript manager that uses the built-in UserScripts API e.g. GreaseMonkey 4 or FireMonkey.If the author doesn't want to fix their script for any weird reason, you can try setting the script to run at
document-endordocument-bodyin Violentmonkey's editor:P.S.
document-bodywas added recently so it's present only in beta, IIRC.bunkhub commentedon Dec 29, 2020
I manually flipped the 'run-at' setting in ViolentMonkey to 'document-end' - and I will confirm that the LTKDIFMU-userscript appears to be functioning again. I do not have the 'document-body' option, as I am not running the latest beta.
Thanks for the suggested resolution. I have cross-posted the issue that I have experienced to the LTKDIFMU-userscript developer here, should there be any changes that might be made on their end, and/or for others that might be experiencing the same issue.
Edit note: originally stated that manually setting the 'document-start' variable, OR 'document-end' both worked - this is incorrect, as I lost track of which version of the extension I was working with across different browser installations (my mistake). ONLY 'document-end' works with v2.18.8. So I edited this post to reflect that change. However, I have not tested all features - it appears to mostly be working correctly albeit a minor GUI issue with the volume slider. I might try the latest beta soon.