Firefox has been trying to avoid restarting for a long time. With e10s, not-quite-silent updates that may longer be possible. Given that phone apps restart without warning, people may be more used to restarting. Having a better (easier, cleaner, quieter) restart and restore flow might simplify other technical choices.
Thus, is may be in our strategic interest to:
- Make restart less painful
- Assume restarts / restores happen
- multiple windows dance in and out
- addTab moves things around (jumpy)
- seems that focus / resize keeps pulling the window to foreground
- restore the window with the selected tab first.
- do all other window restores in the background
// since resizing/moving a window brings it to the foreground,
// we might want to re-focus the last focused window
if (this.windowToFocus) {
this.windowToFocus.focus();
}
Snippet for seeing saved state (from a chrome privileged window)
let S = Cu.import("resource:///modules/sessionstore/SessionStore.jsm");
JSON.parse(S.SessionStoreInternal.getBrowserState())
Snippet for adding tabs and such:
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
mainWindow.gBrowser.addTab() // can take lots of options, see dxr