From 1ea1d4d58773b7171bd85b2a8e80e4a154c7409a Mon Sep 17 00:00:00 2001 From: Nicholas Hurley Date: Wed, 27 May 2015 09:49:00 +0200 Subject: [PATCH] Bug 1159747 - delete h2 static compression table in such a way to avoid crashes after network changes. r=mcmanus --- netwerk/build/nsNetModule.cpp | 5 +++++ netwerk/protocol/http/Http2Compression.cpp | 4 ++++ netwerk/protocol/http/nsHttpConnectionMgr.cpp | 2 -- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/netwerk/build/nsNetModule.cpp b/netwerk/build/nsNetModule.cpp index 63ee99de43da..568d5152288d 100644 --- a/netwerk/build/nsNetModule.cpp +++ b/netwerk/build/nsNetModule.cpp @@ -225,6 +225,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init) #ifdef NECKO_PROTOCOL_http // http/https #include "nsHttpHandler.h" +#include "Http2Compression.h" #undef LOG #undef LOG_ENABLED #include "nsHttpAuthManager.h" @@ -655,6 +656,10 @@ static void nsNetShutdown() mozilla::net::WebSocketChannel::Shutdown(); #endif // NECKO_PROTOCOL_websocket +#ifdef NECKO_PROTOCOL_http + mozilla::net::Http2CompressionCleanup(); +#endif // NECKO_PROTOCOL_http + delete gNetSniffers; gNetSniffers = nullptr; delete gDataSniffers; diff --git a/netwerk/protocol/http/Http2Compression.cpp b/netwerk/protocol/http/Http2Compression.cpp index 854a02889bcc..cf649612eae2 100644 --- a/netwerk/protocol/http/Http2Compression.cpp +++ b/netwerk/protocol/http/Http2Compression.cpp @@ -228,6 +228,10 @@ Http2BaseCompressor::MakeRoom(uint32_t amount, const char *direction) void Http2BaseCompressor::DumpState() { + if (!LOG_ENABLED()) { + return; + } + LOG(("Header Table")); uint32_t i; uint32_t length = mHeaderTable.Length(); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 9e711d5b130a..5b80813fbd02 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -30,7 +30,6 @@ #include "nsITransport.h" #include "nsISocketTransportService.h" #include -#include "Http2Compression.h" #include "mozilla/ChaosMode.h" #include "mozilla/unused.h" @@ -177,7 +176,6 @@ nsHttpConnectionMgr::Shutdown() // wait for shutdown event to complete while (!shutdown) NS_ProcessNextEvent(NS_GetCurrentThread()); - Http2CompressionCleanup(); return NS_OK; }