From 83c4b04a70d2319d4c292e7aa0c8872e7c1cd7fa Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 27 Nov 2017 07:57:36 +0100 Subject: Two (and more) extensions together - http resume - basilisk crashes --- netwerk/protocol/http/nsHttpChannel.cpp | 24 +++++++++++++- netwerk/test/mochitests/mochitest.ini | 1 + netwerk/test/mochitests/test_1396395.html | 52 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 netwerk/test/mochitests/test_1396395.html (limited to 'netwerk') diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 0e570e8cb..1c9093495 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -8335,9 +8335,31 @@ nsHttpChannel::ResumeInternal() LOG(("nsHttpChannel::ResumeInternal [this=%p]\n", this)); if (--mSuspendCount == 0 && mCallOnResume) { - nsresult rv = AsyncCall(mCallOnResume); + // Resume the interrupted procedure first, then resume + // the pump to continue process the input stream. + RefPtr> callOnResume= + NewRunnableMethod(this, mCallOnResume); + // Should not resume pump that created after resumption. + RefPtr transactionPump = mTransactionPump; + RefPtr cachePump = mCachePump; + + nsresult rv = + NS_DispatchToCurrentThread(NS_NewRunnableFunction( + [callOnResume, transactionPump, cachePump]() { + callOnResume->Run(); + + if (transactionPump) { + transactionPump->Resume(); + } + + if (cachePump) { + cachePump->Resume(); + } + }) + ); mCallOnResume = nullptr; NS_ENSURE_SUCCESS(rv, rv); + return rv; } nsresult rvTransaction = NS_OK; diff --git a/netwerk/test/mochitests/mochitest.ini b/netwerk/test/mochitests/mochitest.ini index 98d406c80..f8a919031 100644 --- a/netwerk/test/mochitests/mochitest.ini +++ b/netwerk/test/mochitests/mochitest.ini @@ -24,3 +24,4 @@ support-files = [test_user_agent_updates_reset.html] [test_viewsource_unlinkable.html] [test_xhr_method_case.html] +[test_1396395.html] diff --git a/netwerk/test/mochitests/test_1396395.html b/netwerk/test/mochitests/test_1396395.html new file mode 100644 index 000000000..193ef219c --- /dev/null +++ b/netwerk/test/mochitests/test_1396395.html @@ -0,0 +1,52 @@ + + + + + + + + + + + + + -- cgit v1.2.3