Shop Forum More Submit  Join Login

Firefox quantum is out and it feels great!


Many things became faster and the new UI is... not completely bad. I like how describing text is returning.

One thing that changed is what extensions can do and that they focus more on running asynchronous.
This means that the new Firefox requires new extension versions for various extensions. This also includes Greasemonkey.

And Greasemonkey decided to drop backwards-compatibility by default.
That's why almost all of my scripts stopped working in the new Firefox.

There is a backwards-compatibility solution, but I have to add it by hand.
This is also not just a header thing, but something you need to go through your script and rewrite parts that are affected.

I'm currently going through my scripts and update them.
It might take a while, though, since some are rather large and there are around 30 scripts in total...
So, please bear with me while I'm working on this.



Technical details:


In userscript GM-API-Calls all _ are replaced with .:
GM_getValue becomes GM.getValue.
Also GM.xmlHttpRequest has now a large H... before lower ones were ignored I guess.
GM.getValue doesn't return a value anymore, but a "promise" and runs asynchronous.
It HAS TO run in an asynchronous function, otherwise you get a cryptic console-error-message that a script failed to run.
Asynchronous functions have the async-prefix.
To let GM.getValue run synchronous and return its value, you need a prefix await.

So
var name=GM_getValue("myName");
becomes
(async function(){
 var name=await GM.getValue("myName");
)();


Be careful with asynchronouse functions! The browser does not guarantee that the async function is executed before the next statement. In fact on most devices it is executed in parallel:
var i=0
(async function(){
 i=await GM.getValue("di"); //di stored is 2
)();
i=3
alert(i);

Here i is either 2 or 3, depending on the device and how busy it is at the moment. Make sure you put everything depending on GM.getValue also inside, if you don't want to introduce safe-flags or singletons in your code.

GM.getValue and GM.xmlHttpRequest seem to require async functions. GM.setValue can run without, but is still executed asynchronously!
They also dropped registerMenuCommand and AddStyle, but at least the second can be written by your own easily.

Now comes the real mess: While the new Greasemonkey supports the new GM-API-Calls, old Greasemonkey versions do not. Also most probably Scriptisch, ViolentMonkey and Tampermonkey will take a while to keep up.
So, to not break the script for older devices by fixing it for newer one, you need backwards compatibility.
According to Greasemonkey this is easy: www.greasespot.net/2017/09/gre…

You just need to include their "polyfill" script and request @ grants for old and new API-Calls (remove blank space after @):


// @ grant       GM_xmlhttpRequest
// @ grant       GM_getValue
// @ grant       GM_setValue
// @ grant       GM.xmlHttpRequest
// @ grant       GM.getValue
// @ grant       GM.setValue
// @ require  greasemonkey.github.io/gm4-pol…


At least in my Tampermonkey on Chrome this seems to work.
However, this also asks the user to allow a new source for the script (greasemonkey.github.io)

As a side note, it is also told that installing new userscripts in firefox will not work from github.
Good thing I have mirrors for my links. ^^
Add a Comment:
 
:iconrotane:
rotane Featured By Owner Nov 18, 2017  Professional
So, what about those of us who decide to stick with legacy code for the time being (either through Firefox ESR or forks such as Pale Moon)? Should we also update your scripts once they become available, or should we stick to the current ones?
Reply
:icondediggefedde:
Dediggefedde Featured By Owner Nov 20, 2017  Hobbyist
Well...I guess that is up to you. ^^
The updates I'm currently doing are only about compatibility, so if old scripts still work, you don't need to update them.
Old versions can usually be found on the greasyfork-mirror.
However, I try my best to provide backward-compatibility with the polyfill solution, so the new versions should also work in older Firefox-releases or ESR releases.
Since userscripts are pretty secure on their own, I don't need to make security updates and you will probably just miss out additional features or bugfixes.
Reply
:iconrotane:
rotane Featured By Owner Nov 20, 2017  Professional
I was just asking if i should keep an eye open for auto-updates.
Reply
:iconnylten:
Nylten Featured By Owner Nov 17, 2017  Hobbyist General Artist
Thank you for keeping up with the updates!
Reply
:iconthegalleryofeve:
TheGalleryOfEve Featured By Owner Nov 17, 2017
And what if we're the person on the other side of this ---> thegalleryofeve.deviantart.com… phone call??? :iconblankstareplz: :XD: How do WE fix something like this??? :iconimthinkingplz:

:iconhurrplz:
Reply
:icondediggefedde:
Dediggefedde Featured By Owner Nov 20, 2017  Hobbyist
I'm not sure if I understand the question or if it is related, but you should contact your local phone company to blacklist phone callers you don't like.
If it is you that you don't like phoning others then... avoid it, I guess...
Reply
:iconthegalleryofeve:
TheGalleryOfEve Featured By Owner Nov 20, 2017
No, no :giggle: I was implying that this seems too difficult to understand for people who are either not technically inclined or simply just afraid of technology, like the old guy who called that customer support guy on the video :giggle:

You killed my joke :grump:
Reply
:icondediggefedde:
Dediggefedde Featured By Owner Nov 20, 2017  Hobbyist
Aw, sorry. ^^
But, to be honest, those people will also likely not install an extension like greasemonkey to install userscripts from some anonymous user to change how a website is working.
For those who are no coders the message of the journal is: all my scripts broke, I'm working on it.
And the other information is a collection of some information regarding that topic that might help other developers.
Reply
Add a Comment:
 
×

:icondediggefedde: More from Dediggefedde


More from DeviantArt



Details

Submitted on
November 17, 2017
Link
Thumb

Stats

Views
525
Favourites
3 (who?)
Comments
8