Skip to main content

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.

greasemonkey-2.0

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.

This article was first seen on ComTek's "TekBits" Technology News

HOME