[Pkg-mozext-commits] [greasemonkey] 08/13: Always fire the script installation callback asynchronously.
David Prévot
taffit at moszumanska.debian.org
Thu Jul 17 20:10:00 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 3835e6c34b8c7f41c23f0a355894bd446c4d5797
Author: Ventero <ventero at ventero.de>
Date: Thu Apr 3 05:40:45 2014 +0200
Always fire the script installation callback asynchronously.
This fixes scripts being injected twice when all @requires are removed.
---
modules/remoteScript.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/remoteScript.js b/modules/remoteScript.js
index 2a7f9f8..dc23035 100644
--- a/modules/remoteScript.js
+++ b/modules/remoteScript.js
@@ -491,8 +491,14 @@ RemoteScript.prototype._downloadDependencies = function(aCompletionCallback) {
this._progressIndex++;
if (this._progressIndex > this._dependencies.length) {
this.done = true;
- this._dispatchCallbacks('progress', 1);
- return aCompletionCallback(true, 'dependencies');
+ // Always call the callback asynchronously. That way, the caller doesn't
+ // have to take special care of the case where this is called synchronously
+ // when there is nothing to download.
+ GM_util.timeout(GM_util.hitch(this, function() {
+ this._dispatchCallbacks('progress', 1);
+ aCompletionCallback(true, 'dependencies');
+ }), 0);
+ return;
}
// Because _progressIndex includes the base script at 0, subtract one to
--
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