Bug 448741 - "nsISessionStore uses private methods and is not extensible" [r=dietrich]
This commit is contained in:
@@ -108,7 +108,7 @@ SessionStartup.prototype = {
|
||||
var resumeFromCrash = this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
|
||||
if ((resumeFromCrash || this._doResumeSession()) && this._sessionFile.exists()) {
|
||||
// get string containing session state
|
||||
this._iniString = this._readFile(this._sessionFile);
|
||||
this._iniString = this._readStateFile(this._sessionFile);
|
||||
if (this._iniString) {
|
||||
try {
|
||||
// parse the session state into JS objects
|
||||
@@ -322,6 +322,25 @@ SessionStartup.prototype = {
|
||||
|
||||
/* ........ Storage API .............. */
|
||||
|
||||
/**
|
||||
* Reads a session state file into a string and lets
|
||||
* observers modify the state before it's being used
|
||||
*
|
||||
* @param aFile is any nsIFile
|
||||
* @returns a session state string
|
||||
*/
|
||||
_readStateFile: function sss_readStateFile(aFile) {
|
||||
var stateString = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
stateString.data = this._readFile(aFile) || "";
|
||||
|
||||
var observerService = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
observerService.notifyObservers(stateString, "sessionstore-state-read", "");
|
||||
|
||||
return stateString.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* reads a file into a string
|
||||
* @param aFile
|
||||
|
||||
Reference in New Issue
Block a user