Backed out changeset 476f2fb1d0b4 (bug 916729)

This commit is contained in:
Tim Taubert 2013-09-17 10:25:51 +02:00
parent f07e140e81
commit 6b881ac78e

View File

@ -34,7 +34,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/osfile/_PromiseWorker.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
@ -149,18 +148,6 @@ let SessionFileInternal = {
*/
backupPath: OS.Path.join(OS.Constants.Path.profileDir, "sessionstore.bak"),
/**
* The promise returned by the latest call to |write|.
* We use it to ensure that AsyncShutdown.profileBeforeChange cannot
* interrupt a call to |write|.
*/
_latestWrite: null,
/**
* |true| once we have decided to stop receiving write instructiosn
*/
_isClosed: false,
/**
* Utility function to safely read a file synchronously.
* @param aPath
@ -223,11 +210,8 @@ let SessionFileInternal = {
},
write: function (aData) {
if (this._isClosed) {
return Promise.reject(new Error("_SessionFile is closed"));
}
let refObj = {};
return this._latestWrite = TaskUtils.spawn(function task() {
return TaskUtils.spawn(function task() {
TelemetryStopwatch.start("FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS", refObj);
try {
@ -243,15 +227,6 @@ let SessionFileInternal = {
Cu.reportError("Could not write session state file " + this.path
+ ": " + ex);
}
// At this stage, we are done writing. If shutdown has started,
// we will want to stop receiving write instructions.
if (Services.startup.shuttingDown) {
this._isClosed = true;
}
// In rare cases, we may already have other writes pending,
// which we need to flush before shutdown proceeds. AsyncShutdown
// uses _latestWrite to determine what needs to be flushed during
// shutdown.
}.bind(this));
},
@ -302,11 +277,3 @@ let SessionWorker = (function () {
}
};
})();
// Ensure that we can write sessionstore.js cleanly before the profile
// becomes unaccessible.
AsyncShutdown.profileBeforeChange.addBlocker(
"SessionFile: Finish writing the latest sessionstore.js",
function() {
return _SessionFile._latestWrite;
});