Skip to content

Commit

Permalink
Do not treat user cancel action as a download failure.
Browse files Browse the repository at this point in the history
Fixes #1862
  • Loading branch information
arantius committed Jul 31, 2014
1 parent 4dd733c commit 8412f3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion content/install.js
Expand Up @@ -58,7 +58,7 @@ function onBlur(e) {
}

function onCancel() {
gRemoteScript.cleanup();
gRemoteScript.cancel();
window.close();
}

Expand Down
8 changes: 7 additions & 1 deletion modules/remoteScript.js
Expand Up @@ -231,6 +231,7 @@ DownloadListener.prototype = {

function RemoteScript(aUrl) {
this._baseName = null;
this._cancelled = false;
this._channels = [];
this._dependencies = [];
this._metadata = null;
Expand All @@ -253,6 +254,11 @@ function RemoteScript(aUrl) {
RemoteScript.prototype.__defineGetter__(
'url', function() { return new String(this._url); });

RemoteScript.prototype.cancel = function() {
this._cancelled = true;
this.cleanup();
};

/** Clean up all temporary files, stop all actions. */
RemoteScript.prototype.cleanup = function(aErrorMessage) {
this.errorMessage = aErrorMessage || null;
Expand Down Expand Up @@ -284,7 +290,7 @@ RemoteScript.prototype.download = function(aCompletionCallback) {
} else {
this.downloadScript(GM_util.hitch(this, function(aSuccess, aPoint) {
if (aSuccess) this._downloadDependencies(aCompletionCallback);
aCompletionCallback(aSuccess, aPoint);
aCompletionCallback(this._cancelled || aSuccess, aPoint);
}));
}
};
Expand Down

0 comments on commit 8412f3d

Please sign in to comment.