This commit is contained in:
mconnor%steelgryphon.com 2006-04-30 05:02:43 +00:00
Родитель bb6bff592e
Коммит 5ad969ee3e
4 изменённых файлов: 27 добавлений и 23 удалений

Просмотреть файл

@ -60,6 +60,7 @@ DIRS = \
migration \
preferences \
search \
sessionstore \
shell \
sidebar \
$(NULL)

Просмотреть файл

@ -101,6 +101,25 @@ BrowserGlue.prototype = {
ww.openWindow(null, "chrome://browser/content/safeMode.xul",
"_blank", "chrome,centerscreen,modal,resizable=no", null);
}
else {
// initialize the session-restore service
var ssEnabled = true;
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
try {
ssEnabled = prefBranch.getBoolPref("browser.sessionstore.enabled");
} catch (ex) {}
if (ssEnabled) {
try {
var ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
getService(Components.interfaces.nsISessionStore);
ss.init();
} catch(ex) {
dump("nsSessionStore could not be initialized: " + ex);
}
}
}
},
// profile shutdown handler (contains profile cleanup routines)

Просмотреть файл

@ -149,7 +149,6 @@ function debug(aMsg) {
/* :::::::: The Service ::::::::::::::: */
//var SessionStoreService = {
function SessionStoreService() {
}
@ -234,14 +233,14 @@ SessionStoreService.prototype = {
}, this);
delete this._initialState.Window[0].hidden;
}
catch (ex) { debug(ex); } // invalid .INI file - nothing can be restored
catch (ex) { debug("The session file is invalid: " + ex); } // invalid .INI file - nothing can be restored
}
// if last session crashed, backup the session
// and try to restore the disk cache
if (this._lastSessionCrashed) {
try {
this._writeFile(this._getSessionFile(true), aState, true);
this._writeFile(this._getSessionFile(true), iniString);
}
catch (ex) { } // nothing else we can do here
try {
@ -1670,7 +1669,7 @@ SessionStoreService.prototype = {
"state=" + (this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR),
this._getCurrentState(),
""
].join("\n").replace(/\n\[/g, "\n$&"), aUpdateAll);
].join("\n").replace(/\n\[/g, "\n$&"));
this._lastSaveTime = Date.now();
},
@ -1991,27 +1990,12 @@ SessionStoreService.prototype = {
* nsIFile
* @param aData
* String data
* @param aThisThread
* bool Write in current thread
*/
_writeFile: function sss_writeFile(aFile, aData, aThisThread) {
_writeFile: function sss_writeFile(aFile, aData) {
// save the file in the current thread
// (making sure we don't get killed at shutdown)
if (aThisThread) {
(new FileWriter(aFile, aData)).run();
return;
}
// save file in new thread
var nsIThread = Ci.nsIThread;
var thread = Cc["@mozilla.org/thread;1"].createInstance(Ci.nsIThread);
thread.init(
new FileWriter(aFile, aData),
128 * 1024,
nsIThread.PRIORITY_NORMAL,
nsIThread.SCOPE_GLOBAL,
nsIThread.STATE_UNJOINABLE
);
(new FileWriter(aFile, aData)).run();
return;
},
/* ........ QueryInterface .............. */
@ -2268,7 +2252,6 @@ const SessionStoreFactory = {
return null;
}
//return SessionStoreService.QueryInterface(aIID);
return (new SessionStoreService()).QueryInterface(aIID);
},

Просмотреть файл

@ -21,6 +21,7 @@
locale/browser/search.properties (%chrome/browser/search.properties)
locale/browser/searchbar.dtd (%chrome/browser/searchbar.dtd)
locale/browser/engineManager.dtd (%chrome/browser/engineManager.dtd)
locale/browser/sessionstore.properties (%chrome/browser/sessionstore.properties)
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
locale/browser/shellservice.properties (%chrome/browser/shellservice.properties)
#ifdef MOZ_PLACES