[Greasemonkey] GM_setValue, getValue and default values for preferences

Ori Avtalion oavtal at bezeqint.net
Fri Sep 23 19:50:38 EDT 2005


Attached is a patch that removes script-created preferences when 
uninstalling a script.

The "scriptvals.script-namespace.script-name" string now appears twice 
in the codebase: miscapis.js, manage.xul.
Perhaps it should be saved as "script.prefStartPoint".


In case you have left-over greasemonkey preferences from previously 
uninstalled scripts, just reset the preference in about:config.
They will be automatically removed when firefox is restarted.

This behaviour has nothing to do with greasemonkey. I think firefox does 
that for all user-created scripts.

Next patch coming soon.

on 18/09/2005 23:01 Aaron Boodman wrote:
> On 9/18/05, Ori Avtalion <oavtal at bezeqint.net> wrote:
>> On a related note, why not add extra meta-data to greasemonkey scripts
>> that will have a set of functions to perform on script uninstall. for
>> example, clearing script-created variables (no GUI available for that).
>> I think I saw it mentioned once in the mailing list/blog.
> 
> Hm, that could be cool. Even FF extensions don't have that ;-)
> 
-------------- next part --------------
Index: src/content/manage.xul
===================================================================
RCS file: /cvs/greasemonkey/src/content/manage.xul,v
retrieving revision 1.15
diff -u -r1.15 manage.xul
--- src/content/manage.xul	8 Aug 2005 17:53:52 -0000	1.15
+++ src/content/manage.xul	23 Sep 2005 16:12:05 -0000
@@ -61,6 +61,12 @@
 
         for (var i = 0, script = null; (script = uninstallList[i]); i++) {
             getScriptFile(script.filename).remove(false);
+            // Remove saved preferences 
+            GM_prefRoot.remove(["scriptvals.",
+                                script.namespace,
+                                "/",
+                                script.name,
+                                "."].join(""));
         }
         return true;
     }


More information about the Greasemonkey mailing list