[Greasemonkey] GM_setValue,
getValue and default values for preferences
Ori Avtalion
oavtal at bezeqint.net
Sat Sep 24 02:06:10 EDT 2005
on 19/09/2005 00:13 Ori Avtalion wrote:
> I'll submit a default-value wrapper patch for GM this week (it may wait
> till the weekend, though).
OK. Turns out this cannot be easily accomplished.
The third "default" parameter of setValue/getValue I mentioned earlier
does not appear in the preference component interface, meaning it can't
be reached using js.
For some reason which is beyond me, the only way to get/set default
properties is to request the "default preference branch" from the
component. If on prefmanager.js, getBranch() was called, one would need
to call getDefaultBranch().
Through that interface, there is no simple way (without exception
catching in js - can it be done?) of telling whether or not a default
value exists for a preference, which is needed when the user calls
GM_setValue with two params - should the value given be set as the
default one or not?
I think the concept of default values is that they're only used
internally for mozilla properties. These can, in turn, be overridden
with users-set values.
Greasemonkey preferences are considered user-set, but they were also
created by the user. There is no mozilla-default for them.
For now, I'm dropping the patch proposal. There's minimal gain with it,
and it seems to be against the app's way of thought, making the code
very hackish.
Ori
More information about the Greasemonkey
mailing list