[Greasemonkey] Script ID in GM_setValue/GM_getValue set wrong when
multiple scripts inject
Matthias Bauer
ml-greasemonkey-42imk83y at moeffju.net
Wed Jun 29 20:25:35 EDT 2005
Hey,
I reported this before, but not much came of it.
When more than one script is injected, the namespace of the last one is
used for all calls of GM_setValue, GM_getValue and GM_log.
The last applied script 'wins' the namespace.
This means that other scripts forget all of their settings when a new
script is installed which runs on the same sites (or '*').
I've been testing with these scripts:
test1.user.js:
// ==UserScript==
// @name test1
// @namespace test1
// @include *
GM_setValue('set-by-test1', 'test1');
test2.user.js:
// ==UserScript==
// @name test2
// @namespace test2
// @include *
GM_setValue('set-by-test2', 'test2');
After the first run, all seems fine, but a few pages later, I have the
following values in the prefs:
greasemonkey.scriptvals.test1/test1.set-by-test1 = test1
greasemonkey.scriptvals.test2/test2.set-by-test1 = test1
greasemonkey.scriptvals.test2/test2.set-by-test2 = test2
With 'real' scripts, everything goes to havoc here, since all settings
are gone without a way to restore (except reordering scripts).
Can anyone confirm this? Known bug? Fix?
-Matt
More information about the Greasemonkey
mailing list