From 826db8c56c265cb0e8172c0d21fb3acc0cbf13c5 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 5 Oct 2010 19:23:38 -0400 Subject: [PATCH] Bug 508128 - Ensure input stream lifetime is not cut short by a GC. r=waldo a=test-only --HG-- extra : rebase_source : 063ab6d672ebc597297eda18076b0164927bc605 --- netwerk/test/httpserver/test/head_utils.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/netwerk/test/httpserver/test/head_utils.js b/netwerk/test/httpserver/test/head_utils.js index 55daac23d39..247c4d59a25 100644 --- a/netwerk/test/httpserver/test/head_utils.js +++ b/netwerk/test/httpserver/test/head_utils.js @@ -318,6 +318,7 @@ function runHttpTests(testArray, done) } } + listener._channel = ch; ch.asyncOpen(listener, null); } @@ -327,11 +328,14 @@ function runHttpTests(testArray, done) /** Stream listener for the channels. */ var listener = { + /** Current channel being observed by this. */ + _channel: null, /** Array of bytes of data in body of response. */ _data: [], onStartRequest: function(request, cx) { + do_check_true(request === this._channel); var ch = request.QueryInterface(Ci.nsIHttpChannel) .QueryInterface(Ci.nsIHttpChannelInternal); @@ -360,6 +364,8 @@ function runHttpTests(testArray, done) }, onStopRequest: function(request, cx, status) { + this._channel = null; + var ch = request.QueryInterface(Ci.nsIHttpChannel) .QueryInterface(Ci.nsIHttpChannelInternal); @@ -491,6 +497,7 @@ function runRawTests(testArray, done) function waitForMoreInput(stream) { + reader.stream = stream; stream = stream.QueryInterface(Ci.nsIAsyncInputStream); stream.asyncWait(reader, 0, 0, currentThread); } @@ -522,6 +529,7 @@ function runRawTests(testArray, done) { onInputStreamReady: function(stream) { + do_check_true(stream === this.stream); try { var bis = new BinaryInputStream(stream);