Bug 508128 - Ensure input stream lifetime is not cut short by a GC. r=waldo a=test-only

--HG--
extra : rebase_source : 063ab6d672ebc597297eda18076b0164927bc605
This commit is contained in:
Josh Matthews 2010-10-05 19:23:38 -04:00
Родитель 9837d8160a
Коммит 0c4cb550e8
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -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);