Greasemonkey Storage

Is there a limit on the amount of data that can be saved with GM_setValue ?

+6
javascript greasemonkey
source share
3 answers

GM saves it in properties. Open about: config and find them.

According to http://diveintogreasemonkey.org/api/gm_getvalue.html they can be found in the greasemonkey.scriptvals branch.

This sqlite information, within its limits, shows some default restrictions for strings and blocks, but they can be changed by Firefox.

+4
source share

Further information is in the Greasespot Wiki :

The Firefox preferences repository is not designed to store large amounts of data. There are no hard limits, but very large amounts of data can cause Firefox to consume more memory and / or run slower. 2

The link refers to a discussion in the Greasemonkey Mailinglist . Anthony Lieuallen answers the same question you posted:

I just checked it out. It seems that it works up to a 32 megabyte line without serious problems, but 64 or 128 start a thrash disk for virtual memory - a fair deal.

+4
source share

According to the site you provided: "The value argument can be a string, boolean, or integer."

Obviously, a string can contain much more information than an integer or a logical one.

Since GreaseMonkey scripts are JavaScript, the maximum length for GM_setValue is the maximum length of the JavaScript string. In fact, the browser-specific JavaScript engine determines the maximum length of a string.

I do not know any features, but you can write a script to determine the maximum length.

Continue doubling the length until you get an error. Then try the value halfway between maxGoodLen and minBadLen, until maxGoodLen = maxBadLen - 1.

0
source share

All Articles