Backed out changeset f785bf2e2c51 (bug 941726) for test failures in B2g Desktop Linux & B2G ICS Emulator Opt

This commit is contained in:
Carsten "Tomcat" Book 2013-12-03 12:52:49 +01:00
parent b213442863
commit 3b03290806
2 changed files with 9 additions and 17 deletions

View File

@ -2043,16 +2043,10 @@ this.DownloadLegacySaver.prototype = {
Cu.reportError(e2);
}
}
// In case the operation failed, ensure we stop downloading data. Since
// we never re-enter this function, deferCanceled is always available.
this.deferCanceled.resolve();
throw ex;
} finally {
// We don't need the reference to the request anymore. We must also set
// deferCanceled to null in order to free any indirect references it
// may hold to the request.
// We don't need the reference to the request anymore.
this.request = null;
this.deferCanceled = null;
// Allow the download to restart through a DownloadCopySaver.
this.firstExecutionFinished = true;
}
@ -2069,12 +2063,8 @@ this.DownloadLegacySaver.prototype = {
return this.copySaver.cancel.apply(this.copySaver, arguments);
}
// If the download hasn't stopped already, resolve deferCanceled so that the
// operation is canceled as soon as a cancellation handler is registered.
// Note that the handler might not have been registered yet.
if (this.deferCanceled) {
this.deferCanceled.resolve();
}
// Cancel the operation as soon as the object is connected.
this.deferCanceled.resolve();
},
/**

View File

@ -115,8 +115,7 @@ DownloadLegacyTransfer.prototype = {
// To handle asynchronous cancellation properly, we should hook up the
// handler only after we have been notified that the main request
// started. We will wait until the main request stopped before
// notifying that the download has been canceled. Since the request has
// not completed yet, deferCanceled is guaranteed to be set.
// notifying that the download has been canceled.
return download.saver.deferCanceled.promise.then(() => {
// Only cancel if the object executing the download is still running.
if (this._cancelable && !this._componentFailed) {
@ -240,8 +239,11 @@ DownloadLegacyTransfer.prototype = {
aDownload.tryToKeepPartialData = true;
}
// Start the download before allowing it to be controlled. Ignore errors.
aDownload.start().then(null, () => {});
// Start the download before allowing it to be controlled.
aDownload.start().then(null, function () {
// In case the operation failed, ensure we stop downloading data.
aDownload.saver.deferCanceled.resolve();
});
// Start processing all the other events received through nsITransfer.
this._deferDownload.resolve(aDownload);