зеркало из https://github.com/mozilla/gecko-dev.git
Bug 390060 - Ensure default browser dialog appears after restoring from a session restore. Patch by Manish Singh <manish@flock.com> r=zeniko ui-r=beltzner a1.9=beltzner
This commit is contained in:
Родитель
d68888def9
Коммит
bec70e982e
|
@ -953,14 +953,15 @@ function delayedStartup()
|
|||
var shell = getShellService();
|
||||
if (shell) {
|
||||
var shouldCheck = shell.shouldCheckDefaultBrowser;
|
||||
var willRestoreSession = false;
|
||||
var willRecoverSession = false;
|
||||
try {
|
||||
var ss = Cc["@mozilla.org/browser/sessionstartup;1"].
|
||||
getService(Ci.nsISessionStartup);
|
||||
willRestoreSession = ss.doRestore();
|
||||
willRecoverSession =
|
||||
(ss.sessionType == Ci.nsISessionStartup.RECOVER_SESSION);
|
||||
}
|
||||
catch (ex) { /* never mind; suppose SessionStore is broken */ }
|
||||
if (shouldCheck && !shell.isDefaultBrowser(true) && !willRestoreSession) {
|
||||
if (shouldCheck && !shell.isDefaultBrowser(true) && !willRecoverSession) {
|
||||
var brandBundle = document.getElementById("bundle_brand");
|
||||
var shellBundle = document.getElementById("bundle_shell");
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* - and allows to restore everything into one window.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(22496a00-227b-11db-a98b-0800200c9a66)]
|
||||
[scriptable, uuid(c0b185e7-0d21-46ac-8eee-7b5065ee7ecd)]
|
||||
interface nsISessionStartup: nsISupports
|
||||
{
|
||||
// Get session state as string
|
||||
|
@ -53,4 +53,15 @@ interface nsISessionStartup: nsISupports
|
|||
* Determine if session should be restored
|
||||
*/
|
||||
boolean doRestore();
|
||||
|
||||
/**
|
||||
* What type of session we're restoring. If we have a session, we're
|
||||
* either restoring state from a crash or restoring state that the user
|
||||
* requested we save on shutdown.
|
||||
*/
|
||||
const unsigned long NO_SESSION = 0;
|
||||
const unsigned long RECOVER_SESSION = 1;
|
||||
const unsigned long RESUME_SESSION = 2;
|
||||
|
||||
readonly attribute unsigned long sessionType;
|
||||
};
|
||||
|
|
|
@ -87,6 +87,7 @@ SessionStartup.prototype = {
|
|||
|
||||
// the state to restore at startup
|
||||
_iniString: null,
|
||||
_sessionType: Ci.nsISessionStartup.NO_SESSION,
|
||||
|
||||
/* ........ Global Event Handlers .............. */
|
||||
|
||||
|
@ -127,17 +128,22 @@ SessionStartup.prototype = {
|
|||
catch (ex) { debug("The session file is invalid: " + ex); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prompt and check prefs
|
||||
this._doRestore = this._lastSessionCrashed ? this._doRecoverSession() : this._doResumeSession();
|
||||
if (this._iniString && !this._doRestore) {
|
||||
this._iniString = null; // reset the state string
|
||||
if (this._iniString) {
|
||||
if (this._lastSessionCrashed && this._doRecoverSession())
|
||||
this._sessionType = Ci.nsISessionStartup.RECOVER_SESSION;
|
||||
else if (!this._lastSessionCrashed && this._doResumeSession())
|
||||
this._sessionType = Ci.nsISessionStartup.RESUME_SESSION;
|
||||
else
|
||||
this._iniString = null; // reset the state string
|
||||
}
|
||||
|
||||
if (this._prefBranch.getBoolPref("sessionstore.resume_session_once")) {
|
||||
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
|
||||
}
|
||||
|
||||
if (this.doRestore()) {
|
||||
if (this._sessionType != Ci.nsISessionStartup.NO_SESSION) {
|
||||
// wait for the first browser window to open
|
||||
var observerService = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
|
@ -219,7 +225,14 @@ SessionStartup.prototype = {
|
|||
* @returns bool
|
||||
*/
|
||||
doRestore: function sss_doRestore() {
|
||||
return this._doRestore && this._iniString != null;
|
||||
return this._sessionType != Ci.nsISessionStartup.NO_SESSION;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the type of pending session store, if any.
|
||||
*/
|
||||
get sessionType() {
|
||||
return this._sessionType;
|
||||
},
|
||||
|
||||
/* ........ Auxiliary Functions .............. */
|
||||
|
|
Загрузка…
Ссылка в новой задаче