bug 855185 - test for thread safety of resetIPFamily() r=honzab

This commit is contained in:
Patrick McManus 2013-04-30 23:43:31 -04:00
parent 7ff297495c
commit 157c3866ad
3 changed files with 40 additions and 0 deletions

View File

@ -446,6 +446,7 @@ nsHttpConnectionMgr::LookupConnectionEntry(nsHttpConnectionInfo *ci,
nsHttpConnection *conn,
nsHttpTransaction *trans)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (!ci)
return nullptr;
@ -574,6 +575,8 @@ void
nsHttpConnectionMgr::ReportSpdyCWNDSetting(nsHttpConnectionInfo *ci,
uint32_t cwndValue)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (!gHttpHandler->UseSpdyPersistentSettings())
return;
@ -600,6 +603,8 @@ nsHttpConnectionMgr::ReportSpdyCWNDSetting(nsHttpConnectionInfo *ci,
uint32_t
nsHttpConnectionMgr::GetSpdyCWNDSetting(nsHttpConnectionInfo *ci)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (!gHttpHandler->UseSpdyPersistentSettings())
return 0;
@ -886,6 +891,7 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key,
nsAutoPtr<nsConnectionEntry> &ent,
void *closure)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
LOG((" pruning [ci=%s]\n", ent->mConnInfo->HashKey().get()));
@ -2222,6 +2228,7 @@ void
nsHttpConnectionMgr::OnMsgClosePersistentConnections(int32_t, void *)
{
LOG(("nsHttpConnectionMgr::OnMsgClosePersistentConnections\n"));
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
mCT.Enumerate(ClosePersistentConnectionsCB, this);
}
@ -3387,6 +3394,7 @@ nsHttpConnectionMgr::GetConnectionData(nsTArray<mozilla::net::HttpRetParams> *aA
void
nsHttpConnectionMgr::ResetIPFamillyPreference(nsHttpConnectionInfo *ci)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsConnectionEntry *ent = LookupConnectionEntry(ci, nullptr, nullptr);
if (ent)
ent->ResetIPFamilyPreference();

View File

@ -0,0 +1,31 @@
// This is essentially a debug mode crashtest to make sure everything
// involved in a reload runs on the right thread. It relies on the
// assertions in necko.
const Cc = Components.classes;
const Ci = Components.interfaces;
var listener = {
onStartRequest: function test_onStartR(request, ctx) {
},
onDataAvailable: function test_ODA() {
do_throw("Should not get any data!");
},
onStopRequest: function test_onStopR(request, ctx, status) {
do_test_finished();
},
};
function run_test() {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var chan = ios.newChannel("http://localhost:4444", "", null);
chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
chan.QueryInterface(Ci.nsIHttpChannel);
chan.asyncOpen(listener, null);
do_test_pending();
}

View File

@ -107,6 +107,7 @@ tail =
[test_file_partial_inputstream.js]
[test_file_protocol.js]
[test_filestreams.js]
[test_freshconnection.js]
[test_gre_resources.js]
[test_gzipped_206.js]
[test_head.js]