Greasemonkey 2.0 released, introduces changes that may break scripts
When it comes to adding userscript support to Firefox, Greasemonkey is still the number one extension trusted by the majority of users. While there are alternatives such as Scriptish, they pale in terms of raw user numbers when compared to Greasemonkey.
The development team behind Greasemonkey has just released version 2.0 of the extension. As always, it takes time before the new version is made available to all existing users and users who visit the Greasemonkey page on the website.
Interested users can install the new version of the extension on the "versions" page of it on the website where it is already made available.
The new version introduces several changes that may make some scripts incompatible with version 2.0 of Greasemonkey.
One of the changes affects the @grant mode that scripts use. It allows scripts to specify which API methods they want to have access to. Up until now, Greasemonkey tried to auto-detect the right settings when grant was not used by a script.
The new version changes this by assigning @grant none mode to any script that does not specifically request API methods using the feature.
It is interesting to note that the change affects only scripts that you install new, update, edit or reinstall. Existing scripts that you leave untouched are not affected by the change according to the announcement.
The second change that may break compatibility with some scripts is that Greasemonkey's privileged sandbox has been updated to match changes made to unsafeWindow in Mozilla's Add-on SDK. What this means is that scripts need to use the new methods cloneInto(), exportFunction() and createObjectIn() to write values to unsafeWindow.
According to the developers, this improves the extension's stability, reliability and security.
The consequence is that the changes may break some scripts unless they are updated by their authors to correct the issues.
It is unclear how many scripts will be affected by this but the team believes that the benefits outweigh compatibility issues.
A couple of additional changes and fixes are introduced in Greasemonkey 2.0. Firefox Sync support is turned on by default for instance which means that it is enabled by default now. If a user has activated Firefox Sync, userscripts will be synchronized automatically once Greasemonkey 2.0 has been installed.
You can change that behavior in the extension's options where you need to uncheck the "Enable Firefox Sync for User Scripts" box.
Another interesting change is that all references to userscripts.org have been removed from the extension. The repository has been down for some time now and while there is an option to access it, as outlined here, it is unclear if it will return fully or vanish into oblivion.
You can read up on the remaining changes and fixes -- mostly coding related -- on the official Greasepot website.
I’m confused – is it @grant or @grand? I always thought it the former.
It is grant, corrected.
2.0 is not a final version, just beta.
No the final version is out, you need to load the Versions page on Firefox, the front page only lists version 1.15 and 2.0 beta.
When Greasemonkey was lagging behind in releases, I switched to Scriptish. However, Scriptish is now lagging behind!
With the fall of userscript.org I fear that many of my scrips will never ever get any update again…
You can still access it through their 8080 portal.
Any broken scripts experienced in first person with new version?
No broken scripts here and I’m on the latest dev branch 2.0 beta 2. But I think that most of the script problems are already fixed, because the source code seems open and all devs can easily update the scripts.
I know it was already written down but here are some alternatives:
Openuserjs and Greasefork seems most up-2-date.
By the way what became the most complete replacement for userscripts.org? (Meaning where the most script devs moved their scripts)
Also previously people mentioned forking the whole website. Did anyone actually did that and backed up all the scipts?
Yes there is a mirror: https://www.ghacks.net/2014/05/09/userscripts-org-good-alternatives/
https://greasyfork.org/ is the best it’s there that I had post all my old scripts and will update when needed.