[Pkg-javascript-commits] [sockjs-client] 160/350: Add more debug
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:58 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 05da830bbb564dd4426fa89b37e474fddfa4810e
Author: Bryce Kahle <bkahle at gmail.com>
Date: Thu Oct 16 21:28:40 2014 -0400
Add more debug
---
lib/info-receiver.js | 7 +++++++
lib/main.js | 3 +++
tests/lib/echo-tests.js | 4 ++++
tests/lib/end-to-end.js | 3 ++-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lib/info-receiver.js b/lib/info-receiver.js
index 920826d..c4cb768 100644
--- a/lib/info-receiver.js
+++ b/lib/info-receiver.js
@@ -10,9 +10,11 @@ var EventEmitter = require('events').EventEmitter
, XHRFake = require('./transport/sender/xhr-fake')
, InfoIframe = require('./info-iframe')
, InfoAjax = require('./info-ajax')
+ , debug = require('debug')('sockjs-client:info')
;
function InfoReceiver(baseUrl) {
+ debug(baseUrl);
var self = this;
EventEmitter.call(this);
@@ -40,6 +42,7 @@ InfoReceiver.prototype._getReceiver = function (baseUrl) {
};
InfoReceiver.prototype.doXhr = function(baseUrl, AjaxObject) {
+ debug('doXhr', baseUrl, AjaxObject.name);
var self = this
, url = baseUrl + '/info'
;
@@ -47,17 +50,20 @@ InfoReceiver.prototype.doXhr = function(baseUrl, AjaxObject) {
this.xo = AjaxObject ? new InfoAjax(url, AjaxObject) : new InfoIframe(url);
this.timeoutRef = setTimeout(function() {
+ debug('timeout');
self._cleanup(false);
self.emit('finish');
}, InfoReceiver.timeout);
this.xo.once('finish', function(info, rtt) {
+ debug('finish', info, rtt);
self._cleanup(true);
self.emit('finish', info, rtt);
});
};
InfoReceiver.prototype._cleanup = function(wasClean) {
+ debug('_cleanup');
clearTimeout(this.timeoutRef);
this.timeoutRef = null;
if (!wasClean && this.xo) {
@@ -67,6 +73,7 @@ InfoReceiver.prototype._cleanup = function(wasClean) {
};
InfoReceiver.prototype.close = function() {
+ debug('close');
this.removeAllListeners();
this._cleanup(false);
};
diff --git a/lib/main.js b/lib/main.js
index acdba80..95824c5 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -154,6 +154,7 @@ SockJS.CLOSING = 2;
SockJS.CLOSED = 3;
SockJS.prototype._receiveInfo = function(info, rtt) {
+ debug('_receiveInfo', rtt);
this._ir = null;
if (!info) {
this._close(1002, 'Cannot connect to server');
@@ -167,9 +168,11 @@ SockJS.prototype._receiveInfo = function(info, rtt) {
this._transUrl = info.base_url ? info.base_url : this.url;
info.nullOrigin = global.document && !global.document.domain;
info.sameOrigin = origin.isSameOriginUrl(this.url, loc.href);
+ debug('info: ', info);
// determine list of desired and supported transports
var enabledTransports = transports.filterToEnabled(this.url, this._transportsWhitelist, info);
this._transports = enabledTransports.main;
+ debug(this._transports.length + ' enabled transports');
this._connect();
};
diff --git a/tests/lib/echo-tests.js b/tests/lib/echo-tests.js
index eeff585..a31b5b1 100644
--- a/tests/lib/echo-tests.js
+++ b/tests/lib/echo-tests.js
@@ -88,6 +88,8 @@ module.exports.echoUtfEncoding = function echoUtfEncoding(transport) {
module.exports.echoFromChild = function echoFromChild(transport) {
it('echo from child', function (done) {
+ var title = this.runnable().fullTitle();
+ debug('start', title);
var hook = testUtils.createIframe('/sockjs-in-parent.html');
var sjs = testUtils.newSockJs('/echo', transport);
var code = 'hook.sjs.send("a"); hook.onsend();';
@@ -104,6 +106,7 @@ module.exports.echoFromChild = function echoFromChild(transport) {
timeout = setTimeout(function() {
expect().fail('echo timeout');
sjs.close();
+ debug('end', title);
}, 300);
};
@@ -123,6 +126,7 @@ module.exports.echoFromChild = function echoFromChild(transport) {
};
sjs.onclose = function() {
done();
+ debug('end', title);
};
});
};
diff --git a/tests/lib/end-to-end.js b/tests/lib/end-to-end.js
index aef88eb..bfbfe4c 100644
--- a/tests/lib/end-to-end.js
+++ b/tests/lib/end-to-end.js
@@ -5,7 +5,8 @@ var expect = require('expect.js')
;
describe('End to End', function () {
- this.timeout(10000);
+ // selenium needs a long time to timeout
+ this.timeout(20000);
describe('Connection Errors', function () {
it('invalid url 404', function (done) {
--
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