Closed
Bug 332774
Opened 18 years ago
Closed 18 years ago
Create API allowing extensions to hook into the session-restore service
Categories
(Firefox :: Tabbed Browser, enhancement)
Firefox
Tabbed Browser
Tracking
()
RESOLVED
FIXED
Firefox 2 beta1
People
(Reporter: dietrich, Assigned: dietrich)
References
Details
(Keywords: dev-doc-complete, fixed1.8.1, Whiteboard: 181b1+)
Attachments
(1 file)
9.57 KB,
patch
|
mconnor
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
From http://wiki.mozilla.org/Firefox2/Requirements: "API allowing extensions to contribute items to be saved/restored across sessions"
Updated•18 years ago
|
Assignee: nobody → dietrich
Flags: blocking-firefox2+
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
What sort of API is planned here? I'm visualizing something like this: var gSession = Components.classes["@mozilla.org/browser/sessionstore;1"] .getService(nsCI.nsISessionStore); var newAttr = gSession.newAttribute('example-number-list'); newAttr.spec = "0,1,2,3,4,5,6,7,8,9"; gSession.addAttribute(newAttr); // or var newAttr2 = Components.classes["@mozilla.org/browser/sessionstore;1"] .createInstance(nsCI.nsISessionAttribute); for (i = 0; i < 10; ++i) { newAttr2.append(i); } // later gSession.removeAttribute(newAttr); where newAttr is a new instance of an nsISessionAttribute, with a spec member similar to nsIURI as well as other accessor functions that can take a string or a number and parse it into the format used by the backing code.
Comment 2•18 years ago
|
||
It seems to me this API will be used to store attributes/objects both per tab and per session. Per tab requirements might be done by allowing extensions to register the names of attributes (and perhaps js objects) to be stored if present on tab nodes. As for per session data, a similar approach might be possible where the API is given an object reference (or several) which it backs up whenever it saves a session, though for maximum flexibility some kind of SessionSave 'event' letting you execute a little code whenever a session is saved, would be very powerful. Either way some kind of SessionRestore 'event' would be useful to help extensions resume a session.
Assignee | ||
Updated•18 years ago
|
Whiteboard: [swag: 4d]
Comment 3•18 years ago
|
||
Anything happening with this? Trying to figure out if there'll be an API to document in the Fx2 timeframe.
Assignee | ||
Comment 4•18 years ago
|
||
I've updated the wiki with some information about this: http://wiki.mozilla.org/SessionRestoreAPI I'd like to get this in for Fx2, but as freeze is next week, whether I can get to it really depends on how the next couple of days go.
Assignee | ||
Comment 5•18 years ago
|
||
swag 2 days to get basic session storage per the requirement.
Whiteboard: [swag: 4d] → [swag: 2d]
Assignee | ||
Comment 6•18 years ago
|
||
This exposes the ability to store strings by key for windows and tabs. (I'll move the tests into a separate tests directory whenever this gets checked in.)
Attachment #227190 -
Flags: review?(mconnor)
Updated•18 years ago
|
Whiteboard: [swag: 2d] → [swag: 2d] 181b1+
Updated•18 years ago
|
Whiteboard: [swag: 2d] 181b1+ → [needs review mconnor] 181b1+
Comment 7•18 years ago
|
||
Comment on attachment 227190 [details] [diff] [review] exposes the window/tab data APIs, w/ some tests mmm, tests. Is this a framework davel is pushing, or something you just cooked up?
Attachment #227190 -
Flags: review?(mconnor) → review+
Comment 8•18 years ago
|
||
Hey Dietrich, I took a quick look at the tests - is there a reason other than running with chrome privs that you need this to be a xul doc?
Assignee | ||
Comment 9•18 years ago
|
||
(In reply to comment #7) > (From update of attachment 227190 [details] [diff] [review] [edit]) > mmm, tests. Is this a framework davel is pushing, or something you just cooked > up? > i wrote this, but it should be easy enough to convert to davel's format, once it's finalized. (In reply to comment #8) > Hey Dietrich, > > I took a quick look at the tests - is there a reason other than running with > chrome privs that you need this to be a xul doc? > i need chrome privs, and to be able to open windows, tabs, and inspect menus, etc, basically a full browser environment.
Comment 10•18 years ago
|
||
Can we get this landed on trunk ASAP and smoketested? Then nominate for approval1.8.1?
Assignee | ||
Comment 11•18 years ago
|
||
i had to manually merge, due to conflicts w/ recent changes. should be on trunk pretty soon, once i test the updated patch.
Updated•18 years ago
|
Whiteboard: [needs review mconnor] 181b1+ → 181b1+ [checkin needed]
Assignee | ||
Comment 12•18 years ago
|
||
Comment on attachment 227190 [details] [diff] [review] exposes the window/tab data APIs, w/ some tests Low risk, no UI, no l10n impact.
Attachment #227190 -
Flags: approval1.8.1?
Updated•18 years ago
|
Attachment #227190 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Updated•18 years ago
|
Keywords: fixed1.8.1
Whiteboard: 181b1+ [checkin needed] → 181b1+
Comment 13•18 years ago
|
||
Looks like this is making the beta? Where do I look to dig up all the juicy details on the API so I can write a doc about it?
Assignee | ||
Comment 14•18 years ago
|
||
(In reply to comment #13) > Looks like this is making the beta? Where do I look to dig up all the juicy > details on the API so I can write a doc about it? > Howdy, I'll try to add API details on the wiki today: http://wiki.mozilla.org/SessionRestoreAPI Also, there's example usage in the tests here: http://lxr.mozilla.org/mozilla/source/browser/components/sessionstore/test/nsSessionStoreTest.xul
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 15•18 years ago
|
||
(In reply to comment #6) > Created an attachment (id=227190) >+ Components.returnCode = -1; //zeniko: or should we rather fail silently? Instead of copy/pasting (and mis-quoting me ;-)), it would've been better to do the same thing you already did for undoCloseTab: + Components.returnCode = Cr.NS_ERROR_INVALID_ARG; Apart of that, one relevant part of the API is still missing: allowing extensions to retrieve/restore complete session states. Dietrich: Are there any bugs pending on these issues already?
Updated•18 years ago
|
Keywords: dev-doc-needed
Comment 16•18 years ago
|
||
RE: dev-doc-needed As an extension developer currently using the session store api, I find the documentation on developer.mozilla.org sufficient, if not perfect. http://developer.mozilla.org/en/docs/Session_store_API http://developer.mozilla.org/en/docs/nsISessionStore Though it would be quite be nice to have official documentation on the format of the json object returned, rather than having to work it out manually.
Comment 17•17 years ago
|
||
Do we want to document the JSON object? If so, I'll have to poke around and figure out where it's built so I can do so.
Comment 18•17 years ago
|
||
Since there seems not to be any interest in documenting the JSON format, I'm marking this as dev-doc-complete. Please re-tag it if this is in error.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•