question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GM_ APIs no longer supported in GM4

See original GitHub issue

With the recent update to Firefox (FF57, aka Quantum) Greasemonkey devs have decided to change their API from synchronous functions GM_* to async methods of the GM object. This means that starting with GM4 (the first version compatible with FF57+) all scripts that used any of those functions will no longer work.

As an example, your awesome script for GitHub custom hotkeys in FF57+GM4 dies with “Script error: ReferenceError: GM_getValue is not defined” in the console.

A suggested workaround is to include an official polyfill for the old API. Also, I think most of them can be safely replaced with native fetch and localStorage.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jeronecommented, Jan 30, 2018

I agree with you @Mottie. It started with GM4 not detecting my 50+ installed UserScripts. GM does not support drag-and-drop installation (after finding GM’s installation folder), and TamperMonkey does, so I switched to TM (also because it is available on all other browsers too). My personal feeling is that GM is forcing a new standard to us way too fast without being backwards-compatible (while TM is forwards-compatible (GM3 + GM4 style)). ~I only need to update documentation that GM4 is not supported for my UserScripts.~

1reaction
monk-timecommented, Jan 24, 2018

I’m sorry that the GM devs treated your suggestions that way, looks like it’s not a happy situation re: GM4 for everybody involved.

In any case, I’ve made GitHub Custom Hotkeys GM4-compatible by switching to native APIs in my fork, but I haven’t added any code for user data migration, so I am not sure whether it would make sense to send a PR or not.

And thank you once again for your scripts! They are immensely helpful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support GM4+ Async API · Issue #92 - GitHub
Looking at the source code, it appears that GM_config doesn't support the new Greasemonkey 4 APIs so, if you're running it on Greasemonkey...
Read more >
GM4/FF57 compatibility fixing. An alternative approach...
I have created a library, GM Common API (GMC), which makes a subset of the functionality from the other two APIs, available in...
Read more >
Trying to wrap the new GM4 asynchronous methods into ...
I am trying to wrap GM4's asynchronous methods into synchronous methods for a fast and easy way to make my current userscripts "cross-API...
Read more >
Greasemonkey: "GM_xmlhttpRequest is not defined" with the ...
The GM API was changed. You have to use xmlHttpRequest property of GM class, it is compatibility: GM 4.0+. Replace GM_xmlhttpRequest by :...
Read more >
FAQs - GM Developers
Need some help? Review the resources and FAQs below to find the information you're looking for. In-Vehicle Apps Vehicle APIs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found