Closed
Bug 1300399
Opened 8 years ago
Closed 8 years ago
[tracking] Implement the sessions API
Categories
(WebExtensions :: General, defect, P3)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Manuel.Spam, Assigned: bsilverberg)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, meta, Whiteboard: [design-decision-approved][sessions]triaged)
Attachments
(1 obsolete file)
Maybe it is a bit too early to request new features that aren't covered by the Google Chrome API. I was searching for a nice, simple, "Restore Tab" button Addon but only found unmaintained Addons which won't survive the "XPCOM to WebExtensions" switchover. But: I also didn't find the right API to do such an Addon myself... Firefox has an function builtin to restore last closed tabs. This is easily available for XPCOM/XUL based Addons. It would be nice to have access to this from WebExtensions. Maybe this would be even a good time to expose some more infos. Maybe a list of last closed tabs or at least a boolean to know that there are tabs to restore (to gray out the button).
Updated•8 years ago
|
Summary: Please add simple "tabs.UndoLastClosedTab" feature → Add API to restore closed tabs
Whiteboard: [design-decision-needed][tabs]
Comment 1•8 years ago
|
||
Its possible to the onRemoved event and keep track of them. But agreed, if the data is already there, it would be nice to expose it and save that work.
Comment 2•8 years ago
|
||
(In reply to Andy McKay [:andym] from comment #1) > Its possible to the onRemoved event and keep track of them. But agreed, if > the data is already there, it would be nice to expose it and save that work. That's not the same thing. The undo closed tab feature restores full session store data, including session history, form data, and so forth. It also removes the restored tabs from the recently closed list.
Comment 3•8 years ago
|
||
Rightio. I would recommend moving this straight to [design-decision-approved], unless you have a concern?
Comment 4•8 years ago
|
||
Nope, it's just a matter of designing the API. Or it might suffice to just implement https://developer.chrome.com/extensions/sessions
Updated•8 years ago
|
Whiteboard: [design-decision-needed][tabs] → [design-decision-approved][tabs]
Comment 5•8 years ago
|
||
I think a better bet is to implement the sessions API. Changing this bug to that.
Summary: Add API to restore closed tabs → Implement the sessions API
Whiteboard: [design-decision-approved][tabs] → [design-decision-approved][sessions]
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: [design-decision-approved][sessions] → [design-decision-approved][sessions]triaged
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → bob.silverberg
Status: NEW → ASSIGNED
Component: WebExtensions: Untriaged → WebExtensions: General
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 9•8 years ago
|
||
Comment on attachment 8797758 [details] Bug 1300399 - Implement the sessions API This isn't totally ready for review yet. There are a couple of things I need to check.
Attachment #8797758 -
Flags: review?(aswan)
Assignee | ||
Updated•8 years ago
|
Summary: Implement the sessions API → [tracking] Implement the sessions API
Assignee | ||
Comment 10•8 years ago
|
||
Comment on attachment 8797758 [details] Bug 1300399 - Implement the sessions API Removing the patch as it will be attached to one of the dependencies.
Attachment #8797758 -
Attachment is obsolete: true
Assignee | ||
Comment 11•8 years ago
|
||
All dependencies have landed. Marking this as fixed!
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Keywords: dev-doc-needed
Comment 12•7 years ago
|
||
I've written some docs for these: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/sessions. Please let me know if they're OK.
Flags: needinfo?(bob.silverberg)
Assignee | ||
Comment 13•7 years ago
|
||
Thanks Will, it looks good. There were a couple of cosmetic changes that I just took care of myself. The only other thing has to do with the onChanged event. The doc currently states "Fired when a tab or window is closed." [1], which is true, but it's not the only time that the event is fired. It's actually fired any time the list of closed windows and tabs changes, which could include a tab/window being evicted from the list because the number stored exceeds the maximum. I don't think this is something we necessarily needs to be explicit about in the documentation, but I wanted to explain it and give you an opportunity to decide whether to update the docs or not. [1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/sessions/onChanged
Flags: needinfo?(bob.silverberg)
Comment 14•7 years ago
|
||
(In reply to Bob Silverberg [:bsilverberg] from comment #13) > Thanks Will, it looks good. There were a couple of cosmetic changes that I > just took care of myself. Thanks for the review, and also for fixing my typos :). > The only other thing has to do with the onChanged > event. The doc currently states "Fired when a tab or window is closed." > [1], which is true, but it's not the only time that the event is fired. It's > actually fired any time the list of closed windows and tabs changes, which > could include a tab/window being evicted from the list because the number > stored exceeds the maximum. I think this is worth mentioning for sure, so I did. The Chrome docs just say it's fired when sessions are changed, which didn't seem very helpful, but closing tabs/windows was the only example I could think of. Is "the maximum" the same as MAX_SESSION_RESULTS [1]? Also, if that's the case, then... presumably this would only happen if a tab/window had been closed? Because that's the only way we would hit the maximum? If so, does onChanged fire twice in this scenario, or just once? If once, doesn't it come down to the same thing? [1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/sessions/MAX_SESSION_RESULTS?
Assignee | ||
Comment 15•7 years ago
|
||
(In reply to Will Bamberg [:wbamberg] from comment #14) > (In reply to Bob Silverberg [:bsilverberg] from comment #13) > > > The only other thing has to do with the onChanged > > event. The doc currently states "Fired when a tab or window is closed." > > [1], which is true, but it's not the only time that the event is fired. It's > > actually fired any time the list of closed windows and tabs changes, which > > could include a tab/window being evicted from the list because the number > > stored exceeds the maximum. > > I think this is worth mentioning for sure, so I did. The Chrome docs just > say it's fired when sessions are changed, which didn't seem very helpful, > but closing tabs/windows was the only example I could think of. > > Is "the maximum" the same as MAX_SESSION_RESULTS [1]? > No, it is not. MAX_SESSION_RESULTS is just used by the API to limit the number of sessions to return from getRecentlyClosed. The maximum I'm referring to here is a Firefox pref, for example `browser.sessionstore.max_windows_undo`. > Also, if that's the case, then... presumably this would only happen if a > tab/window had been closed? Because that's the only way we would hit the > maximum? If so, does onChanged fire twice in this scenario, or just once? If > once, doesn't it come down to the same thing? > In that case yes, the list would only change as a result of a window being closed, and only one notification would fire, so it does amount to the same thing, which is why I felt it might not be worth documenting. There is another case, in which closed sessions may be removed because of their age, but this is an edge case that I don't think we need to document. I think simply saying it fires when the list of closed windows and/or tabs changes is enough.
Comment 16•7 years ago
|
||
> I think
> simply saying it fires when the list of closed windows and/or tabs changes
> is enough.
OK, I've done this.
Keywords: dev-doc-needed → dev-doc-complete
Blocks: Session_managers
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•