Ticket #38 (closed enhancement: fixed)

Opened 1 year ago

Last modified 2 months ago

Add GM_deleteValue and GM_enumerateValues API functions

Reported by: devjavu.c..@freecog.net Assigned to:
Priority: major Milestone: 0.8.1
Version: Keywords:
Cc:

Description

It would be useful to be able to delete prefs created with GM_setValue so that unused preferences can be removed, and to be able to list all of a script's saved prefs.

Use case: my KoL Item Description Bubble script <http://userscripts.org/scripts/show/10850> caches small chunks of text (fetched with GM_xmlhttpRequest) in prefs under unique keys. It tracks what keys it has used so that cached items can be cleared. To remove prefs it sets the pref to a blank string.

  1. GM should permit prefs to be fully deleted (to disappear when the browser is restarted) via a GM_deleteValue.
  2. GM should permit pref names to be enumerated with GM_enumerateValues (name debatable). This would relieve my script of the duty of tracking which pref names it uses.

Yes, my script's cache is a perfect use case an SQLite or Gears data store in GM, but unless GM gains a method to delete prefs, migrating my script to a new data store will result in a bunch of junk prefs hanging around, anyway!

Attachments

gmStorage.patch (1.6 kB) - added by e.@enlightened.de on 04/06/08 10:00:23.

Change History

(follow-ups: ↓ 2 ↓ 3 ) 12/22/07 15:02:47 changed by thalam..@hotmail.com

I know this would be useful, however other scripts may end up playing with someone elses prefs. After the trunk is eventually cleaned up, it could be feasable. Leaving open for now.

(in reply to: ↑ 1 ) 01/22/08 10:22:23 changed by devjavu.c..@freecog.net

Replying to thalam..@hotmail.com:

I know this would be useful, however other scripts may end up playing with someone elses prefs. After the trunk is eventually cleaned up, it could be feasable. Leaving open for now.

You have no idea what you are talking about. The proposed features would be just as safe as the current GM_get/setValue functions.

(in reply to: ↑ 1 ) 03/17/08 15:04:26 changed by o..@avtalion.name

Replying to thalam..@hotmail.com:

I know this would be useful, however other scripts may end up playing with someone elses prefs. After the trunk is eventually cleaned up, it could be feasable. Leaving open for now.

I agree with the second poster that it should not be a problem. Like get/set, the deleteValue function would only touch the script's namespace.

04/06/08 10:00:23 changed by e.@enlightened.de

  • attachment gmStorage.patch added.

04/06/08 10:03:22 changed by e.@enlightened.de

The attached patch implements the requested feature in a simple and straighforward way; there should not be any problems as far as i can see.

Strangely, the patch is not shown completely in the web view; you have to download in 'original format' to see it.

06/18/08 18:51:22 changed by aranti..@gmail.com

  • status changed from new to closed.
  • resolution set to fixed.

(In [745]) Fixes #38

  • Incorporate the submitted patch. Add GM_deleteValue and GM_enumerateValues API methods.

06/18/08 18:51:49 changed by aranti..@gmail.com

  • milestone set to 0.8.1.

Devs, please yell at me if I shouldn't have committed.

07/27/08 17:46:30 changed by anonymous

Changed to GM_listValues in [749].


Add/Change #38 (Add GM_deleteValue and GM_enumerateValues API functions)




Action