[Pkg-javascript-commits] [sockjs-client] 126/350: Make sure senders stop properly when user aborted.
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit d0a67a054ac4f4d2484bdbd2b927f1be1918b137
Author: Bryce Kahle <bkahle at gmail.com>
Date: Mon Oct 13 11:29:07 2014 -0400
Make sure senders stop properly when user aborted.
---
lib/transport/lib/ajax-based.js | 2 +-
lib/transport/lib/buffered-sender.js | 1 -
lib/transport/sender/jsonp.js | 8 +++++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/transport/lib/ajax-based.js b/lib/transport/lib/ajax-based.js
index a615283..bc3fda6 100644
--- a/lib/transport/lib/ajax-based.js
+++ b/lib/transport/lib/ajax-based.js
@@ -18,7 +18,7 @@ function createAjaxSender(AjaxObject) {
callback();
});
return function() {
- callback();
+ callback(new Error('Aborted'));
};
};
}
diff --git a/lib/transport/lib/buffered-sender.js b/lib/transport/lib/buffered-sender.js
index 5cf309f..7e9663e 100644
--- a/lib/transport/lib/buffered-sender.js
+++ b/lib/transport/lib/buffered-sender.js
@@ -64,7 +64,6 @@ BufferedSender.prototype._cleanup = function () {
BufferedSender.prototype.stop = function() {
if (this.sendStop) {
- // TODO I think this will call the callback from above with no error, and thus will call sendScheduleWait again
this.sendStop();
}
this.sendStop = null;
diff --git a/lib/transport/sender/jsonp.js b/lib/transport/sender/jsonp.js
index e9ae503..8dc93a7 100644
--- a/lib/transport/sender/jsonp.js
+++ b/lib/transport/sender/jsonp.js
@@ -51,7 +51,7 @@ module.exports = function (url, payload, callback) {
}
form.submit();
- var completed = function() {
+ var completed = function(err) {
if (!iframe.onerror) {
return;
}
@@ -65,7 +65,7 @@ module.exports = function (url, payload, callback) {
area.value = '';
// It is not possible to detect if the iframe succeeded or
// failed to submit our form.
- callback();
+ callback(err);
};
iframe.onerror = iframe.onload = completed;
iframe.onreadystatechange = function() {
@@ -73,5 +73,7 @@ module.exports = function (url, payload, callback) {
completed();
}
};
- return completed;
+ return function () {
+ completed(new Error('Aborted'));
+ };
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list