[Pkg-mozext-commits] [greasemonkey] 07/15: Do not treat user cancel action as a download failure.

David Prévot taffit at moszumanska.debian.org
Sat Aug 2 12:51:55 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit 8412f3d3172021bebdee7322b8321e0fbea74d4a
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Thu Jul 31 11:52:21 2014 -0400

    Do not treat user cancel action as a download failure.
    
    Fixes #1862
---
 content/install.js      | 2 +-
 modules/remoteScript.js | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/content/install.js b/content/install.js
index 6be9027..3cdbf30 100644
--- a/content/install.js
+++ b/content/install.js
@@ -58,7 +58,7 @@ function onBlur(e) {
 }
 
 function onCancel() {
-  gRemoteScript.cleanup();
+  gRemoteScript.cancel();
   window.close();
 }
 
diff --git a/modules/remoteScript.js b/modules/remoteScript.js
index 91cddf9..148041c 100644
--- a/modules/remoteScript.js
+++ b/modules/remoteScript.js
@@ -231,6 +231,7 @@ DownloadListener.prototype = {
 
 function RemoteScript(aUrl) {
   this._baseName = null;
+  this._cancelled = false;
   this._channels = [];
   this._dependencies = [];
   this._metadata = null;
@@ -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;
@@ -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);
     }));
   }
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list