mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 1328686 Add diagnostic assertions to dom/cache. r=asuth
This commit is contained in:
parent
e81dcd530e
commit
180d53d0e9
4
dom/cache/ActorChild.cpp
vendored
4
dom/cache/ActorChild.cpp
vendored
@ -20,7 +20,7 @@ ActorChild::SetWorkerHolder(CacheWorkerHolder* aWorkerHolder)
|
||||
// them. In this case the workerHolder will be added multiple times. This is
|
||||
// permitted, but the workerHolder should be the same each time.
|
||||
if (mWorkerHolder) {
|
||||
MOZ_ASSERT(mWorkerHolder == aWorkerHolder);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mWorkerHolder == aWorkerHolder);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ ActorChild::ActorChild()
|
||||
|
||||
ActorChild::~ActorChild()
|
||||
{
|
||||
MOZ_ASSERT(!mWorkerHolder);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mWorkerHolder);
|
||||
}
|
||||
|
||||
} // namespace cache
|
||||
|
56
dom/cache/AutoUtils.cpp
vendored
56
dom/cache/AutoUtils.cpp
vendored
@ -66,7 +66,7 @@ AutoChildOpArgs::AutoChildOpArgs(TypeUtils* aTypeUtils,
|
||||
, mOpArgs(aOpArgs)
|
||||
, mSent(false)
|
||||
{
|
||||
MOZ_ASSERT(mTypeUtils);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTypeUtils);
|
||||
MOZ_RELEASE_ASSERT(aEntryCount != 0);
|
||||
// We are using AutoIPCStream objects to cleanup target IPCStream
|
||||
// structures embedded in our CacheOpArgs. These IPCStream structs
|
||||
@ -78,7 +78,7 @@ AutoChildOpArgs::AutoChildOpArgs(TypeUtils* aTypeUtils,
|
||||
CachePutAllArgs& args = mOpArgs.get_CachePutAllArgs();
|
||||
args.requestResponseList().SetCapacity(aEntryCount);
|
||||
} else {
|
||||
MOZ_ASSERT(aEntryCount == 1);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aEntryCount == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ void
|
||||
AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
|
||||
SchemeAction aSchemeAction, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
|
||||
switch(mOpArgs.type()) {
|
||||
case CacheOpArgs::TCacheMatchArgs:
|
||||
@ -158,7 +158,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
|
||||
case CacheOpArgs::TCacheMatchAllArgs:
|
||||
{
|
||||
CacheMatchAllArgs& args = mOpArgs.get_CacheMatchAllArgs();
|
||||
MOZ_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
|
||||
MOZ_DIAGNOSTIC_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
|
||||
args.requestOrVoid() = CacheRequest();
|
||||
mTypeUtils->ToCacheRequest(args.requestOrVoid().get_CacheRequest(),
|
||||
aRequest, aBodyAction, aSchemeAction,
|
||||
@ -175,7 +175,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
|
||||
case CacheOpArgs::TCacheKeysArgs:
|
||||
{
|
||||
CacheKeysArgs& args = mOpArgs.get_CacheKeysArgs();
|
||||
MOZ_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
|
||||
MOZ_DIAGNOSTIC_ASSERT(args.requestOrVoid().type() == CacheRequestOrVoid::Tvoid_t);
|
||||
args.requestOrVoid() = CacheRequest();
|
||||
mTypeUtils->ToCacheRequest(args.requestOrVoid().get_CacheRequest(),
|
||||
aRequest, aBodyAction, aSchemeAction,
|
||||
@ -200,7 +200,7 @@ bool
|
||||
MatchInPutList(InternalRequest* aRequest,
|
||||
const nsTArray<CacheRequestResponse>& aPutList)
|
||||
{
|
||||
MOZ_ASSERT(aRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aRequest);
|
||||
|
||||
// This method implements the SW spec QueryCache algorithm against an
|
||||
// in memory array of Request/Response objects. This essentially the
|
||||
@ -253,23 +253,23 @@ MatchInPutList(InternalRequest* aRequest,
|
||||
for (; token;
|
||||
token = nsCRT::strtok(rawBuffer, NS_HTTP_HEADER_SEPS, &rawBuffer)) {
|
||||
nsDependentCString header(token);
|
||||
MOZ_ASSERT(!header.EqualsLiteral("*"),
|
||||
"We should have already caught this in "
|
||||
"TypeUtils::ToPCacheResponseWithoutBody()");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!header.EqualsLiteral("*"),
|
||||
"We should have already caught this in "
|
||||
"TypeUtils::ToPCacheResponseWithoutBody()");
|
||||
|
||||
ErrorResult headerRv;
|
||||
nsAutoCString value;
|
||||
requestHeaders->Get(header, value, headerRv);
|
||||
if (NS_WARN_IF(headerRv.Failed())) {
|
||||
headerRv.SuppressException();
|
||||
MOZ_ASSERT(value.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(value.IsEmpty());
|
||||
}
|
||||
|
||||
nsAutoCString cachedValue;
|
||||
cachedRequestHeaders->Get(header, cachedValue, headerRv);
|
||||
if (NS_WARN_IF(headerRv.Failed())) {
|
||||
headerRv.SuppressException();
|
||||
MOZ_ASSERT(cachedValue.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(cachedValue.IsEmpty());
|
||||
}
|
||||
|
||||
if (value != cachedValue) {
|
||||
@ -294,7 +294,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
|
||||
SchemeAction aSchemeAction, Response& aResponse,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
|
||||
switch(mOpArgs.type()) {
|
||||
case CacheOpArgs::TCachePutAllArgs:
|
||||
@ -350,7 +350,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
|
||||
const CacheOpArgs&
|
||||
AutoChildOpArgs::SendAsOpArgs()
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
mSent = true;
|
||||
for (UniquePtr<AutoIPCStream>& autoStream : mStreamCleanupList) {
|
||||
autoStream->TakeValue();
|
||||
@ -368,7 +368,7 @@ AutoParentOpResult::AutoParentOpResult(mozilla::ipc::PBackgroundParent* aManager
|
||||
, mStreamControl(nullptr)
|
||||
, mSent(false)
|
||||
{
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
MOZ_RELEASE_ASSERT(aEntryCount != 0);
|
||||
// We are using AutoIPCStream objects to cleanup target IPCStream
|
||||
// structures embedded in our CacheOpArgs. These IPCStream structs
|
||||
@ -383,7 +383,7 @@ AutoParentOpResult::AutoParentOpResult(mozilla::ipc::PBackgroundParent* aManager
|
||||
CacheKeysResult& result = mOpResult.get_CacheKeysResult();
|
||||
result.requestList().SetCapacity(aEntryCount);
|
||||
} else {
|
||||
MOZ_ASSERT(aEntryCount == 1);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aEntryCount == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,8 +416,8 @@ AutoParentOpResult::~AutoParentOpResult()
|
||||
void
|
||||
AutoParentOpResult::Add(CacheId aOpenedCacheId, Manager* aManager)
|
||||
{
|
||||
MOZ_ASSERT(mOpResult.type() == CacheOpResult::TStorageOpenResult);
|
||||
MOZ_ASSERT(mOpResult.get_StorageOpenResult().actorParent() == nullptr);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mOpResult.type() == CacheOpResult::TStorageOpenResult);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mOpResult.get_StorageOpenResult().actorParent() == nullptr);
|
||||
mOpResult.get_StorageOpenResult().actorParent() =
|
||||
mManager->SendPCacheConstructor(new CacheParent(aManager, aOpenedCacheId));
|
||||
}
|
||||
@ -426,13 +426,13 @@ void
|
||||
AutoParentOpResult::Add(const SavedResponse& aSavedResponse,
|
||||
StreamList* aStreamList)
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
|
||||
switch (mOpResult.type()) {
|
||||
case CacheOpResult::TCacheMatchResult:
|
||||
{
|
||||
CacheMatchResult& result = mOpResult.get_CacheMatchResult();
|
||||
MOZ_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
|
||||
MOZ_DIAGNOSTIC_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
|
||||
result.responseOrVoid() = aSavedResponse.mValue;
|
||||
SerializeResponseBody(aSavedResponse, aStreamList,
|
||||
&result.responseOrVoid().get_CacheResponse());
|
||||
@ -455,7 +455,7 @@ AutoParentOpResult::Add(const SavedResponse& aSavedResponse,
|
||||
case CacheOpResult::TStorageMatchResult:
|
||||
{
|
||||
StorageMatchResult& result = mOpResult.get_StorageMatchResult();
|
||||
MOZ_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
|
||||
MOZ_DIAGNOSTIC_ASSERT(result.responseOrVoid().type() == CacheResponseOrVoid::Tvoid_t);
|
||||
result.responseOrVoid() = aSavedResponse.mValue;
|
||||
SerializeResponseBody(aSavedResponse, aStreamList,
|
||||
&result.responseOrVoid().get_CacheResponse());
|
||||
@ -470,7 +470,7 @@ void
|
||||
AutoParentOpResult::Add(const SavedRequest& aSavedRequest,
|
||||
StreamList* aStreamList)
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
|
||||
switch (mOpResult.type()) {
|
||||
case CacheOpResult::TCacheKeysResult:
|
||||
@ -503,7 +503,7 @@ AutoParentOpResult::Add(const SavedRequest& aSavedRequest,
|
||||
const CacheOpResult&
|
||||
AutoParentOpResult::SendAsOpResult()
|
||||
{
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
mSent = true;
|
||||
for (UniquePtr<AutoIPCStream>& autoStream : mStreamCleanupList) {
|
||||
autoStream->TakeValue();
|
||||
@ -516,7 +516,7 @@ AutoParentOpResult::SerializeResponseBody(const SavedResponse& aSavedResponse,
|
||||
StreamList* aStreamList,
|
||||
CacheResponse* aResponseOut)
|
||||
{
|
||||
MOZ_ASSERT(aResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResponseOut);
|
||||
|
||||
if (!aSavedResponse.mHasBodyId) {
|
||||
aResponseOut->body() = void_t();
|
||||
@ -532,12 +532,12 @@ void
|
||||
AutoParentOpResult::SerializeReadStream(const nsID& aId, StreamList* aStreamList,
|
||||
CacheReadStream* aReadStreamOut)
|
||||
{
|
||||
MOZ_ASSERT(aStreamList);
|
||||
MOZ_ASSERT(aReadStreamOut);
|
||||
MOZ_ASSERT(!mSent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mSent);
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream = aStreamList->Extract(aId);
|
||||
MOZ_ASSERT(stream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(stream);
|
||||
|
||||
if (!mStreamControl) {
|
||||
mStreamControl = static_cast<CacheStreamControlParent*>(
|
||||
@ -557,7 +557,7 @@ AutoParentOpResult::SerializeReadStream(const nsID& aId, StreamList* aStreamList
|
||||
aId, stream);
|
||||
ErrorResult rv;
|
||||
readStream->Serialize(aReadStreamOut, mStreamCleanupList, rv);
|
||||
MOZ_ASSERT(!rv.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!rv.Failed());
|
||||
}
|
||||
|
||||
} // namespace cache
|
||||
|
28
dom/cache/Cache.cpp
vendored
28
dom/cache/Cache.cpp
vendored
@ -122,8 +122,8 @@ public:
|
||||
, mPromise(aPromise)
|
||||
{
|
||||
MOZ_ASSERT_IF(!NS_IsMainThread(), mWorkerHolder);
|
||||
MOZ_ASSERT(mCache);
|
||||
MOZ_ASSERT(mPromise);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mCache);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mPromise);
|
||||
}
|
||||
|
||||
virtual void
|
||||
@ -198,7 +198,7 @@ public:
|
||||
responseList.AppendElement(Move(response));
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mRequestList.Length() == responseList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mRequestList.Length() == responseList.Length());
|
||||
|
||||
// Now store the unwrapped Response list in the Cache.
|
||||
ErrorResult result;
|
||||
@ -257,8 +257,8 @@ Cache::Cache(nsIGlobalObject* aGlobal, CacheChild* aActor)
|
||||
: mGlobal(aGlobal)
|
||||
, mActor(aActor)
|
||||
{
|
||||
MOZ_ASSERT(mGlobal);
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
mActor->SetListener(this);
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest,
|
||||
}
|
||||
|
||||
GlobalObject global(aContext, mGlobal->GetGlobalJSObject());
|
||||
MOZ_ASSERT(!global.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!global.Failed());
|
||||
|
||||
nsTArray<RefPtr<Request>> requestList(1);
|
||||
RefPtr<Request> request = Request::Constructor(global, aRequest,
|
||||
@ -371,7 +371,7 @@ Cache::AddAll(JSContext* aContext,
|
||||
CacheChild::AutoLock actorLock(mActor);
|
||||
|
||||
GlobalObject global(aContext, mGlobal->GetGlobalJSObject());
|
||||
MOZ_ASSERT(!global.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!global.Failed());
|
||||
|
||||
nsTArray<RefPtr<Request>> requestList(aRequestList.Length());
|
||||
for (uint32_t i = 0; i < aRequestList.Length(); ++i) {
|
||||
@ -541,8 +541,8 @@ Cache::WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto)
|
||||
void
|
||||
Cache::DestroyInternal(CacheChild* aActor)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_ASSERT(mActor == aActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor == aActor);
|
||||
mActor->ClearListener();
|
||||
mActor = nullptr;
|
||||
}
|
||||
@ -565,7 +565,7 @@ PBackgroundChild*
|
||||
Cache::GetIPCManager()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Cache);
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
return mActor->Manager();
|
||||
}
|
||||
|
||||
@ -576,14 +576,14 @@ Cache::~Cache()
|
||||
mActor->StartDestroyFromListener();
|
||||
// DestroyInternal() is called synchronously by StartDestroyFromListener().
|
||||
// So we should have already cleared the mActor.
|
||||
MOZ_ASSERT(!mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mActor);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Cache::ExecuteOp(AutoChildOpArgs& aOpArgs, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
|
||||
RefPtr<Promise> promise = Promise::Create(mGlobal, aRv);
|
||||
if (NS_WARN_IF(!promise)) {
|
||||
@ -598,7 +598,7 @@ already_AddRefed<Promise>
|
||||
Cache::AddAll(const GlobalObject& aGlobal,
|
||||
nsTArray<RefPtr<Request>>&& aRequestList, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
|
||||
// If there is no work to do, then resolve immediately
|
||||
if (aRequestList.IsEmpty()) {
|
||||
@ -653,7 +653,7 @@ Cache::PutAll(const nsTArray<RefPtr<Request>>& aRequestList,
|
||||
const nsTArray<RefPtr<Response>>& aResponseList,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aRequestList.Length() == aResponseList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aRequestList.Length() == aResponseList.Length());
|
||||
|
||||
if (NS_WARN_IF(!mActor)) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
|
22
dom/cache/CacheChild.cpp
vendored
22
dom/cache/CacheChild.cpp
vendored
@ -42,25 +42,25 @@ CacheChild::~CacheChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(cache::CacheChild);
|
||||
NS_ASSERT_OWNINGTHREAD(CacheChild);
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_ASSERT(!mNumChildActors);
|
||||
MOZ_ASSERT(!mLocked);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mNumChildActors);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mLocked);
|
||||
}
|
||||
|
||||
void
|
||||
CacheChild::SetListener(Cache* aListener)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheChild);
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
mListener = aListener;
|
||||
MOZ_ASSERT(mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListener);
|
||||
}
|
||||
|
||||
void
|
||||
CacheChild::ClearListener()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheChild);
|
||||
MOZ_ASSERT(mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListener);
|
||||
mListener = nullptr;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ CacheChild::StartDestroyFromListener()
|
||||
// The listener should be held alive by any async operations, so if it
|
||||
// is going away then there must not be any child actors. This in turn
|
||||
// ensures that StartDestroy() will not trigger the delayed path.
|
||||
MOZ_ASSERT(!mNumChildActors);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mNumChildActors);
|
||||
|
||||
StartDestroy();
|
||||
}
|
||||
@ -113,7 +113,7 @@ CacheChild::StartDestroy()
|
||||
listener->DestroyInternal(this);
|
||||
|
||||
// Cache listener should call ClearListener() in DestroyInternal()
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
|
||||
// Start actor destruction from parent process
|
||||
Unused << SendTeardown();
|
||||
@ -127,7 +127,7 @@ CacheChild::ActorDestroy(ActorDestroyReason aReason)
|
||||
if (listener) {
|
||||
listener->DestroyInternal(this);
|
||||
// Cache listener should call ClearListener() in DestroyInternal()
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
}
|
||||
|
||||
RemoveWorkerHolder();
|
||||
@ -167,7 +167,7 @@ void
|
||||
CacheChild::Lock()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheChild);
|
||||
MOZ_ASSERT(!mLocked);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mLocked);
|
||||
mLocked = true;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ void
|
||||
CacheChild::Unlock()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheChild);
|
||||
MOZ_ASSERT(mLocked);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mLocked);
|
||||
mLocked = false;
|
||||
MaybeFlushDelayedDestroy();
|
||||
}
|
||||
|
2
dom/cache/CacheChild.h
vendored
2
dom/cache/CacheChild.h
vendored
@ -35,7 +35,7 @@ public:
|
||||
explicit AutoLock(CacheChild* aActor)
|
||||
: mActor(aActor)
|
||||
{
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
mActor->Lock();
|
||||
}
|
||||
|
||||
|
10
dom/cache/CacheOpChild.cpp
vendored
10
dom/cache/CacheOpChild.cpp
vendored
@ -70,9 +70,9 @@ CacheOpChild::CacheOpChild(CacheWorkerHolder* aWorkerHolder,
|
||||
, mParent(aParent)
|
||||
, mPromise(aPromise)
|
||||
{
|
||||
MOZ_ASSERT(mGlobal);
|
||||
MOZ_ASSERT(mParent);
|
||||
MOZ_ASSERT(mPromise);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mParent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mPromise);
|
||||
|
||||
MOZ_ASSERT_IF(!NS_IsMainThread(), aWorkerHolder);
|
||||
SetWorkerHolder(aWorkerHolder);
|
||||
@ -81,7 +81,7 @@ CacheOpChild::CacheOpChild(CacheWorkerHolder* aWorkerHolder,
|
||||
CacheOpChild::~CacheOpChild()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpChild);
|
||||
MOZ_ASSERT(!mPromise);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mPromise);
|
||||
}
|
||||
|
||||
void
|
||||
@ -106,7 +106,7 @@ CacheOpChild::Recv__delete__(const ErrorResult& aRv,
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpChild);
|
||||
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
MOZ_ASSERT(aResult.type() == CacheOpResult::Tvoid_t);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResult.type() == CacheOpResult::Tvoid_t);
|
||||
// TODO: Remove this const_cast (bug 1152078).
|
||||
// It is safe for now since this ErrorResult is handed off to us by IPDL
|
||||
// and is thrown into the trash afterwards.
|
||||
|
26
dom/cache/CacheOpParent.cpp
vendored
26
dom/cache/CacheOpParent.cpp
vendored
@ -29,7 +29,7 @@ CacheOpParent::CacheOpParent(PBackgroundParent* aIpcManager, CacheId aCacheId,
|
||||
, mNamespace(INVALID_NAMESPACE)
|
||||
, mOpArgs(aOpArgs)
|
||||
{
|
||||
MOZ_ASSERT(mIpcManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIpcManager);
|
||||
}
|
||||
|
||||
CacheOpParent::CacheOpParent(PBackgroundParent* aIpcManager,
|
||||
@ -39,7 +39,7 @@ CacheOpParent::CacheOpParent(PBackgroundParent* aIpcManager,
|
||||
, mNamespace(aNamespace)
|
||||
, mOpArgs(aOpArgs)
|
||||
{
|
||||
MOZ_ASSERT(mIpcManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIpcManager);
|
||||
}
|
||||
|
||||
CacheOpParent::~CacheOpParent()
|
||||
@ -51,8 +51,8 @@ void
|
||||
CacheOpParent::Execute(ManagerId* aManagerId)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpParent);
|
||||
MOZ_ASSERT(!mManager);
|
||||
MOZ_ASSERT(!mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mVerifier);
|
||||
|
||||
RefPtr<cache::Manager> manager;
|
||||
nsresult rv = cache::Manager::GetOrCreate(aManagerId, getter_AddRefs(manager));
|
||||
@ -70,14 +70,14 @@ void
|
||||
CacheOpParent::Execute(cache::Manager* aManager)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpParent);
|
||||
MOZ_ASSERT(!mManager);
|
||||
MOZ_ASSERT(!mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mVerifier);
|
||||
|
||||
mManager = aManager;
|
||||
|
||||
// Handle put op
|
||||
if (mOpArgs.type() == CacheOpArgs::TCachePutAllArgs) {
|
||||
MOZ_ASSERT(mCacheId != INVALID_CACHE_ID);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mCacheId != INVALID_CACHE_ID);
|
||||
|
||||
const CachePutAllArgs& args = mOpArgs.get_CachePutAllArgs();
|
||||
const nsTArray<CacheRequestResponse>& list = args.requestResponseList();
|
||||
@ -99,13 +99,13 @@ CacheOpParent::Execute(cache::Manager* aManager)
|
||||
|
||||
// Handle all other cache ops
|
||||
if (mCacheId != INVALID_CACHE_ID) {
|
||||
MOZ_ASSERT(mNamespace == INVALID_NAMESPACE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mNamespace == INVALID_NAMESPACE);
|
||||
mManager->ExecuteCacheOp(this, mCacheId, mOpArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle all storage ops
|
||||
MOZ_ASSERT(mNamespace != INVALID_NAMESPACE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mNamespace != INVALID_NAMESPACE);
|
||||
mManager->ExecuteStorageOp(this, mNamespace, mOpArgs);
|
||||
}
|
||||
|
||||
@ -113,8 +113,8 @@ void
|
||||
CacheOpParent::WaitForVerification(PrincipalVerifier* aVerifier)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpParent);
|
||||
MOZ_ASSERT(!mManager);
|
||||
MOZ_ASSERT(!mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mVerifier);
|
||||
|
||||
mVerifier = aVerifier;
|
||||
mVerifier->AddListener(this);
|
||||
@ -164,8 +164,8 @@ CacheOpParent::OnOpComplete(ErrorResult&& aRv, const CacheOpResult& aResult,
|
||||
StreamList* aStreamList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheOpParent);
|
||||
MOZ_ASSERT(mIpcManager);
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIpcManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
|
||||
// Never send an op-specific result if we have an error. Instead, send
|
||||
// void_t() to ensure that we don't leak actors on the child side.
|
||||
|
6
dom/cache/CacheParent.cpp
vendored
6
dom/cache/CacheParent.cpp
vendored
@ -25,20 +25,20 @@ CacheParent::CacheParent(cache::Manager* aManager, CacheId aCacheId)
|
||||
, mCacheId(aCacheId)
|
||||
{
|
||||
MOZ_COUNT_CTOR(cache::CacheParent);
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
mManager->AddRefCacheId(mCacheId);
|
||||
}
|
||||
|
||||
CacheParent::~CacheParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(cache::CacheParent);
|
||||
MOZ_ASSERT(!mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManager);
|
||||
}
|
||||
|
||||
void
|
||||
CacheParent::ActorDestroy(ActorDestroyReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
mManager->ReleaseCacheId(mCacheId);
|
||||
mManager = nullptr;
|
||||
}
|
||||
|
32
dom/cache/CacheStorage.cpp
vendored
32
dom/cache/CacheStorage.cpp
vendored
@ -141,8 +141,8 @@ CacheStorage::CreateOnMainThread(Namespace aNamespace, nsIGlobalObject* aGlobal,
|
||||
nsIPrincipal* aPrincipal, bool aStorageDisabled,
|
||||
bool aForceTrustedOrigin, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aPrincipal);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (aStorageDisabled) {
|
||||
@ -178,8 +178,8 @@ already_AddRefed<CacheStorage>
|
||||
CacheStorage::CreateOnWorker(Namespace aNamespace, nsIGlobalObject* aGlobal,
|
||||
WorkerPrivate* aWorkerPrivate, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate);
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (!aWorkerPrivate->IsStorageAllowed()) {
|
||||
@ -238,8 +238,8 @@ bool
|
||||
CacheStorage::DefineCaches(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
|
||||
"Passed object is not a global object!");
|
||||
MOZ_DIAGNOSTIC_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
|
||||
"Passed object is not a global object!");
|
||||
js::AssertSameCompartment(aCx, aGlobal);
|
||||
|
||||
if (NS_WARN_IF(!CacheStorageBinding::GetConstructorObject(aCx) ||
|
||||
@ -248,7 +248,7 @@ CacheStorage::DefineCaches(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(aGlobal);
|
||||
MOZ_ASSERT(principal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(principal);
|
||||
|
||||
ErrorResult rv;
|
||||
RefPtr<CacheStorage> storage =
|
||||
@ -278,7 +278,7 @@ CacheStorage::CacheStorage(Namespace aNamespace, nsIGlobalObject* aGlobal,
|
||||
, mActor(nullptr)
|
||||
, mStatus(NS_OK)
|
||||
{
|
||||
MOZ_ASSERT(mGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mGlobal);
|
||||
|
||||
// If the PBackground actor is already initialized then we can
|
||||
// immediately use it
|
||||
@ -302,7 +302,7 @@ CacheStorage::CacheStorage(nsresult aFailureResult)
|
||||
, mActor(nullptr)
|
||||
, mStatus(aFailureResult)
|
||||
{
|
||||
MOZ_ASSERT(NS_FAILED(mStatus));
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_FAILED(mStatus));
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
@ -501,7 +501,7 @@ void
|
||||
CacheStorage::ActorCreated(PBackgroundChild* aActor)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStorage);
|
||||
MOZ_ASSERT(aActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aActor);
|
||||
|
||||
if (NS_WARN_IF(mWorkerHolder && mWorkerHolder->Notified())) {
|
||||
ActorFailed();
|
||||
@ -522,18 +522,18 @@ CacheStorage::ActorCreated(PBackgroundChild* aActor)
|
||||
|
||||
mWorkerHolder = nullptr;
|
||||
|
||||
MOZ_ASSERT(constructedActor == newActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(constructedActor == newActor);
|
||||
mActor = newActor;
|
||||
|
||||
MaybeRunPendingRequests();
|
||||
MOZ_ASSERT(mPendingRequests.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mPendingRequests.IsEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
CacheStorage::ActorFailed()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStorage);
|
||||
MOZ_ASSERT(!NS_FAILED(mStatus));
|
||||
MOZ_DIAGNOSTIC_ASSERT(!NS_FAILED(mStatus));
|
||||
|
||||
mStatus = NS_ERROR_UNEXPECTED;
|
||||
mWorkerHolder = nullptr;
|
||||
@ -549,8 +549,8 @@ void
|
||||
CacheStorage::DestroyInternal(CacheStorageChild* aActor)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStorage);
|
||||
MOZ_ASSERT(mActor);
|
||||
MOZ_ASSERT(mActor == aActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor == aActor);
|
||||
mActor->ClearListener();
|
||||
mActor = nullptr;
|
||||
|
||||
@ -589,7 +589,7 @@ CacheStorage::~CacheStorage()
|
||||
mActor->StartDestroyFromListener();
|
||||
// DestroyInternal() is called synchronously by StartDestroyFromListener().
|
||||
// So we should have already cleared the mActor.
|
||||
MOZ_ASSERT(!mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mActor);
|
||||
}
|
||||
}
|
||||
|
||||
|
14
dom/cache/CacheStorageChild.cpp
vendored
14
dom/cache/CacheStorageChild.cpp
vendored
@ -29,7 +29,7 @@ CacheStorageChild::CacheStorageChild(CacheStorage* aListener,
|
||||
, mDelayedDestroy(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(cache::CacheStorageChild);
|
||||
MOZ_ASSERT(mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListener);
|
||||
|
||||
SetWorkerHolder(aWorkerHolder);
|
||||
}
|
||||
@ -38,14 +38,14 @@ CacheStorageChild::~CacheStorageChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(cache::CacheStorageChild);
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
}
|
||||
|
||||
void
|
||||
CacheStorageChild::ClearListener()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
||||
MOZ_ASSERT(mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListener);
|
||||
mListener = nullptr;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ CacheStorageChild::StartDestroyFromListener()
|
||||
// The listener should be held alive by any async operations, so if it
|
||||
// is going away then there must not be any child actors. This in turn
|
||||
// ensures that StartDestroy() will not trigger the delayed path.
|
||||
MOZ_ASSERT(!mNumChildActors);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mNumChildActors);
|
||||
|
||||
StartDestroy();
|
||||
}
|
||||
@ -98,7 +98,7 @@ CacheStorageChild::StartDestroy()
|
||||
listener->DestroyInternal(this);
|
||||
|
||||
// CacheStorage listener should call ClearListener() in DestroyInternal()
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
|
||||
// Start actor destruction from parent process
|
||||
Unused << SendTeardown();
|
||||
@ -112,7 +112,7 @@ CacheStorageChild::ActorDestroy(ActorDestroyReason aReason)
|
||||
if (listener) {
|
||||
listener->DestroyInternal(this);
|
||||
// CacheStorage listener should call ClearListener() in DestroyInternal()
|
||||
MOZ_ASSERT(!mListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mListener);
|
||||
}
|
||||
|
||||
RemoveWorkerHolder();
|
||||
@ -136,7 +136,7 @@ CacheStorageChild::DeallocPCacheOpChild(PCacheOpChild* aActor)
|
||||
void
|
||||
CacheStorageChild::NoteDeletedActor()
|
||||
{
|
||||
MOZ_ASSERT(mNumChildActors);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mNumChildActors);
|
||||
mNumChildActors -= 1;
|
||||
if (!mNumChildActors && mDelayedDestroy) {
|
||||
StartDestroy();
|
||||
|
16
dom/cache/CacheStorageParent.cpp
vendored
16
dom/cache/CacheStorageParent.cpp
vendored
@ -43,18 +43,18 @@ CacheStorageParent::CacheStorageParent(PBackgroundParent* aManagingActor,
|
||||
, mVerifiedStatus(NS_OK)
|
||||
{
|
||||
MOZ_COUNT_CTOR(cache::CacheStorageParent);
|
||||
MOZ_ASSERT(aManagingActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aManagingActor);
|
||||
|
||||
// Start the async principal verification process immediately.
|
||||
mVerifier = PrincipalVerifier::CreateAndDispatch(this, aManagingActor,
|
||||
aPrincipalInfo);
|
||||
MOZ_ASSERT(mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mVerifier);
|
||||
}
|
||||
|
||||
CacheStorageParent::~CacheStorageParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(cache::CacheStorageParent);
|
||||
MOZ_ASSERT(!mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mVerifier);
|
||||
}
|
||||
|
||||
void
|
||||
@ -95,7 +95,7 @@ CacheStorageParent::RecvPCacheOpConstructor(PCacheOpParent* aActor,
|
||||
auto actor = static_cast<CacheOpParent*>(aActor);
|
||||
|
||||
if (mVerifier) {
|
||||
MOZ_ASSERT(!mManagerId);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManagerId);
|
||||
actor->WaitForVerification(mVerifier);
|
||||
return IPC_OK();
|
||||
}
|
||||
@ -107,7 +107,7 @@ CacheStorageParent::RecvPCacheOpConstructor(PCacheOpParent* aActor,
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mManagerId);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManagerId);
|
||||
actor->Execute(mManagerId);
|
||||
return IPC_OK();
|
||||
}
|
||||
@ -125,9 +125,9 @@ CacheStorageParent::RecvTeardown()
|
||||
void
|
||||
CacheStorageParent::OnPrincipalVerified(nsresult aRv, ManagerId* aManagerId)
|
||||
{
|
||||
MOZ_ASSERT(mVerifier);
|
||||
MOZ_ASSERT(!mManagerId);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(mVerifiedStatus));
|
||||
MOZ_DIAGNOSTIC_ASSERT(mVerifier);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mManagerId);
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(mVerifiedStatus));
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(aRv))) {
|
||||
mVerifiedStatus = aRv;
|
||||
|
6
dom/cache/CacheStreamControlChild.cpp
vendored
6
dom/cache/CacheStreamControlChild.cpp
vendored
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/cache/CacheStreamControlChild.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/cache/ActorUtils.h"
|
||||
#include "mozilla/dom/cache/CacheTypes.h"
|
||||
@ -89,6 +88,7 @@ void
|
||||
CacheStreamControlChild::SerializeControl(CacheReadStream* aReadStreamOut)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlChild);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
aReadStreamOut->controlParent() = nullptr;
|
||||
aReadStreamOut->controlChild() = this;
|
||||
}
|
||||
@ -99,8 +99,8 @@ CacheStreamControlChild::SerializeStream(CacheReadStream* aReadStreamOut,
|
||||
nsTArray<UniquePtr<AutoIPCStream>>& aStreamCleanupList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlChild);
|
||||
MOZ_ASSERT(aReadStreamOut);
|
||||
MOZ_ASSERT(aStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStream);
|
||||
UniquePtr<AutoIPCStream> autoStream(new AutoIPCStream(aReadStreamOut->stream()));
|
||||
autoStream->Serialize(aStream, Manager());
|
||||
aStreamCleanupList.AppendElement(Move(autoStream));
|
||||
|
11
dom/cache/CacheStreamControlParent.cpp
vendored
11
dom/cache/CacheStreamControlParent.cpp
vendored
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/cache/CacheStreamControlParent.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/cache/CacheTypes.h"
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
@ -40,7 +39,7 @@ CacheStreamControlParent::CacheStreamControlParent()
|
||||
CacheStreamControlParent::~CacheStreamControlParent()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
|
||||
MOZ_ASSERT(!mStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStreamList);
|
||||
MOZ_COUNT_DTOR(cache::CacheStreamControlParent);
|
||||
}
|
||||
|
||||
@ -48,6 +47,7 @@ void
|
||||
CacheStreamControlParent::SerializeControl(CacheReadStream* aReadStreamOut)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
aReadStreamOut->controlChild() = nullptr;
|
||||
aReadStreamOut->controlParent() = this;
|
||||
}
|
||||
@ -58,7 +58,8 @@ CacheStreamControlParent::SerializeStream(CacheReadStream* aReadStreamOut,
|
||||
nsTArray<UniquePtr<AutoIPCStream>>& aStreamCleanupList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
|
||||
MOZ_ASSERT(aStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStream);
|
||||
UniquePtr<AutoIPCStream> autoStream(new AutoIPCStream(aReadStreamOut->stream()));
|
||||
autoStream->Serialize(aStream, Manager());
|
||||
aStreamCleanupList.AppendElement(Move(autoStream));
|
||||
@ -93,7 +94,7 @@ mozilla::ipc::IPCResult
|
||||
CacheStreamControlParent::RecvNoteClosed(const nsID& aId)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
|
||||
MOZ_ASSERT(mStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mStreamList);
|
||||
mStreamList->NoteClosed(aId);
|
||||
return IPC_OK();
|
||||
}
|
||||
@ -102,7 +103,7 @@ void
|
||||
CacheStreamControlParent::SetStreamList(StreamList* aStreamList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
|
||||
MOZ_ASSERT(!mStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStreamList);
|
||||
mStreamList = aStreamList;
|
||||
}
|
||||
|
||||
|
16
dom/cache/CacheWorkerHolder.cpp
vendored
16
dom/cache/CacheWorkerHolder.cpp
vendored
@ -21,7 +21,7 @@ using mozilla::dom::workers::WorkerPrivate;
|
||||
already_AddRefed<CacheWorkerHolder>
|
||||
CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate)
|
||||
{
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate);
|
||||
|
||||
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder();
|
||||
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate, Terminating))) {
|
||||
@ -35,7 +35,7 @@ void
|
||||
CacheWorkerHolder::AddActor(ActorChild* aActor)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheWorkerHolder);
|
||||
MOZ_ASSERT(aActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aActor);
|
||||
MOZ_ASSERT(!mActorList.Contains(aActor));
|
||||
|
||||
mActorList.AppendElement(aActor);
|
||||
@ -53,11 +53,14 @@ void
|
||||
CacheWorkerHolder::RemoveActor(ActorChild* aActor)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheWorkerHolder);
|
||||
MOZ_ASSERT(aActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aActor);
|
||||
|
||||
DebugOnly<bool> removed = mActorList.RemoveElement(aActor);
|
||||
#if defined(RELEASE_OR_BETA)
|
||||
mActorList.RemoveElement(aActor);
|
||||
#else
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActorList.RemoveElement(aActor));
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(removed);
|
||||
MOZ_ASSERT(!mActorList.Contains(aActor));
|
||||
}
|
||||
|
||||
@ -83,6 +86,7 @@ CacheWorkerHolder::Notify(Status aStatus)
|
||||
// Start the asynchronous destruction of our actors. These will call back
|
||||
// into RemoveActor() once the actor is destroyed.
|
||||
for (uint32_t i = 0; i < mActorList.Length(); ++i) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActorList[i]);
|
||||
mActorList[i]->StartDestroy();
|
||||
}
|
||||
|
||||
@ -97,7 +101,7 @@ CacheWorkerHolder::CacheWorkerHolder()
|
||||
CacheWorkerHolder::~CacheWorkerHolder()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(CacheWorkerHolder);
|
||||
MOZ_ASSERT(mActorList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActorList.IsEmpty());
|
||||
}
|
||||
|
||||
} // namespace cache
|
||||
|
2
dom/cache/Connection.cpp
vendored
2
dom/cache/Connection.cpp
vendored
@ -22,7 +22,7 @@ Connection::Connection(mozIStorageConnection* aBase)
|
||||
: mBase(aBase)
|
||||
, mClosed(false)
|
||||
{
|
||||
MOZ_ASSERT(mBase);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBase);
|
||||
}
|
||||
|
||||
Connection::~Connection()
|
||||
|
134
dom/cache/Context.cpp
vendored
134
dom/cache/Context.cpp
vendored
@ -7,7 +7,6 @@
|
||||
#include "mozilla/dom/cache/Context.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/dom/cache/Action.h"
|
||||
#include "mozilla/dom/cache/FileUtils.h"
|
||||
#include "mozilla/dom/cache/Manager.h"
|
||||
@ -35,7 +34,7 @@ public:
|
||||
RunOnTarget(Resolver* aResolver, const QuotaInfo&, Data*) override
|
||||
{
|
||||
// Resolve success immediately. This Action does no actual work.
|
||||
MOZ_ASSERT(aResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResolver);
|
||||
aResolver->Resolve(NS_OK);
|
||||
}
|
||||
};
|
||||
@ -46,7 +45,6 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::dom::quota::AssertIsOnIOThread;
|
||||
using mozilla::dom::quota::OpenDirectoryListener;
|
||||
using mozilla::dom::quota::QuotaManager;
|
||||
@ -59,7 +57,7 @@ public:
|
||||
explicit Data(nsIThread* aTarget)
|
||||
: mTarget(aTarget)
|
||||
{
|
||||
MOZ_ASSERT(mTarget);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTarget);
|
||||
}
|
||||
|
||||
virtual mozIStorageConnection*
|
||||
@ -73,9 +71,9 @@ public:
|
||||
SetConnection(mozIStorageConnection* aConn) override
|
||||
{
|
||||
MOZ_ASSERT(mTarget == NS_GetCurrentThread());
|
||||
MOZ_ASSERT(!mConnection);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mConnection);
|
||||
mConnection = aConn;
|
||||
MOZ_ASSERT(mConnection);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mConnection);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -119,18 +117,18 @@ public:
|
||||
, mState(STATE_INIT)
|
||||
, mCanceled(false)
|
||||
{
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_ASSERT(mData);
|
||||
MOZ_ASSERT(mTarget);
|
||||
MOZ_ASSERT(mInitiatingThread);
|
||||
MOZ_ASSERT(mInitAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mData);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTarget);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInitiatingThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInitAction);
|
||||
}
|
||||
|
||||
nsresult Dispatch()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(mState == STATE_INIT);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_INIT);
|
||||
|
||||
mState = STATE_GET_INFO;
|
||||
nsresult rv = NS_DispatchToMainThread(this, nsIThread::DISPATCH_NORMAL);
|
||||
@ -144,7 +142,7 @@ public:
|
||||
void Cancel()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(!mCanceled);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mCanceled);
|
||||
mCanceled = true;
|
||||
mInitAction->CancelOnInitiatingThread();
|
||||
}
|
||||
@ -170,7 +168,7 @@ private:
|
||||
virtual void
|
||||
Resolve(nsresult aRv) override
|
||||
{
|
||||
MOZ_ASSERT(!mResolved);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mResolved);
|
||||
mResolved = true;
|
||||
mResult = aRv;
|
||||
};
|
||||
@ -189,9 +187,9 @@ private:
|
||||
|
||||
~QuotaInitRunnable()
|
||||
{
|
||||
MOZ_ASSERT(mState == STATE_COMPLETE);
|
||||
MOZ_ASSERT(!mContext);
|
||||
MOZ_ASSERT(!mInitAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_COMPLETE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInitAction);
|
||||
}
|
||||
|
||||
enum State
|
||||
@ -210,9 +208,9 @@ private:
|
||||
|
||||
void Complete(nsresult aResult)
|
||||
{
|
||||
MOZ_ASSERT(mState == STATE_RUNNING || NS_FAILED(aResult));
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_RUNNING || NS_FAILED(aResult));
|
||||
|
||||
MOZ_ASSERT(NS_SUCCEEDED(mResult));
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(mResult));
|
||||
mResult = aResult;
|
||||
|
||||
mState = STATE_COMPLETING;
|
||||
@ -223,7 +221,7 @@ private:
|
||||
void Clear()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
mContext = nullptr;
|
||||
mManager = nullptr;
|
||||
mInitAction = nullptr;
|
||||
@ -251,9 +249,9 @@ void
|
||||
Context::QuotaInitRunnable::OpenDirectory()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(mState == STATE_CREATE_QUOTA_MANAGER ||
|
||||
mState == STATE_OPEN_DIRECTORY);
|
||||
MOZ_ASSERT(QuotaManager::Get());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_CREATE_QUOTA_MANAGER ||
|
||||
mState == STATE_OPEN_DIRECTORY);
|
||||
MOZ_DIAGNOSTIC_ASSERT(QuotaManager::Get());
|
||||
|
||||
// QuotaManager::OpenDirectory() will hold a reference to us as
|
||||
// a listener. We will then get DirectoryLockAcquired() on the owning
|
||||
@ -272,8 +270,8 @@ void
|
||||
Context::QuotaInitRunnable::DirectoryLockAcquired(DirectoryLock* aLock)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(mState == STATE_WAIT_FOR_DIRECTORY_LOCK);
|
||||
MOZ_ASSERT(!mDirectoryLock);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_WAIT_FOR_DIRECTORY_LOCK);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDirectoryLock);
|
||||
|
||||
mDirectoryLock = aLock;
|
||||
|
||||
@ -283,7 +281,7 @@ Context::QuotaInitRunnable::DirectoryLockAcquired(DirectoryLock* aLock)
|
||||
}
|
||||
|
||||
QuotaManager* qm = QuotaManager::Get();
|
||||
MOZ_ASSERT(qm);
|
||||
MOZ_DIAGNOSTIC_ASSERT(qm);
|
||||
|
||||
mState = STATE_ENSURE_ORIGIN_INITIALIZED;
|
||||
nsresult rv = qm->IOThread()->Dispatch(this, nsIThread::DISPATCH_NORMAL);
|
||||
@ -297,8 +295,8 @@ void
|
||||
Context::QuotaInitRunnable::DirectoryLockFailed()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(QuotaInitRunnable);
|
||||
MOZ_ASSERT(mState == STATE_WAIT_FOR_DIRECTORY_LOCK);
|
||||
MOZ_ASSERT(!mDirectoryLock);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_WAIT_FOR_DIRECTORY_LOCK);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDirectoryLock);
|
||||
|
||||
NS_WARNING("Failed to acquire a directory lock!");
|
||||
|
||||
@ -434,7 +432,7 @@ Context::QuotaInitRunnable::Run()
|
||||
}
|
||||
|
||||
QuotaManager* qm = QuotaManager::Get();
|
||||
MOZ_ASSERT(qm);
|
||||
MOZ_DIAGNOSTIC_ASSERT(qm);
|
||||
nsresult rv = qm->EnsureOriginIsInitialized(PERSISTENCE_TYPE_DEFAULT,
|
||||
mQuotaInfo.mSuffix,
|
||||
mQuotaInfo.mGroup,
|
||||
@ -462,7 +460,7 @@ Context::QuotaInitRunnable::Run()
|
||||
// Execute the provided initialization Action. The Action must Resolve()
|
||||
// before returning.
|
||||
mInitAction->RunOnTarget(resolver, mQuotaInfo, mData);
|
||||
MOZ_ASSERT(resolver->Resolved());
|
||||
MOZ_DIAGNOSTIC_ASSERT(resolver->Resolved());
|
||||
|
||||
mData = nullptr;
|
||||
|
||||
@ -523,18 +521,18 @@ public:
|
||||
, mResult(NS_OK)
|
||||
, mExecutingRunOnTarget(false)
|
||||
{
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
// mData may be nullptr
|
||||
MOZ_ASSERT(mTarget);
|
||||
MOZ_ASSERT(mAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTarget);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mAction);
|
||||
// mQuotaInfo.mDir may be nullptr if QuotaInitRunnable failed
|
||||
MOZ_ASSERT(mInitiatingThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInitiatingThread);
|
||||
}
|
||||
|
||||
nsresult Dispatch()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(ActionRunnable);
|
||||
MOZ_ASSERT(mState == STATE_INIT);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_INIT);
|
||||
|
||||
mState = STATE_RUN_ON_TARGET;
|
||||
nsresult rv = mTarget->Dispatch(this, nsIEventTarget::DISPATCH_NORMAL);
|
||||
@ -562,7 +560,7 @@ public:
|
||||
virtual void Resolve(nsresult aRv) override
|
||||
{
|
||||
MOZ_ASSERT(mTarget == NS_GetCurrentThread());
|
||||
MOZ_ASSERT(mState == STATE_RUNNING);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_RUNNING);
|
||||
|
||||
mResult = aRv;
|
||||
|
||||
@ -588,16 +586,16 @@ public:
|
||||
private:
|
||||
~ActionRunnable()
|
||||
{
|
||||
MOZ_ASSERT(mState == STATE_COMPLETE);
|
||||
MOZ_ASSERT(!mContext);
|
||||
MOZ_ASSERT(!mAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_COMPLETE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mAction);
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(ActionRunnable);
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_ASSERT(mAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mAction);
|
||||
mContext->RemoveActivity(this);
|
||||
mContext = nullptr;
|
||||
mAction = nullptr;
|
||||
@ -673,7 +671,7 @@ Context::ActionRunnable::Run()
|
||||
case STATE_RUN_ON_TARGET:
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mTarget);
|
||||
MOZ_ASSERT(!mExecutingRunOnTarget);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mExecutingRunOnTarget);
|
||||
|
||||
// Note that we are calling RunOnTarget(). This lets us detect
|
||||
// if Resolve() is called synchronously.
|
||||
@ -820,16 +818,16 @@ Context::ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread()
|
||||
}
|
||||
// We should synchronously have AllowToCloseOnOwningThread called when
|
||||
// the Context is canceled.
|
||||
MOZ_ASSERT(!mStrongRef);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStrongRef);
|
||||
}
|
||||
|
||||
void
|
||||
Context::ThreadsafeHandle::ContextDestroyed(Context* aContext)
|
||||
{
|
||||
MOZ_ASSERT(mOwningThread == NS_GetCurrentThread());
|
||||
MOZ_ASSERT(!mStrongRef);
|
||||
MOZ_ASSERT(mWeakRef);
|
||||
MOZ_ASSERT(mWeakRef == aContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStrongRef);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mWeakRef);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mWeakRef == aContext);
|
||||
mWeakRef = nullptr;
|
||||
}
|
||||
|
||||
@ -851,17 +849,17 @@ Context::Context(Manager* aManager, nsIThread* aTarget, Action* aInitAction)
|
||||
, mOrphanedData(false)
|
||||
, mInitAction(aInitAction)
|
||||
{
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_ASSERT(mTarget);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTarget);
|
||||
}
|
||||
|
||||
void
|
||||
Context::Dispatch(Action* aAction)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(aAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aAction);
|
||||
|
||||
MOZ_ASSERT(mState != STATE_CONTEXT_CANCELED);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState != STATE_CONTEXT_CANCELED);
|
||||
if (mState == STATE_CONTEXT_CANCELED) {
|
||||
return;
|
||||
} else if (mState == STATE_CONTEXT_INIT ||
|
||||
@ -871,7 +869,7 @@ Context::Dispatch(Action* aAction)
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == STATE_CONTEXT_READY);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_CONTEXT_READY);
|
||||
DispatchAction(aAction);
|
||||
}
|
||||
|
||||
@ -883,7 +881,7 @@ Context::CancelAll()
|
||||
// In PREINIT state we have not dispatch the init action yet. Just
|
||||
// forget it.
|
||||
if (mState == STATE_CONTEXT_PREINIT) {
|
||||
MOZ_ASSERT(!mInitRunnable);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInitRunnable);
|
||||
mInitAction = nullptr;
|
||||
|
||||
// In INIT state we have dispatched the runnable, but not received the
|
||||
@ -953,8 +951,8 @@ Context::CancelForCacheId(CacheId aCacheId)
|
||||
Context::~Context()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_ASSERT(!mData);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mData);
|
||||
|
||||
if (mThreadsafeHandle) {
|
||||
mThreadsafeHandle->ContextDestroyed(this);
|
||||
@ -993,13 +991,13 @@ Context::Start()
|
||||
// Previous context closing delayed our start, but then we were canceled.
|
||||
// In this case, just do nothing here.
|
||||
if (mState == STATE_CONTEXT_CANCELED) {
|
||||
MOZ_ASSERT(!mInitRunnable);
|
||||
MOZ_ASSERT(!mInitAction);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInitRunnable);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInitAction);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == STATE_CONTEXT_PREINIT);
|
||||
MOZ_ASSERT(!mInitRunnable);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_CONTEXT_PREINIT);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInitRunnable);
|
||||
|
||||
mInitRunnable = new QuotaInitRunnable(this, mManager, mData, mTarget,
|
||||
mInitAction);
|
||||
@ -1043,14 +1041,14 @@ Context::OnQuotaInit(nsresult aRv, const QuotaInfo& aQuotaInfo,
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
|
||||
MOZ_ASSERT(mInitRunnable);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInitRunnable);
|
||||
mInitRunnable = nullptr;
|
||||
|
||||
mQuotaInfo = aQuotaInfo;
|
||||
|
||||
// Always save the directory lock to ensure QuotaManager does not shutdown
|
||||
// before the Context has gone away.
|
||||
MOZ_ASSERT(!mDirectoryLock);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDirectoryLock);
|
||||
mDirectoryLock = aDirectoryLock;
|
||||
|
||||
// If we opening the context failed, but we were not explicitly canceled,
|
||||
@ -1071,7 +1069,7 @@ Context::OnQuotaInit(nsresult aRv, const QuotaInfo& aQuotaInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == STATE_CONTEXT_INIT);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == STATE_CONTEXT_INIT);
|
||||
mState = STATE_CONTEXT_READY;
|
||||
|
||||
for (uint32_t i = 0; i < mPendingActions.Length(); ++i) {
|
||||
@ -1084,7 +1082,7 @@ void
|
||||
Context::AddActivity(Activity* aActivity)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(aActivity);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aActivity);
|
||||
MOZ_ASSERT(!mActivityList.Contains(aActivity));
|
||||
mActivityList.AppendElement(aActivity);
|
||||
}
|
||||
@ -1093,7 +1091,7 @@ void
|
||||
Context::RemoveActivity(Activity* aActivity)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(aActivity);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aActivity);
|
||||
MOZ_ALWAYS_TRUE(mActivityList.RemoveElement(aActivity));
|
||||
MOZ_ASSERT(!mActivityList.Contains(aActivity));
|
||||
}
|
||||
@ -1121,8 +1119,8 @@ void
|
||||
Context::SetNextContext(Context* aNextContext)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(aNextContext);
|
||||
MOZ_ASSERT(!mNextContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aNextContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mNextContext);
|
||||
mNextContext = aNextContext;
|
||||
}
|
||||
|
||||
@ -1130,7 +1128,7 @@ void
|
||||
Context::DoomTargetData()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Context);
|
||||
MOZ_ASSERT(mData);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mData);
|
||||
|
||||
// We are about to drop our reference to the Data. We need to ensure that
|
||||
// the ~Context() destructor does not run until contents of Data have been
|
||||
@ -1143,7 +1141,7 @@ Context::DoomTargetData()
|
||||
RefPtr<Action> action = new NullAction();
|
||||
DispatchAction(action, true /* doomed data */);
|
||||
|
||||
MOZ_ASSERT(!mData);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mData);
|
||||
}
|
||||
|
||||
} // namespace cache
|
||||
|
16
dom/cache/DBAction.cpp
vendored
16
dom/cache/DBAction.cpp
vendored
@ -40,8 +40,8 @@ DBAction::RunOnTarget(Resolver* aResolver, const QuotaInfo& aQuotaInfo,
|
||||
Data* aOptionalData)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aResolver);
|
||||
MOZ_ASSERT(aQuotaInfo.mDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aQuotaInfo.mDir);
|
||||
|
||||
if (IsCanceled()) {
|
||||
aResolver->Resolve(NS_ERROR_ABORT);
|
||||
@ -75,7 +75,7 @@ DBAction::RunOnTarget(Resolver* aResolver, const QuotaInfo& aQuotaInfo,
|
||||
aResolver->Resolve(rv);
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(conn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(conn);
|
||||
|
||||
// Save this connection in the shared Data object so later Actions can
|
||||
// use it. This avoids opening a new connection for every Action.
|
||||
@ -97,8 +97,8 @@ DBAction::OpenConnection(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection** aConnOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aDBDir);
|
||||
MOZ_ASSERT(aConnOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aDBDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConnOut);
|
||||
|
||||
nsCOMPtr<mozIStorageConnection> conn;
|
||||
|
||||
@ -218,9 +218,9 @@ SyncDBAction::RunWithDBOnTarget(Resolver* aResolver,
|
||||
mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aResolver);
|
||||
MOZ_ASSERT(aDBDir);
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aDBDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsresult rv = RunSyncWithDBOnTarget(aQuotaInfo, aDBDir, aConn);
|
||||
aResolver->Resolve(rv);
|
||||
|
146
dom/cache/DBSchema.cpp
vendored
146
dom/cache/DBSchema.cpp
vendored
@ -406,7 +406,7 @@ nsresult
|
||||
CreateOrMigrateSchema(mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
int32_t schemaVersion;
|
||||
nsresult rv = aConn->GetSchemaVersion(&schemaVersion);
|
||||
@ -496,7 +496,7 @@ nsresult
|
||||
InitializeConnection(mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// This function needs to perform per-connection initialization tasks that
|
||||
// need to happen regardless of the schema.
|
||||
@ -571,8 +571,8 @@ nsresult
|
||||
CreateCacheId(mozIStorageConnection* aConn, CacheId* aCacheIdOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aCacheIdOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCacheIdOut);
|
||||
|
||||
nsresult rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"INSERT INTO caches DEFAULT VALUES;"
|
||||
@ -601,7 +601,7 @@ DeleteCacheId(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// Delete the bodies explicitly as we need to read out the body IDs
|
||||
// anyway. These body IDs must be deleted one-by-one as content may
|
||||
@ -639,8 +639,8 @@ IsCacheOrphaned(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
bool* aOrphanedOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aOrphanedOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aOrphanedOut);
|
||||
|
||||
// err on the side of not deleting user data
|
||||
*aOrphanedOut = false;
|
||||
@ -657,7 +657,7 @@ IsCacheOrphaned(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
bool hasMoreData = false;
|
||||
rv = state->ExecuteStep(&hasMoreData);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(hasMoreData);
|
||||
MOZ_DIAGNOSTIC_ASSERT(hasMoreData);
|
||||
|
||||
int32_t refCount;
|
||||
rv = state->GetInt32(0, &refCount);
|
||||
@ -694,7 +694,7 @@ nsresult
|
||||
GetKnownBodyIds(mozIStorageConnection* aConn, nsTArray<nsID>& aBodyIdListOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -732,9 +732,9 @@ CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
SavedResponse* aSavedResponseOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aFoundResponseOut);
|
||||
MOZ_ASSERT(aSavedResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFoundResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSavedResponseOut);
|
||||
|
||||
*aFoundResponseOut = false;
|
||||
|
||||
@ -762,7 +762,7 @@ CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<SavedResponse>& aSavedResponsesOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
nsresult rv;
|
||||
|
||||
AutoTArray<EntryId, 256> matches;
|
||||
@ -795,7 +795,7 @@ CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
CacheQueryParams params(false, false, false, false,
|
||||
NS_LITERAL_STRING(""));
|
||||
@ -827,8 +827,8 @@ CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut, bool* aSuccessOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aSuccessOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSuccessOut);
|
||||
|
||||
*aSuccessOut = false;
|
||||
|
||||
@ -860,7 +860,7 @@ CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<SavedRequest>& aSavedRequestsOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
nsresult rv;
|
||||
|
||||
AutoTArray<EntryId, 256> matches;
|
||||
@ -893,9 +893,9 @@ StorageMatch(mozIStorageConnection* aConn,
|
||||
SavedResponse* aSavedResponseOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aFoundResponseOut);
|
||||
MOZ_ASSERT(aSavedResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFoundResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSavedResponseOut);
|
||||
|
||||
*aFoundResponseOut = false;
|
||||
|
||||
@ -961,9 +961,9 @@ StorageGetCacheId(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
CacheId* aCacheIdOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aFoundCacheOut);
|
||||
MOZ_ASSERT(aCacheIdOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFoundCacheOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCacheIdOut);
|
||||
|
||||
*aFoundCacheOut = false;
|
||||
|
||||
@ -1002,7 +1002,7 @@ StoragePutCache(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
const nsAString& aKey, CacheId aCacheId)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1031,7 +1031,7 @@ StorageForgetCache(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
const nsAString& aKey)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// How we constrain the key column depends on the value of our key. Use
|
||||
// a format string for the query and let CreateAndBindKeyStatement() fill
|
||||
@ -1057,7 +1057,7 @@ StorageGetKeys(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
nsTArray<nsString>& aKeysOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1087,7 +1087,7 @@ QueryAll(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
nsTArray<EntryId>& aEntryIdListOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1117,8 +1117,8 @@ QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
uint32_t aMaxResults)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aMaxResults > 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aMaxResults > 0);
|
||||
|
||||
if (!aParams.ignoreMethod() &&
|
||||
!aRequest.method().LowerCaseEqualsLiteral("get"))
|
||||
@ -1222,7 +1222,7 @@ MatchByVaryHeader(mozIStorageConnection* aConn,
|
||||
EntryId entryId, bool* aSuccessOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
*aSuccessOut = false;
|
||||
|
||||
@ -1248,7 +1248,7 @@ MatchByVaryHeader(mozIStorageConnection* aConn,
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Should not have called this function if this was not the case
|
||||
MOZ_ASSERT(!varyValues.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!varyValues.IsEmpty());
|
||||
|
||||
state->Reset();
|
||||
rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -1293,23 +1293,23 @@ MatchByVaryHeader(mozIStorageConnection* aConn,
|
||||
for (; token;
|
||||
token = nsCRT::strtok(rawBuffer, NS_HTTP_HEADER_SEPS, &rawBuffer)) {
|
||||
nsDependentCString header(token);
|
||||
MOZ_ASSERT(!header.EqualsLiteral("*"),
|
||||
"We should have already caught this in "
|
||||
"TypeUtils::ToPCacheResponseWithoutBody()");
|
||||
MOZ_DIAGNOSTIC_ASSERT(!header.EqualsLiteral("*"),
|
||||
"We should have already caught this in "
|
||||
"TypeUtils::ToPCacheResponseWithoutBody()");
|
||||
|
||||
ErrorResult errorResult;
|
||||
nsAutoCString queryValue;
|
||||
queryHeaders->Get(header, queryValue, errorResult);
|
||||
if (errorResult.Failed()) {
|
||||
errorResult.SuppressException();
|
||||
MOZ_ASSERT(queryValue.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(queryValue.IsEmpty());
|
||||
}
|
||||
|
||||
nsAutoCString cachedValue;
|
||||
cachedHeaders->Get(header, cachedValue, errorResult);
|
||||
if (errorResult.Failed()) {
|
||||
errorResult.SuppressException();
|
||||
MOZ_ASSERT(cachedValue.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(cachedValue.IsEmpty());
|
||||
}
|
||||
|
||||
if (queryValue != cachedValue) {
|
||||
@ -1336,13 +1336,13 @@ DeleteEntries(mozIStorageConnection* aConn,
|
||||
uint32_t aPos, int32_t aLen)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
if (aEntryIdList.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aPos < aEntryIdList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aPos < aEntryIdList.Length());
|
||||
|
||||
if (aLen < 0) {
|
||||
aLen = aEntryIdList.Length() - aPos;
|
||||
@ -1449,10 +1449,10 @@ nsresult
|
||||
InsertSecurityInfo(mozIStorageConnection* aConn, nsICryptoHash* aCrypto,
|
||||
const nsACString& aData, int32_t *aIdOut)
|
||||
{
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aCrypto);
|
||||
MOZ_ASSERT(aIdOut);
|
||||
MOZ_ASSERT(!aData.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCrypto);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aIdOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!aData.IsEmpty());
|
||||
|
||||
// We want to use an index to find existing security blobs, but indexing
|
||||
// the full blob would be quite expensive. Instead, we index a small
|
||||
@ -1566,7 +1566,7 @@ DeleteSecurityInfo(mozIStorageConnection* aConn, int32_t aId, int32_t aCount)
|
||||
rv = state->GetInt32(0, &refcount);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
MOZ_ASSERT(refcount >= aCount);
|
||||
MOZ_DIAGNOSTIC_ASSERT(refcount >= aCount);
|
||||
|
||||
// Next, calculate the new refcount
|
||||
int32_t newCount = refcount - aCount;
|
||||
@ -1628,7 +1628,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
const nsID* aResponseBodyId)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -1797,7 +1797,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
if (aResponse.principalInfo().type() == mozilla::ipc::OptionalPrincipalInfo::TPrincipalInfo) {
|
||||
const mozilla::ipc::PrincipalInfo& principalInfo =
|
||||
aResponse.principalInfo().get_PrincipalInfo();
|
||||
MOZ_ASSERT(principalInfo.type() == mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
MOZ_DIAGNOSTIC_ASSERT(principalInfo.type() == mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo =
|
||||
principalInfo.get_ContentPrincipalInfo();
|
||||
|
||||
@ -1912,8 +1912,8 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
SavedResponse* aSavedResponseOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aSavedResponseOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSavedResponseOut);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
@ -2040,8 +2040,8 @@ ReadRequest(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
SavedRequest* aSavedRequestOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aSavedRequestOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSavedRequestOut);
|
||||
nsCOMPtr<mozIStorageStatement> state;
|
||||
nsresult rv = aConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT "
|
||||
@ -2159,7 +2159,7 @@ AppendListParamsToQuery(nsACString& aQuery,
|
||||
uint32_t aPos, int32_t aLen)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT((aPos + aLen) <= aEntryIdList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT((aPos + aLen) <= aEntryIdList.Length());
|
||||
for (int32_t i = aPos; i < aLen; ++i) {
|
||||
if (i == 0) {
|
||||
aQuery.AppendLiteral("?");
|
||||
@ -2175,7 +2175,7 @@ BindListParamsToQuery(mozIStorageStatement* aState,
|
||||
uint32_t aPos, int32_t aLen)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT((aPos + aLen) <= aEntryIdList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT((aPos + aLen) <= aEntryIdList.Length());
|
||||
for (int32_t i = aPos; i < aLen; ++i) {
|
||||
nsresult rv = aState->BindInt32ByIndex(i, aEntryIdList[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -2187,7 +2187,7 @@ nsresult
|
||||
BindId(mozIStorageStatement* aState, const nsACString& aName, const nsID* aId)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aState);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aState);
|
||||
nsresult rv;
|
||||
|
||||
if (!aId) {
|
||||
@ -2208,8 +2208,8 @@ nsresult
|
||||
ExtractId(mozIStorageStatement* aState, uint32_t aPos, nsID* aIdOut)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aState);
|
||||
MOZ_ASSERT(aIdOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aState);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aIdOut);
|
||||
|
||||
nsAutoCString idString;
|
||||
nsresult rv = aState->GetUTF8String(aPos, idString);
|
||||
@ -2227,9 +2227,9 @@ CreateAndBindKeyStatement(mozIStorageConnection* aConn,
|
||||
const nsAString& aKey,
|
||||
mozIStorageStatement** aStateOut)
|
||||
{
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(aQueryFormat);
|
||||
MOZ_ASSERT(aStateOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aQueryFormat);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStateOut);
|
||||
|
||||
// The key is stored as a blob to avoid encoding issues. An empty string
|
||||
// is mapped to NULL for blobs. Normally we would just write the query
|
||||
@ -2263,7 +2263,7 @@ CreateAndBindKeyStatement(mozIStorageConnection* aConn,
|
||||
nsresult
|
||||
HashCString(nsICryptoHash* aCrypto, const nsACString& aIn, nsACString& aOut)
|
||||
{
|
||||
MOZ_ASSERT(aCrypto);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCrypto);
|
||||
|
||||
nsresult rv = aCrypto->Init(nsICryptoHash::SHA1);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
@ -2527,7 +2527,7 @@ nsresult
|
||||
Migrate(mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
int32_t currentVersion = 0;
|
||||
nsresult rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
@ -2539,7 +2539,7 @@ Migrate(mozIStorageConnection* aConn)
|
||||
// Wiping old databases is handled in DBAction because it requires
|
||||
// making a whole new mozIStorageConnection. Make sure we don't
|
||||
// accidentally get here for one of those old databases.
|
||||
MOZ_ASSERT(currentVersion >= kFirstShippedSchemaVersion);
|
||||
MOZ_DIAGNOSTIC_ASSERT(currentVersion >= kFirstShippedSchemaVersion);
|
||||
|
||||
for (uint32_t i = 0; i < sMigrationListLength; ++i) {
|
||||
if (sMigrationList[i].mFromVersion == currentVersion) {
|
||||
@ -2553,13 +2553,15 @@ Migrate(mozIStorageConnection* aConn)
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<int32_t> lastVersion = currentVersion;
|
||||
#if !defined(RELEASE_OR_BETA)
|
||||
int32_t lastVersion = currentVersion;
|
||||
#endif
|
||||
rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(currentVersion > lastVersion);
|
||||
MOZ_DIAGNOSTIC_ASSERT(currentVersion > lastVersion);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(currentVersion == kLatestSchemaVersion);
|
||||
MOZ_DIAGNOSTIC_ASSERT(currentVersion == kLatestSchemaVersion);
|
||||
|
||||
if (rewriteSchema) {
|
||||
// Now overwrite the master SQL for the entries table to remove the column
|
||||
@ -2574,7 +2576,7 @@ Migrate(mozIStorageConnection* aConn)
|
||||
nsresult MigrateFrom15To16(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// Add the request_redirect column with a default value of "follow". Note,
|
||||
// we only use a default value here because its required by ALTER TABLE and
|
||||
@ -2599,7 +2601,7 @@ nsresult
|
||||
MigrateFrom16To17(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// This migration path removes the response_redirected and
|
||||
// response_redirected_url columns from the entries table. sqlite doesn't
|
||||
@ -2731,7 +2733,7 @@ nsresult
|
||||
MigrateFrom17To18(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// This migration is needed in order to remove "only-if-cached" RequestCache
|
||||
// values from the database. This enum value was removed from the spec in
|
||||
@ -2758,7 +2760,7 @@ nsresult
|
||||
MigrateFrom18To19(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// This migration is needed in order to update the RequestMode values for
|
||||
// Request objects corresponding to a navigation content policy type to
|
||||
@ -2786,7 +2788,7 @@ MigrateFrom18To19(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
nsresult MigrateFrom19To20(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// Add the request_referrer_policy column with a default value of
|
||||
// "no-referrer-when-downgrade". Note, we only use a default value here
|
||||
@ -2810,7 +2812,7 @@ nsresult MigrateFrom19To20(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
nsresult MigrateFrom20To21(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// This migration creates response_url_list table to store response_url and
|
||||
// removes the response_url column from the entries table.
|
||||
@ -2964,7 +2966,7 @@ nsresult MigrateFrom20To21(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
nsresult MigrateFrom21To22(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// Add the request_integrity column.
|
||||
nsresult rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
@ -2984,7 +2986,7 @@ nsresult MigrateFrom21To22(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
nsresult MigrateFrom22To23(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// The only change between 22 and 23 was a different snappy compression
|
||||
// format, but it's backwards-compatible.
|
||||
@ -2995,7 +2997,7 @@ nsresult MigrateFrom22To23(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
nsresult MigrateFrom23To24(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
|
||||
// Add the request_url_fragment column.
|
||||
nsresult rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
|
42
dom/cache/FileUtils.cpp
vendored
42
dom/cache/FileUtils.cpp
vendored
@ -43,7 +43,7 @@ BodyIdToFile(nsIFile* aBaseDir, const nsID& aId, BodyFileType aType,
|
||||
nsresult
|
||||
BodyCreateDir(nsIFile* aBaseDir)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
|
||||
nsCOMPtr<nsIFile> aBodyDir;
|
||||
nsresult rv = aBaseDir->Clone(getter_AddRefs(aBodyDir));
|
||||
@ -65,7 +65,7 @@ BodyCreateDir(nsIFile* aBaseDir)
|
||||
nsresult
|
||||
BodyDeleteDir(nsIFile* aBaseDir)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
|
||||
nsCOMPtr<nsIFile> aBodyDir;
|
||||
nsresult rv = aBaseDir->Clone(getter_AddRefs(aBodyDir));
|
||||
@ -88,14 +88,14 @@ BodyDeleteDir(nsIFile* aBaseDir)
|
||||
nsresult
|
||||
BodyGetCacheDir(nsIFile* aBaseDir, const nsID& aId, nsIFile** aCacheDirOut)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_ASSERT(aCacheDirOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCacheDirOut);
|
||||
|
||||
*aCacheDirOut = nullptr;
|
||||
|
||||
nsresult rv = aBaseDir->Clone(aCacheDirOut);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(*aCacheDirOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(*aCacheDirOut);
|
||||
|
||||
rv = (*aCacheDirOut)->Append(NS_LITERAL_STRING("morgue"));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
@ -126,12 +126,12 @@ BodyStartWriteStream(const QuotaInfo& aQuotaInfo,
|
||||
nsAsyncCopyCallbackFun aCallback, nsID* aIdOut,
|
||||
nsISupports** aCopyContextOut)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_ASSERT(aSource);
|
||||
MOZ_ASSERT(aClosure);
|
||||
MOZ_ASSERT(aCallback);
|
||||
MOZ_ASSERT(aIdOut);
|
||||
MOZ_ASSERT(aCopyContextOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aSource);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aClosure);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCallback);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aIdOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCopyContextOut);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIUUIDGenerator> idGen =
|
||||
@ -183,8 +183,8 @@ BodyStartWriteStream(const QuotaInfo& aQuotaInfo,
|
||||
void
|
||||
BodyCancelWrite(nsIFile* aBaseDir, nsISupports* aCopyContext)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_ASSERT(aCopyContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCopyContext);
|
||||
|
||||
nsresult rv = NS_CancelAsyncCopy(aCopyContext, NS_ERROR_ABORT);
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
@ -197,7 +197,7 @@ BodyCancelWrite(nsIFile* aBaseDir, nsISupports* aCopyContext)
|
||||
nsresult
|
||||
BodyFinalizeWrite(nsIFile* aBaseDir, const nsID& aId)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
|
||||
nsCOMPtr<nsIFile> tmpFile;
|
||||
nsresult rv = BodyIdToFile(aBaseDir, aId, BODY_FILE_TMP, getter_AddRefs(tmpFile));
|
||||
@ -222,8 +222,8 @@ nsresult
|
||||
BodyOpen(const QuotaInfo& aQuotaInfo, nsIFile* aBaseDir, const nsID& aId,
|
||||
nsIInputStream** aStreamOut)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_ASSERT(aStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamOut);
|
||||
|
||||
nsCOMPtr<nsIFile> finalFile;
|
||||
nsresult rv = BodyIdToFile(aBaseDir, aId, BODY_FILE_FINAL,
|
||||
@ -292,14 +292,14 @@ nsresult
|
||||
BodyIdToFile(nsIFile* aBaseDir, const nsID& aId, BodyFileType aType,
|
||||
nsIFile** aBodyFileOut)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_ASSERT(aBodyFileOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBodyFileOut);
|
||||
|
||||
*aBodyFileOut = nullptr;
|
||||
|
||||
nsresult rv = BodyGetCacheDir(aBaseDir, aId, aBodyFileOut);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(*aBodyFileOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(*aBodyFileOut);
|
||||
|
||||
char idString[NSID_LENGTH];
|
||||
aId.ToProvidedString(idString);
|
||||
@ -323,7 +323,7 @@ BodyIdToFile(nsIFile* aBaseDir, const nsID& aId, BodyFileType aType,
|
||||
nsresult
|
||||
BodyDeleteOrphanedFiles(nsIFile* aBaseDir, nsTArray<nsID>& aKnownBodyIdList)
|
||||
{
|
||||
MOZ_ASSERT(aBaseDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBaseDir);
|
||||
|
||||
// body files are stored in a directory structure like:
|
||||
//
|
||||
@ -421,7 +421,7 @@ namespace {
|
||||
nsresult
|
||||
GetMarkerFileHandle(const QuotaInfo& aQuotaInfo, nsIFile** aFileOut)
|
||||
{
|
||||
MOZ_ASSERT(aFileOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFileOut);
|
||||
|
||||
nsCOMPtr<nsIFile> marker;
|
||||
nsresult rv = aQuotaInfo.mDir->Clone(getter_AddRefs(marker));
|
||||
|
108
dom/cache/Manager.cpp
vendored
108
dom/cache/Manager.cpp
vendored
@ -117,8 +117,8 @@ public:
|
||||
virtual void
|
||||
RunOnTarget(Resolver* aResolver, const QuotaInfo& aQuotaInfo, Data*) override
|
||||
{
|
||||
MOZ_ASSERT(aResolver);
|
||||
MOZ_ASSERT(aQuotaInfo.mDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aQuotaInfo.mDir);
|
||||
|
||||
// Note that since DeleteOrphanedBodyAction isn't used while the context is
|
||||
// being initialized, we don't need to check for cancellation here.
|
||||
@ -231,8 +231,8 @@ public:
|
||||
Remove(Manager* aManager)
|
||||
{
|
||||
mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aManager);
|
||||
MOZ_ASSERT(sFactory);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(sFactory);
|
||||
|
||||
MOZ_ALWAYS_TRUE(sFactory->mManagerList.RemoveElement(aManager));
|
||||
|
||||
@ -249,7 +249,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!sFactory->mManagerList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!sFactory->mManagerList.IsEmpty());
|
||||
|
||||
{
|
||||
ManagerList::ForwardIterator iter(sFactory->mManagerList);
|
||||
@ -272,7 +272,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!sFactory->mManagerList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!sFactory->mManagerList.IsEmpty());
|
||||
|
||||
{
|
||||
// Note that we are synchronously calling shutdown code here. If any
|
||||
@ -308,8 +308,8 @@ private:
|
||||
~Factory()
|
||||
{
|
||||
MOZ_COUNT_DTOR(cache::Manager::Factory);
|
||||
MOZ_ASSERT(mManagerList.IsEmpty());
|
||||
MOZ_ASSERT(!mInSyncShutdown);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManagerList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mInSyncShutdown);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
@ -348,7 +348,7 @@ private:
|
||||
MaybeDestroyInstance()
|
||||
{
|
||||
mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(sFactory);
|
||||
MOZ_DIAGNOSTIC_ASSERT(sFactory);
|
||||
|
||||
// If the factory is is still in use then we cannot delete yet. This
|
||||
// could be due to managers still existing or because we are in the
|
||||
@ -622,9 +622,9 @@ public:
|
||||
, mAsyncResult(NS_OK)
|
||||
, mMutex("cache::Manager::CachePutAllAction")
|
||||
{
|
||||
MOZ_ASSERT(!aPutList.IsEmpty());
|
||||
MOZ_ASSERT(aPutList.Length() == aRequestStreamList.Length());
|
||||
MOZ_ASSERT(aPutList.Length() == aResponseStreamList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!aPutList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aPutList.Length() == aRequestStreamList.Length());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aPutList.Length() == aResponseStreamList.Length());
|
||||
|
||||
for (uint32_t i = 0; i < aPutList.Length(); ++i) {
|
||||
Entry* entry = mList.AppendElement();
|
||||
@ -642,21 +642,21 @@ private:
|
||||
RunWithDBOnTarget(Resolver* aResolver, const QuotaInfo& aQuotaInfo,
|
||||
nsIFile* aDBDir, mozIStorageConnection* aConn) override
|
||||
{
|
||||
MOZ_ASSERT(aResolver);
|
||||
MOZ_ASSERT(aDBDir);
|
||||
MOZ_ASSERT(aConn);
|
||||
MOZ_ASSERT(!mResolver);
|
||||
MOZ_ASSERT(!mDBDir);
|
||||
MOZ_ASSERT(!mConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aDBDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDBDir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mConn);
|
||||
|
||||
MOZ_ASSERT(!mTargetThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mTargetThread);
|
||||
mTargetThread = NS_GetCurrentThread();
|
||||
MOZ_ASSERT(mTargetThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mTargetThread);
|
||||
|
||||
// We should be pre-initialized to expect one async completion. This is
|
||||
// the "manual" completion we call at the end of this method in all
|
||||
// cases.
|
||||
MOZ_ASSERT(mExpectedAsyncCopyCompletions == 1);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mExpectedAsyncCopyCompletions == 1);
|
||||
|
||||
mResolver = aResolver;
|
||||
mDBDir = aDBDir;
|
||||
@ -695,9 +695,9 @@ private:
|
||||
OnAsyncCopyComplete(nsresult aRv)
|
||||
{
|
||||
MOZ_ASSERT(mTargetThread == NS_GetCurrentThread());
|
||||
MOZ_ASSERT(mConn);
|
||||
MOZ_ASSERT(mResolver);
|
||||
MOZ_ASSERT(mExpectedAsyncCopyCompletions > 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mConn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mResolver);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mExpectedAsyncCopyCompletions > 0);
|
||||
|
||||
// Explicitly check for cancellation here to catch a race condition.
|
||||
// Consider:
|
||||
@ -842,7 +842,7 @@ private:
|
||||
StreamId aStreamId, uint32_t* aCopyCountOut)
|
||||
{
|
||||
MOZ_ASSERT(mTargetThread == NS_GetCurrentThread());
|
||||
MOZ_ASSERT(aCopyCountOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aCopyCountOut);
|
||||
|
||||
if (IsCanceled()) {
|
||||
return NS_ERROR_ABORT;
|
||||
@ -855,7 +855,7 @@ private:
|
||||
source = aEntry.mRequestStream;
|
||||
bodyId = &aEntry.mRequestBodyId;
|
||||
} else {
|
||||
MOZ_ASSERT(aStreamId == ResponseStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamId == ResponseStream);
|
||||
source = aEntry.mResponseStream;
|
||||
bodyId = &aEntry.mResponseBodyId;
|
||||
}
|
||||
@ -898,7 +898,7 @@ private:
|
||||
AsyncCopyCompleteFunc(void* aClosure, nsresult aRv)
|
||||
{
|
||||
// May be on any thread, including STS event target.
|
||||
MOZ_ASSERT(aClosure);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aClosure);
|
||||
// Weak ref as we are guaranteed to the action is alive until
|
||||
// CompleteOnInitiatingThread is called.
|
||||
CachePutAllAction* action = static_cast<CachePutAllAction*>(aClosure);
|
||||
@ -1453,13 +1453,13 @@ void
|
||||
Manager::RemoveContext(Context* aContext)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_ASSERT(mContext == aContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext == aContext);
|
||||
|
||||
// Whether the Context destruction was triggered from the Manager going
|
||||
// idle or the underlying storage being invalidated, we should know we
|
||||
// are closing before the Context is destroyed.
|
||||
MOZ_ASSERT(mState == Closing);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == Closing);
|
||||
|
||||
// Before forgetting the Context, check to see if we have any outstanding
|
||||
// cache or body objects waiting for deletion. If so, note that we've
|
||||
@ -1523,9 +1523,11 @@ Manager::ReleaseCacheId(CacheId aCacheId)
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
for (uint32_t i = 0; i < mCacheIdRefs.Length(); ++i) {
|
||||
if (mCacheIdRefs[i].mCacheId == aCacheId) {
|
||||
DebugOnly<uint32_t> oldRef = mCacheIdRefs[i].mCount;
|
||||
#if !defined(RELEASE_OR_BETA)
|
||||
uint32_t oldRef = mCacheIdRefs[i].mCount;
|
||||
#endif
|
||||
mCacheIdRefs[i].mCount -= 1;
|
||||
MOZ_ASSERT(mCacheIdRefs[i].mCount < oldRef);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mCacheIdRefs[i].mCount < oldRef);
|
||||
if (mCacheIdRefs[i].mCount == 0) {
|
||||
bool orphaned = mCacheIdRefs[i].mOrphaned;
|
||||
mCacheIdRefs.RemoveElementAt(i);
|
||||
@ -1572,9 +1574,11 @@ Manager::ReleaseBodyId(const nsID& aBodyId)
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
for (uint32_t i = 0; i < mBodyIdRefs.Length(); ++i) {
|
||||
if (mBodyIdRefs[i].mBodyId == aBodyId) {
|
||||
DebugOnly<uint32_t> oldRef = mBodyIdRefs[i].mCount;
|
||||
#if !defined(RELEASE_OR_BETA)
|
||||
uint32_t oldRef = mBodyIdRefs[i].mCount;
|
||||
#endif
|
||||
mBodyIdRefs[i].mCount -= 1;
|
||||
MOZ_ASSERT(mBodyIdRefs[i].mCount < oldRef);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBodyIdRefs[i].mCount < oldRef);
|
||||
if (mBodyIdRefs[i].mCount < 1) {
|
||||
bool orphaned = mBodyIdRefs[i].mOrphaned;
|
||||
mBodyIdRefs.RemoveElementAt(i);
|
||||
@ -1608,7 +1612,7 @@ void
|
||||
Manager::AddStreamList(StreamList* aStreamList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(aStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamList);
|
||||
mStreamLists.AppendElement(aStreamList);
|
||||
}
|
||||
|
||||
@ -1616,7 +1620,7 @@ void
|
||||
Manager::RemoveStreamList(StreamList* aStreamList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(aStreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamList);
|
||||
mStreamLists.RemoveElement(aStreamList);
|
||||
}
|
||||
|
||||
@ -1625,8 +1629,8 @@ Manager::ExecuteCacheOp(Listener* aListener, CacheId aCacheId,
|
||||
const CacheOpArgs& aOpArgs)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_ASSERT(aOpArgs.type() != CacheOpArgs::TCachePutAllArgs);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aOpArgs.type() != CacheOpArgs::TCachePutAllArgs);
|
||||
|
||||
if (NS_WARN_IF(mState == Closing)) {
|
||||
aListener->OnOpComplete(ErrorResult(NS_ERROR_FAILURE), void_t());
|
||||
@ -1634,7 +1638,7 @@ Manager::ExecuteCacheOp(Listener* aListener, CacheId aCacheId,
|
||||
}
|
||||
|
||||
RefPtr<Context> context = mContext;
|
||||
MOZ_ASSERT(!context->IsCanceled());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!context->IsCanceled());
|
||||
|
||||
RefPtr<StreamList> streamList = new StreamList(this, context);
|
||||
ListenerId listenerId = SaveListener(aListener);
|
||||
@ -1670,7 +1674,7 @@ Manager::ExecuteStorageOp(Listener* aListener, Namespace aNamespace,
|
||||
const CacheOpArgs& aOpArgs)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
|
||||
if (NS_WARN_IF(mState == Closing)) {
|
||||
aListener->OnOpComplete(ErrorResult(NS_ERROR_FAILURE), void_t());
|
||||
@ -1678,7 +1682,7 @@ Manager::ExecuteStorageOp(Listener* aListener, Namespace aNamespace,
|
||||
}
|
||||
|
||||
RefPtr<Context> context = mContext;
|
||||
MOZ_ASSERT(!context->IsCanceled());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!context->IsCanceled());
|
||||
|
||||
RefPtr<StreamList> streamList = new StreamList(this, context);
|
||||
ListenerId listenerId = SaveListener(aListener);
|
||||
@ -1719,7 +1723,7 @@ Manager::ExecutePutAll(Listener* aListener, CacheId aCacheId,
|
||||
const nsTArray<nsCOMPtr<nsIInputStream>>& aResponseStreamList)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
|
||||
if (NS_WARN_IF(mState == Closing)) {
|
||||
aListener->OnOpComplete(ErrorResult(NS_ERROR_FAILURE), CachePutAllResult());
|
||||
@ -1727,7 +1731,7 @@ Manager::ExecutePutAll(Listener* aListener, CacheId aCacheId,
|
||||
}
|
||||
|
||||
RefPtr<Context> context = mContext;
|
||||
MOZ_ASSERT(!context->IsCanceled());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!context->IsCanceled());
|
||||
|
||||
ListenerId listenerId = SaveListener(aListener);
|
||||
|
||||
@ -1745,15 +1749,15 @@ Manager::Manager(ManagerId* aManagerId, nsIThread* aIOThread)
|
||||
, mShuttingDown(false)
|
||||
, mState(Open)
|
||||
{
|
||||
MOZ_ASSERT(mManagerId);
|
||||
MOZ_ASSERT(mIOThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManagerId);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mIOThread);
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(mState == Closing);
|
||||
MOZ_ASSERT(!mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == Closing);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mContext);
|
||||
|
||||
nsCOMPtr<nsIThread> ioThread;
|
||||
mIOThread.swap(ioThread);
|
||||
@ -1814,7 +1818,7 @@ void
|
||||
Manager::Abort()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_ASSERT(mContext);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mContext);
|
||||
|
||||
// Note that we are closing to prevent any new requests from coming in and
|
||||
// creating a new Context. We must ensure all Contexts and IO operations are
|
||||
@ -1868,8 +1872,8 @@ Manager::SetCacheIdOrphanedIfRefed(CacheId aCacheId)
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
for (uint32_t i = 0; i < mCacheIdRefs.Length(); ++i) {
|
||||
if (mCacheIdRefs[i].mCacheId == aCacheId) {
|
||||
MOZ_ASSERT(mCacheIdRefs[i].mCount > 0);
|
||||
MOZ_ASSERT(!mCacheIdRefs[i].mOrphaned);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mCacheIdRefs[i].mCount > 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mCacheIdRefs[i].mOrphaned);
|
||||
mCacheIdRefs[i].mOrphaned = true;
|
||||
return true;
|
||||
}
|
||||
@ -1885,8 +1889,8 @@ Manager::SetBodyIdOrphanedIfRefed(const nsID& aBodyId)
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
for (uint32_t i = 0; i < mBodyIdRefs.Length(); ++i) {
|
||||
if (mBodyIdRefs[i].mBodyId == aBodyId) {
|
||||
MOZ_ASSERT(mBodyIdRefs[i].mCount > 0);
|
||||
MOZ_ASSERT(!mBodyIdRefs[i].mOrphaned);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBodyIdRefs[i].mCount > 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mBodyIdRefs[i].mOrphaned);
|
||||
mBodyIdRefs[i].mOrphaned = true;
|
||||
return true;
|
||||
}
|
||||
|
2
dom/cache/ManagerId.cpp
vendored
2
dom/cache/ManagerId.cpp
vendored
@ -52,7 +52,7 @@ ManagerId::ManagerId(nsIPrincipal* aPrincipal, const nsACString& aQuotaOrigin)
|
||||
: mPrincipal(aPrincipal)
|
||||
, mQuotaOrigin(aQuotaOrigin)
|
||||
{
|
||||
MOZ_ASSERT(mPrincipal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mPrincipal);
|
||||
}
|
||||
|
||||
ManagerId::~ManagerId()
|
||||
|
14
dom/cache/PrincipalVerifier.cpp
vendored
14
dom/cache/PrincipalVerifier.cpp
vendored
@ -49,7 +49,7 @@ void
|
||||
PrincipalVerifier::AddListener(Listener* aListener)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
MOZ_ASSERT(!mListenerList.Contains(aListener));
|
||||
mListenerList.AppendElement(aListener);
|
||||
}
|
||||
@ -58,7 +58,7 @@ void
|
||||
PrincipalVerifier::RemoveListener(Listener* aListener)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
MOZ_ALWAYS_TRUE(mListenerList.RemoveElement(aListener));
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ PrincipalVerifier::PrincipalVerifier(Listener* aListener,
|
||||
, mResult(NS_OK)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(mInitiatingThread);
|
||||
MOZ_ASSERT(aListener);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInitiatingThread);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aListener);
|
||||
|
||||
mListenerList.AppendElement(aListener);
|
||||
}
|
||||
@ -83,11 +83,11 @@ PrincipalVerifier::~PrincipalVerifier()
|
||||
// threads, its a race to see which thread de-refs us last. Therefore
|
||||
// we cannot guarantee which thread we destruct on.
|
||||
|
||||
MOZ_ASSERT(mListenerList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListenerList.IsEmpty());
|
||||
|
||||
// We should always be able to explicitly release the actor on the main
|
||||
// thread.
|
||||
MOZ_ASSERT(!mActor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mActor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -190,7 +190,7 @@ PrincipalVerifier::CompleteOnInitiatingThread()
|
||||
}
|
||||
|
||||
// The listener must clear its reference in OnPrincipalVerified()
|
||||
MOZ_ASSERT(mListenerList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mListenerList.IsEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
|
10
dom/cache/QuotaClient.cpp
vendored
10
dom/cache/QuotaClient.cpp
vendored
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/cache/QuotaClient.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/dom/cache/Manager.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/quota/UsageInfo.h"
|
||||
@ -17,7 +16,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::dom::ContentParentId;
|
||||
using mozilla::dom::cache::Manager;
|
||||
using mozilla::dom::quota::Client;
|
||||
@ -55,7 +53,7 @@ GetBodyUsage(nsIFile* aDir, UsageInfo* aUsageInfo)
|
||||
int64_t fileSize;
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(fileSize >= 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(fileSize >= 0);
|
||||
|
||||
aUsageInfo->AppendToFileUsage(fileSize);
|
||||
}
|
||||
@ -90,10 +88,10 @@ public:
|
||||
const nsACString& aOrigin,
|
||||
UsageInfo* aUsageInfo) override
|
||||
{
|
||||
MOZ_ASSERT(aUsageInfo);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aUsageInfo);
|
||||
|
||||
QuotaManager* qm = QuotaManager::Get();
|
||||
MOZ_ASSERT(qm);
|
||||
MOZ_DIAGNOSTIC_ASSERT(qm);
|
||||
|
||||
nsCOMPtr<nsIFile> dir;
|
||||
nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin,
|
||||
@ -148,7 +146,7 @@ public:
|
||||
int64_t fileSize;
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(fileSize >= 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(fileSize >= 0);
|
||||
|
||||
aUsageInfo->AppendToDatabaseUsage(fileSize);
|
||||
continue;
|
||||
|
42
dom/cache/ReadStream.cpp
vendored
42
dom/cache/ReadStream.cpp
vendored
@ -195,8 +195,8 @@ ReadStream::Inner::Inner(StreamControl* aControl, const nsID& aId,
|
||||
, mOwningThread(NS_GetCurrentThread())
|
||||
, mState(Open)
|
||||
{
|
||||
MOZ_ASSERT(mStream);
|
||||
MOZ_ASSERT(mControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mControl);
|
||||
mControl->AddReadStream(this);
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ ReadStream::Inner::Serialize(CacheReadStreamOrVoid* aReadStreamOut,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mOwningThread);
|
||||
MOZ_ASSERT(aReadStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
*aReadStreamOut = CacheReadStream();
|
||||
Serialize(&aReadStreamOut->get_CacheReadStream(), aStreamCleanupList, aRv);
|
||||
}
|
||||
@ -217,21 +217,21 @@ ReadStream::Inner::Serialize(CacheReadStream* aReadStreamOut,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mOwningThread);
|
||||
MOZ_ASSERT(aReadStreamOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut);
|
||||
|
||||
if (mState != Open) {
|
||||
aRv.ThrowTypeError<MSG_CACHE_STREAM_CLOSED>();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mControl);
|
||||
|
||||
aReadStreamOut->id() = mId;
|
||||
mControl->SerializeControl(aReadStreamOut);
|
||||
mControl->SerializeStream(aReadStreamOut, mStream, aStreamCleanupList);
|
||||
|
||||
MOZ_ASSERT(aReadStreamOut->stream().type() ==
|
||||
IPCStream::TInputStreamParamsWithFds);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStreamOut->stream().type() ==
|
||||
IPCStream::TInputStreamParamsWithFds);
|
||||
|
||||
// We're passing ownership across the IPC barrier with the control, so
|
||||
// do not signal that the stream is closed here.
|
||||
@ -292,7 +292,7 @@ nsresult
|
||||
ReadStream::Inner::Read(char* aBuf, uint32_t aCount, uint32_t* aNumReadOut)
|
||||
{
|
||||
// stream ops can happen on any thread
|
||||
MOZ_ASSERT(aNumReadOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aNumReadOut);
|
||||
|
||||
nsresult rv = mSnappyStream->Read(aBuf, aCount, aNumReadOut);
|
||||
|
||||
@ -311,7 +311,7 @@ ReadStream::Inner::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
|
||||
uint32_t aCount, uint32_t* aNumReadOut)
|
||||
{
|
||||
// stream ops can happen on any thread
|
||||
MOZ_ASSERT(aNumReadOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aNumReadOut);
|
||||
|
||||
if (aCount) {
|
||||
mHasEverBeenRead = true;
|
||||
@ -346,8 +346,8 @@ ReadStream::Inner::IsNonBlocking(bool* aNonBlockingOut)
|
||||
ReadStream::Inner::~Inner()
|
||||
{
|
||||
// Any thread
|
||||
MOZ_ASSERT(mState == Closed);
|
||||
MOZ_ASSERT(!mControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mState == Closed);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mControl);
|
||||
}
|
||||
|
||||
void
|
||||
@ -396,7 +396,7 @@ ReadStream::Inner::NoteClosedOnOwningThread()
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mControl);
|
||||
mControl->NoteClosed(this, mId);
|
||||
mControl = nullptr;
|
||||
}
|
||||
@ -411,7 +411,7 @@ ReadStream::Inner::ForgetOnOwningThread()
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mControl);
|
||||
mControl->ForgetReadStream(this);
|
||||
mControl = nullptr;
|
||||
}
|
||||
@ -442,8 +442,8 @@ ReadStream::Create(const CacheReadStream& aReadStream)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aReadStream.stream().type() ==
|
||||
IPCStream::TInputStreamParamsWithFds);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStream.stream().type() ==
|
||||
IPCStream::TInputStreamParamsWithFds);
|
||||
|
||||
// Control is guaranteed to survive this method as ActorDestroy() cannot
|
||||
// run on this thread until we complete.
|
||||
@ -455,15 +455,15 @@ ReadStream::Create(const CacheReadStream& aReadStream)
|
||||
auto actor = static_cast<CacheStreamControlParent*>(aReadStream.controlParent());
|
||||
control = actor;
|
||||
}
|
||||
MOZ_ASSERT(control);
|
||||
MOZ_DIAGNOSTIC_ASSERT(control);
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream = DeserializeIPCStream(aReadStream.stream());
|
||||
MOZ_ASSERT(stream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(stream);
|
||||
|
||||
// Currently we expect all cache read streams to be blocking file streams.
|
||||
#ifdef DEBUG
|
||||
#if !defined(RELEASE_OR_BETA)
|
||||
nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(stream);
|
||||
MOZ_ASSERT(!asyncStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!asyncStream);
|
||||
#endif
|
||||
|
||||
RefPtr<Inner> inner = new Inner(control, aReadStream.id(), stream);
|
||||
@ -476,7 +476,7 @@ already_AddRefed<ReadStream>
|
||||
ReadStream::Create(PCacheStreamControlParent* aControl, const nsID& aId,
|
||||
nsIInputStream* aStream)
|
||||
{
|
||||
MOZ_ASSERT(aControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aControl);
|
||||
auto actor = static_cast<CacheStreamControlParent*>(aControl);
|
||||
RefPtr<Inner> inner = new Inner(actor, aId, aStream);
|
||||
RefPtr<ReadStream> ref = new ReadStream(inner);
|
||||
@ -502,7 +502,7 @@ ReadStream::Serialize(CacheReadStream* aReadStreamOut,
|
||||
ReadStream::ReadStream(ReadStream::Inner* aInner)
|
||||
: mInner(aInner)
|
||||
{
|
||||
MOZ_ASSERT(mInner);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInner);
|
||||
}
|
||||
|
||||
ReadStream::~ReadStream()
|
||||
|
10
dom/cache/StreamControl.cpp
vendored
10
dom/cache/StreamControl.cpp
vendored
@ -14,7 +14,7 @@ void
|
||||
StreamControl::AddReadStream(ReadStream::Controllable* aReadStream)
|
||||
{
|
||||
AssertOwningThread();
|
||||
MOZ_ASSERT(aReadStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aReadStream);
|
||||
MOZ_ASSERT(!mReadStreamList.Contains(aReadStream));
|
||||
mReadStreamList.AppendElement(aReadStream);
|
||||
}
|
||||
@ -38,14 +38,16 @@ StreamControl::NoteClosed(ReadStream::Controllable* aReadStream,
|
||||
StreamControl::~StreamControl()
|
||||
{
|
||||
// owning thread only, but can't call virtual AssertOwningThread in destructor
|
||||
MOZ_ASSERT(mReadStreamList.IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mReadStreamList.IsEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
StreamControl::CloseReadStreams(const nsID& aId)
|
||||
{
|
||||
AssertOwningThread();
|
||||
DebugOnly<uint32_t> closedCount = 0;
|
||||
#if !defined(RELEASE_OR_BETA)
|
||||
uint32_t closedCount = 0;
|
||||
#endif
|
||||
|
||||
ReadStreamList::ForwardIterator iter(mReadStreamList);
|
||||
while (iter.HasMore()) {
|
||||
@ -56,7 +58,7 @@ StreamControl::CloseReadStreams(const nsID& aId)
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(closedCount > 0);
|
||||
MOZ_DIAGNOSTIC_ASSERT(closedCount > 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
20
dom/cache/StreamList.cpp
vendored
20
dom/cache/StreamList.cpp
vendored
@ -22,7 +22,7 @@ StreamList::StreamList(Manager* aManager, Context* aContext)
|
||||
, mStreamControl(nullptr)
|
||||
, mActivated(false)
|
||||
{
|
||||
MOZ_ASSERT(mManager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mManager);
|
||||
mContext->AddActivity(this);
|
||||
}
|
||||
|
||||
@ -30,13 +30,13 @@ void
|
||||
StreamList::SetStreamControl(CacheStreamControlParent* aStreamControl)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||
MOZ_ASSERT(aStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamControl);
|
||||
|
||||
// For cases where multiple streams are serialized for a single list
|
||||
// then the control will get passed multiple times. This is ok, but
|
||||
// it should be the same control each time.
|
||||
if (mStreamControl) {
|
||||
MOZ_ASSERT(aStreamControl == mStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamControl == mStreamControl);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ void
|
||||
StreamList::RemoveStreamControl(CacheStreamControlParent* aStreamControl)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||
MOZ_ASSERT(mStreamControl);
|
||||
MOZ_ASSERT(mStreamControl == aStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mStreamControl == aStreamControl);
|
||||
mStreamControl = nullptr;
|
||||
}
|
||||
|
||||
@ -57,8 +57,8 @@ void
|
||||
StreamList::Activate(CacheId aCacheId)
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||
MOZ_ASSERT(!mActivated);
|
||||
MOZ_ASSERT(mCacheId == INVALID_CACHE_ID);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mActivated);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mCacheId == INVALID_CACHE_ID);
|
||||
mActivated = true;
|
||||
mCacheId = aCacheId;
|
||||
mManager->AddRefCacheId(mCacheId);
|
||||
@ -74,8 +74,8 @@ StreamList::Add(const nsID& aId, nsIInputStream* aStream)
|
||||
{
|
||||
// All streams should be added on IO thread before we set the stream
|
||||
// control on the owning IPC thread.
|
||||
MOZ_ASSERT(!mStreamControl);
|
||||
MOZ_ASSERT(aStream);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStream);
|
||||
Entry* entry = mList.AppendElement();
|
||||
entry->mId = aId;
|
||||
entry->mStream = aStream;
|
||||
@ -159,7 +159,7 @@ StreamList::MatchesCacheId(CacheId aCacheId) const
|
||||
StreamList::~StreamList()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||
MOZ_ASSERT(!mStreamControl);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStreamControl);
|
||||
if (mActivated) {
|
||||
mManager->RemoveStreamList(this);
|
||||
for (uint32_t i = 0; i < mList.Length(); ++i) {
|
||||
|
26
dom/cache/TypeUtils.cpp
vendored
26
dom/cache/TypeUtils.cpp
vendored
@ -65,7 +65,7 @@ HasVaryStar(mozilla::dom::InternalHeaders* aHeaders)
|
||||
void
|
||||
ToHeadersEntryList(nsTArray<HeadersEntry>& aOut, InternalHeaders* aHeaders)
|
||||
{
|
||||
MOZ_ASSERT(aHeaders);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aHeaders);
|
||||
|
||||
AutoTArray<InternalHeaders::Entry, 16> entryList;
|
||||
aHeaders->GetEntries(entryList);
|
||||
@ -121,7 +121,7 @@ TypeUtils::ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
|
||||
nsTArray<UniquePtr<AutoIPCStream>>& aStreamCleanupList,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aIn);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aIn);
|
||||
aIn->GetMethod(aOut.method());
|
||||
nsCString url(aIn->GetURLWithoutFragment());
|
||||
bool schemeValid;
|
||||
@ -142,7 +142,7 @@ TypeUtils::ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
|
||||
aIn->GetReferrer(aOut.referrer());
|
||||
aOut.referrerPolicy() = aIn->ReferrerPolicy_();
|
||||
RefPtr<InternalHeaders> headers = aIn->Headers();
|
||||
MOZ_ASSERT(headers);
|
||||
MOZ_DIAGNOSTIC_ASSERT(headers);
|
||||
ToHeadersEntryList(aOut.headers(), headers);
|
||||
aOut.headersGuard() = headers->Guard();
|
||||
aOut.mode() = aIn->Mode();
|
||||
@ -179,7 +179,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
|
||||
aIn.GetURLList(urlList);
|
||||
|
||||
for (uint32_t i = 0; i < aOut.urlList().Length(); i++) {
|
||||
MOZ_ASSERT(!aOut.urlList()[i].IsEmpty());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!aOut.urlList()[i].IsEmpty());
|
||||
// Pass all Response URL schemes through... The spec only requires we take
|
||||
// action on invalid schemes for Request objects.
|
||||
ProcessURL(aOut.urlList()[i], nullptr, nullptr, nullptr, aRv);
|
||||
@ -188,7 +188,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
|
||||
aOut.status() = aIn.GetUnfilteredStatus();
|
||||
aOut.statusText() = aIn.GetUnfilteredStatusText();
|
||||
RefPtr<InternalHeaders> headers = aIn.UnfilteredHeaders();
|
||||
MOZ_ASSERT(headers);
|
||||
MOZ_DIAGNOSTIC_ASSERT(headers);
|
||||
if (HasVaryStar(headers)) {
|
||||
aRv.ThrowTypeError<MSG_RESPONSE_HAS_VARY_STAR>();
|
||||
return;
|
||||
@ -267,9 +267,9 @@ TypeUtils::ToResponse(const CacheResponse& aIn)
|
||||
// Be careful to fill the headers before setting the guard in order to
|
||||
// correctly re-create the original headers.
|
||||
ir->Headers()->Fill(*internalHeaders, result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!result.Failed());
|
||||
ir->Headers()->SetGuard(aIn.headersGuard(), result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!result.Failed());
|
||||
|
||||
ir->InitChannelInfo(aIn.channelInfo());
|
||||
if (aIn.principalInfo().type() == mozilla::ipc::OptionalPrincipalInfo::TPrincipalInfo) {
|
||||
@ -299,7 +299,7 @@ TypeUtils::ToResponse(const CacheResponse& aIn)
|
||||
default:
|
||||
MOZ_CRASH("Unexpected ResponseType!");
|
||||
}
|
||||
MOZ_ASSERT(ir);
|
||||
MOZ_DIAGNOSTIC_ASSERT(ir);
|
||||
|
||||
RefPtr<Response> ref = new Response(GetGlobalObject(), ir);
|
||||
return ref.forget();
|
||||
@ -328,10 +328,10 @@ TypeUtils::ToInternalRequest(const CacheRequest& aIn)
|
||||
// Be careful to fill the headers before setting the guard in order to
|
||||
// correctly re-create the original headers.
|
||||
internalRequest->Headers()->Fill(*internalHeaders, result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!result.Failed());
|
||||
|
||||
internalRequest->Headers()->SetGuard(aIn.headersGuard(), result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!result.Failed());
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream = ReadStream::Create(aIn.body());
|
||||
|
||||
@ -410,7 +410,7 @@ TypeUtils::ProcessURL(nsACString& aUrl, bool* aSchemeValidOut,
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aUrlQueryOut);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aUrlQueryOut);
|
||||
|
||||
if (queryLen < 0) {
|
||||
*aUrlWithoutQueryOut = aUrl;
|
||||
@ -429,7 +429,7 @@ void
|
||||
TypeUtils::CheckAndSetBodyUsed(Request* aRequest, BodyAction aBodyAction,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aRequest);
|
||||
|
||||
if (aBodyAction == IgnoreBody) {
|
||||
return;
|
||||
@ -461,7 +461,7 @@ TypeUtils::ToInternalRequest(const nsAString& aIn, ErrorResult& aRv)
|
||||
}
|
||||
JSContext* cx = jsapi.cx();
|
||||
GlobalObject global(cx, GetGlobalObject()->GetGlobalJSObject());
|
||||
MOZ_ASSERT(!global.Failed());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!global.Failed());
|
||||
|
||||
RefPtr<Request> request = Request::Constructor(global, requestOrString,
|
||||
RequestInit(), aRv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user