[Pkg-javascript-commits] [node-stream-http] 96/208: Fix occasional test errors on Chrome 45

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 13 13:39:32 UTC 2017


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

rouca pushed a commit to branch master
in repository node-stream-http.

commit a10d19b3b21d1035bd6f0cb3072eaa60c49bc7fd
Author: John Hiesey <john at hiesey.com>
Date:   Tue Sep 15 16:52:11 2015 -0700

    Fix occasional test errors on Chrome 45
    
    If multiple chunks of data got queued up, the abort on data test
    would erroneously fail. Wait till the end of the tick before
    considering 'data' events as errors.
---
 test/browser/abort.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/test/browser/abort.js b/test/browser/abort.js
index 59a92ba..2cf43e9 100644
--- a/test/browser/abort.js
+++ b/test/browser/abort.js
@@ -30,18 +30,25 @@ test('abort on response', function (t) {
 test('abort on data', function (t) {
 	var req = http.get('/browserify.png?copies=5', function (res) {
 		var firstData = true
+		var failOnData = false
 
 		res.on('end', function () {
 			t.fail('unexpected end')
 		})
 
 		res.on('data', function (data) {
-			if (firstData) {
+			if (failOnData)
+				t.fail('unexpected data')
+			else if (firstData) {
 				firstData = false
 				req.abort()
 				t.end()
-			} else {
-				t.fail('unexpected data')
+				process.nextTick(function () {
+					// Wait for any data that may have been queued
+					// in the stream before considering data events
+					// as errors
+					failOnData = true
+				})
 			}
 		})
 	})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list