Async access to web storage in FireMonkey #324
-
Hi, Can anyone provide some clarification about what storage is available inside a FireMonkey script? I'm currently working on a user script, in which I'm trying to build and access an IndexedDb, but have been facing persistent issues with database objects being undefined. Edit: I've rewritten my script using Jake Archibald's idb library that wraps IndexedDB in promises, using the version that creates an idb global object with the functions as methods. This appears to have solved the problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
GM Storage APIIn legacy Firefox, storage access was synchronous. The storage API in User-script managers were also synchronous e,g. Since Firefox 57, all storage operations are asynchronous for Firefox and extensions. The storage API in User-script managers had to change for the asynchronous access. GreaseMonkey adopted the new asynchronous API TamperMonkey & ViolentMonkey decided to keep the All above managers (GM | TM | VM) manually inject userscript every time a tab navigates. FireMonkey uses the dedicated secure userScript API and passes the script injection to Firefox's native process. Originally, FireMonkey also adapted the asynchronous only storage API, similar to GreaseMonkey, but after requests a work-around was added. The work-around means, in synchronous
The asynchronous IndexedDB APIIf you are using IndexedDB, it is not handled by FireMonkey. IndexedDB is an asynchronous Web API. It is also domain linked so it will only be available to the domain that it was set in. For example if a userscript has
More Info: Using IndexedDB I hope that helps. Let me know if there are more questions. |
Beta Was this translation helpful? Give feedback.
GM Storage API
In legacy Firefox, storage access was synchronous. The storage API in User-script managers were also synchronous e,g.
GM_getValue
,GM_setValue
,GM_listValues
&GM_deleteValue
Since Firefox 57, all storage operations are asynchronous for Firefox and extensions. The storage API in User-script managers had to change for the asynchronous access.
GreaseMonkey adopted the new asynchronous API
GM.getValue
,GM.setValue
,GM.listValues
&GM.deleteValue
.TamperMonkey & ViolentMonkey decided to keep the
GM_getValue
,GM_setValue
,GM_listValues
&GM_deleteValue
and create a quasi-synchronous storage access by delaying the script injection and getting the storage first and then injecting …