User:Zpao/SessionStore2

From MozillaWiki
Jump to: navigation, search

This is currently just a place to collect thoughts on problems I've seen with session restore and where I think we should go.

Random Thoughts

  • Caching - do we do it hard enough? We often seem to throw out all data we have when we don't necessarily need to.
  • SessionStorage - can we do something so when google puts 300K in there

API improvements

with e10s, we may need to make things async, which could have interesting results for consumers like private browsing

As we store more data, we may want to allow APIs get at data without collecting other data. For example, if we store a lastAccessed timestamp for each tab, it would make sense to make that easily accessible without having to collect all history for that tab.

Plugins

We've sort of had this notification system and the ability to store arbitrary strings on a tab or window. But there are things like Scratchpad who would benefit from having a more general use (see bug 644409 - the general idea is that it's doing session restore for scratchpad windows, which is something session restore core doesn't need to know how to do). In the future Panorama might be able to use this.

So I'm thinking of having an XPCOM interface that could be implemented and registered. Or the ability to register an object that conforms to the same methods. I think registering to a "key" makes sense. When session restore is saving, it would iterate over the "observers" and get a JS object back. It could be saved at the top level for that "key". Data would be collected fairly often when browsing, so caching would have to happen on the implementer side. On restore, sessionstore would call each plugin's restore method with the JS object that got saved.

We may be able to break down session restore into smaller components this way. We have a core data storage service. That could be in toolkit. Then have plugins implemented to implement collection for app specific things. Taken to an extreme, we could replace some of the things that end up in localstore.rdf (oh god).

Requests

Have you been frustrated by how sessionstore works? Or had an idea for a specific API? List them here (along with your name/nick so I ;can followup)

MFinkle:

  • Can we save parts of the session (sessionstore.js) into separate files? A simple list of basic tabs in a core file, and each tab's specific data (which can grow to huge sizes) in separate files.
    • Could make it harder for a corrupt file to kill _all_ session restore
    • Could save time when writing out changes for a single tab, since we don't need to save the entire session (all tabs) when I change a single field in a single open tab.