bug 1102923 - debug code to get a useful stack during test_spdy.js fail r=hurley

This commit is contained in:
Patrick McManus 2015-02-02 15:26:08 -05:00
parent b8f2bf9e17
commit 578bc58466
4 changed files with 29 additions and 0 deletions

View File

@ -733,6 +733,15 @@ SpdySession31::GenerateRstStream(uint32_t aStatusCode, uint32_t aID)
aStatusCode = PR_htonl(aStatusCode);
memcpy(packet + 12, &aStatusCode, 4);
#ifdef DEBUG
// Intentionally crash on debug builds when the debug 1102923 pref is set
// We hope to get useful stack traces to solve bug 1102923 when running
// test_spdy.js
if (gHttpHandler->Debug1102923()) {
MOZ_CRASH("Debug 1102923");
}
#endif
LogIO(this, nullptr, "Generate Reset", packet, 16);
FlushOutputQueue();
}

View File

@ -191,6 +191,7 @@ nsHttpHandler::nsHttpHandler()
, mAllowPush(true)
, mEnableAltSvc(true)
, mEnableAltSvcOE(true)
, mDebug1102923(false)
, mSpdySendingChunkSize(ASpdySession::kSendingChunkSize)
, mSpdySendBufferSize(ASpdySession::kTCPSendBufferSize)
, mSpdyPushAllowance(32768)
@ -1304,6 +1305,13 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
mSpdySendBufferSize = (uint32_t) clamped(val, 1500, 0x7fffffff);
}
if (PREF_CHANGED(HTTP_PREF("spdy.debug-1102923"))) {
rv = prefs->GetBoolPref(HTTP_PREF("spdy.debug-1102923"), &cVar);
if (NS_SUCCEEDED(rv)) {
mDebug1102923 = cVar;
}
}
// The maximum amount of time to wait for socket transport to be
// established
if (PREF_CHANGED(HTTP_PREF("connection-timeout"))) {

View File

@ -111,6 +111,7 @@ public:
bool AllowPush() { return mAllowPush; }
bool AllowAltSvc() { return mEnableAltSvc; }
bool AllowAltSvcOE() { return mEnableAltSvcOE; }
bool Debug1102923() { return mDebug1102923; }
uint32_t ConnectTimeout() { return mConnectTimeout; }
uint32_t ParallelSpeculativeConnectLimit() { return mParallelSpeculativeConnectLimit; }
bool CriticalRequestPrioritization() { return mCriticalRequestPrioritization; }
@ -481,6 +482,7 @@ private:
uint32_t mAllowPush : 1;
uint32_t mEnableAltSvc : 1;
uint32_t mEnableAltSvcOE : 1;
uint32_t mDebug1102923 : 1;
// Try to use SPDY features instead of HTTP/1.1 over SSL
SpdyInformation mSpdyInfo;

View File

@ -339,6 +339,12 @@ function test_spdy_post_big() {
do_post(posts[1], chan, listener);
}
function test_complete() {
resetPrefs();
do_test_finished();
do_timeout(0,run_next_test);
}
// hack - the header test resets the multiplex object on the server,
// so make sure header is always run before the multiplex test.
//
@ -356,6 +362,8 @@ var tests = [ test_spdy_post_big
, test_spdy_multiplex
, test_spdy_big
, test_spdy_post
// cleanup
, test_complete
];
var current_test = 0;
@ -432,6 +440,7 @@ function resetPrefs() {
prefs.setBoolPref("network.http.spdy.enabled", spdypref);
prefs.setBoolPref("network.http.spdy.enabled.v3-1", spdy3pref);
prefs.setBoolPref("network.http.spdy.allow-push", spdypush);
prefs.setBoolPref("network.http.spdy.debug-1102923", false);
}
function run_test() {
@ -459,6 +468,7 @@ function run_test() {
prefs.setBoolPref("network.http.spdy.enabled", true);
prefs.setBoolPref("network.http.spdy.enabled.v3-1", true);
prefs.setBoolPref("network.http.spdy.allow-push", true);
prefs.setBoolPref("network.http.spdy.debug-1102923", true);
loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(Ci.nsILoadGroup);