Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsISessionStartup

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

Handles the session restore process.
1.0
28
Introduced
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Implemented by: @mozilla.org/browser/sessionstartup;1. To use this service, use:

var sessionStartup = Components.classes["@mozilla.org/browser/sessionstartup;1"]
                     .getService(Components.interfaces.nsISessionStartup);

Method overview

boolean doRestore();

Attributes

Attribute Type Description
sessionType unsigned long The type of session being restored; this will be one of the Session type constants. Read only.
state jsval

The session state, as a JavaScript object. Read only.

Note: Prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5), this was a string. It was changed in order to improve performance, which was suffering due to the need to parse and stringify the data.

Constants

Session type constants

Constant Value Description
NO_SESSION 0 There's no data available from the previous session.
RECOVER_SESSION 1 The last session crashed. It will either be restored or about:sessionrestore will be displayed.
RESUME_SESSION 2 The previous session should be restored at startup.
DEFER_SESSION 3 The previous session is viable but shouldn't be restored without explicit action (with the exception of app tabs, which are always restored in this case).

Methods

doRestore()

Determines whether or not there is a session to restore.

boolean doRestore();
Parameters

None.

Return value

true if the session should be restored, otherwise false.

See also

文档标签和贡献者

 此页面的贡献者: Sheppy, Mossop
 最后编辑者: Sheppy,