Open Bug 343163 Opened 18 years ago Updated 2 years ago

DOM storage management interfaces (for embedders, add-ons, etc.)

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
All
defect

Tracking

()

People

(Reporter: chpe, Unassigned)

References

Details

Like for cookies (nsICookieManager), embedders need access to the DOM storage, so they can:
- enumerate sites that have data stored
- enumerate stored items for a given site
- query how much data a given site has stored
- limit the amount of data a given site can store
- delete some or all items for a given site
- delete all items from all sites
Assignee: general → nobody
QA Contact: ian → general
Assignee: nobody → honzab.moz
What comment #0 says is something I almost filed another bug for, titled "management interfaces for DOM Storage" - I'm not an "embedder", but for my work on a web storage panel for Data Manager (add-on / SeaMonkey built-in) in bug    588415, it would be very helpful not to read the database directly, but have a reasonable interface for getting a list of all sites that employ DOM storage and get all items they have stored, including possibilities to manage/remove them.

Adjusting summary to reflect that this is not just for embedders.

I guess having those methods (on nsIDOMStorageManager perhaps?) would also ease work on bug 489444, as tests for those things might want to check correctness or clean up afterwards via some of those. Also, work on bug 343163 probably would be easier if it was easy to enumerate sites/items stored. I still need to take a look what workaround bug 339445 used for this...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: embedders need access to DOM storage → DOM storage management interfaces (for embedders, add-ons, etc.)
Blocks: 588415
Oh, and just as a note (haven't checked yet, as I'm not there with my implementation yet), if there's no events one can observe for adding/removal/etc. of DOM storages, we probably want them as well, just like cookies, permissions, passwords, etc. have them.
There are DOM events as well as observer notifications for storage changes.
(In reply to comment #3)
> There are DOM events as well as observer notifications for storage changes.

Yes, see nsGlobalWindow::Observer and "dom-storage-changed" (globalStorage) and "dom-storage2-changed" (sessionStorage, localStorage with interface nsIDOMStorageEvent).
(In reply to comment #3)
> There are DOM events as well as observer notifications for storage changes.

Thanks to you and Honza, I'm implementing the live changes with this, then. :)

The base problem that there's no way to enumerate all DOM storages remains, and this is mostly what this bug is about (though I currently query SQLite directly as a workaround).
You need to enumerate "active" storage objects or just all data in the database?  For the letter there is no api except direct sql access, as you do.  We may move this to the dom storage manager to use the existing connection.  It could potentially as part of this bug, but I plan to rewrite the localStorage code a bit, so we should sync our work.  However, the db struct (and more or less also the code location) will remain intact.
(In reply to comment #6)
> You need to enumerate "active" storage objects or just all data in the
> database?

The Data Manager needs to list all domains that have any entries in storage. Maybe in the future it might even look into the stored data itself, but right now, all I need to get out of there is a list of all hosts for which anything is stored. For reference, the enumerator on nsICookieManager is how I get all needed info for cookies, would be nice to have something like that or like getAllLogins() in nsILoginManager.
Oh, another interesting feature might be to expose the DB connection, like e.g. the Download Manager does. But not sure how easy/useful that is here.
Any one feel free to take this.
Assignee: honzab.moz → nobody
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.