Bug 924967 - Add main thread assertions for Cancel in nsLoadGroup, nsHttpChannel and nsInputStreamPump r=mcmanus

This commit is contained in:
Steve Workman 2013-10-17 10:21:32 -07:00
parent 5c3c252d31
commit 2201bcbcea
4 changed files with 9 additions and 0 deletions

View File

@ -198,6 +198,8 @@ nsInputStreamPump::GetStatus(nsresult *status)
NS_IMETHODIMP
nsInputStreamPump::Cancel(nsresult status)
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(mMonitor);
LOG(("nsInputStreamPump::Cancel [this=%p status=%x]\n",

View File

@ -22,6 +22,7 @@
#include "nsIInterfaceRequestor.h"
#include "nsIRequestObserver.h"
#include "CacheObserver.h"
#include "MainThreadUtils.h"
using namespace mozilla;
using namespace mozilla::net;
@ -224,6 +225,8 @@ AppendRequestsToArray(PLDHashTable *table, PLDHashEntryHdr *hdr,
NS_IMETHODIMP
nsLoadGroup::Cancel(nsresult status)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code");
nsresult rv;
uint32_t count = mRequests.entryCount;

View File

@ -917,6 +917,8 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result)
NS_IMETHODIMP
HttpChannelChild::Cancel(nsresult status)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mCanceled) {
// If this cancel occurs before nsHttpChannel has been set up, AsyncOpen
// is responsible for cleaning up.

View File

@ -4308,6 +4308,8 @@ NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel)
NS_IMETHODIMP
nsHttpChannel::Cancel(nsresult status)
{
MOZ_ASSERT(NS_IsMainThread());
LOG(("nsHttpChannel::Cancel [this=%p status=%x]\n", this, status));
if (mCanceled) {
LOG((" ignoring; already canceled\n"));