Bug 903849 - Use MOZ_ASSERT consistently in XPConnect; r=bholley

This commit is contained in:
Ms2ger 2013-08-14 09:00:34 +02:00
Родитель 1daa386c13
Коммит 32b4cafc67
29 изменённых файлов: 339 добавлений и 352 удалений

Просмотреть файл

@ -199,7 +199,7 @@ File(JSContext *cx, unsigned argc, Value *vp)
}
nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
NS_ASSERTION(initializer, "what?");
MOZ_ASSERT(initializer);
rv = initializer->Initialize(nullptr, cx, nullptr, args);
if (NS_FAILED(rv)) {
@ -234,7 +234,7 @@ Blob(JSContext *cx, unsigned argc, Value *vp)
}
nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
NS_ASSERTION(initializer, "what?");
MOZ_ASSERT(initializer);
rv = initializer->Initialize(nullptr, cx, nullptr, args);
if (NS_FAILED(rv)) {
@ -347,7 +347,7 @@ mozJSComponentLoader::mozJSComponentLoader()
mInitialized(false),
mReuseLoaderGlobal(false)
{
NS_ASSERTION(!sSelf, "mozJSComponentLoader should be a singleton");
MOZ_ASSERT(!sSelf, "mozJSComponentLoader should be a singleton");
#ifdef PR_LOGGING
if (!gJSCLLog) {
@ -1272,7 +1272,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
mod = newEntry;
}
NS_ASSERTION(mod->obj, "Import table contains entry with no object");
MOZ_ASSERT(mod->obj, "Import table contains entry with no object");
vp.set(mod->obj);
if (targetObj) {
@ -1417,7 +1417,7 @@ mozJSComponentLoader::ModuleEntry::GetFactory(const mozilla::Module& module,
const mozilla::Module::CIDEntry& entry)
{
const ModuleEntry& self = static_cast<const ModuleEntry&>(module);
NS_ASSERTION(self.getfactoryobj, "Handing out an uninitialized module?");
MOZ_ASSERT(self.getfactoryobj, "Handing out an uninitialized module?");
nsCOMPtr<nsIFactory> f;
nsresult rv = self.getfactoryobj->Get(*entry.cid, getter_AddRefs(f));
@ -1454,6 +1454,6 @@ JSCLContextHelper::~JSCLContextHelper()
void
JSCLContextHelper::reportErrorAfterPop(char *buf)
{
NS_ASSERTION(!mBuf, "Already called reportErrorAfterPop");
MOZ_ASSERT(!mBuf, "Already called reportErrorAfterPop");
mBuf = buf;
}

Просмотреть файл

@ -125,7 +125,7 @@ public:
nsAutoJSValHolder &operator=(jsval aOther) {
#ifdef DEBUG
if (JSVAL_IS_GCTHING(aOther) && !JSVAL_IS_NULL(aOther)) {
NS_ASSERTION(IsHeld(), "Not rooted!");
MOZ_ASSERT(IsHeld(), "Not rooted!");
}
#endif
mVal = aOther;

Просмотреть файл

@ -747,7 +747,7 @@ Blob(JSContext *cx, unsigned argc, jsval *vp)
}
nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
NS_ASSERTION(initializer, "what?");
MOZ_ASSERT(initializer);
nsresult rv = initializer->Initialize(nullptr, cx, nullptr, args);
if (NS_FAILED(rv)) {
@ -786,7 +786,7 @@ File(JSContext *cx, unsigned argc, jsval *vp)
}
nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
NS_ASSERTION(initializer, "what?");
MOZ_ASSERT(initializer);
nsresult rv = initializer->Initialize(nullptr, cx, nullptr, args);
if (NS_FAILED(rv)) {
@ -1684,7 +1684,7 @@ main(int argc, char **argv, char **envp)
}
const JSSecurityCallbacks *scb = JS_GetSecurityCallbacks(rt);
NS_ASSERTION(scb, "We are assuming that nsScriptSecurityManager::Init() has been run");
MOZ_ASSERT(scb, "We are assuming that nsScriptSecurityManager::Init() has been run");
shellSecurityCallbacks = *scb;
JS_SetSecurityCallbacks(rt, &shellSecurityCallbacks);
@ -1780,7 +1780,7 @@ main(int argc, char **argv, char **envp)
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
rv = NS_ShutdownXPCOM( NULL );
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
#ifdef TEST_CALL_ON_WRAPPED_JS_AFTER_SHUTDOWN
// test of late call and release (see above)

Просмотреть файл

@ -39,7 +39,6 @@ XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
{
MOZ_ASSERT(cx);
NS_ASSERTION(mJSContext, "No JSContext supplied to XPCCallContext");
if (!mXPC)
return;
@ -87,7 +86,7 @@ XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
else
mScriptableInfo = mWrapper->GetScriptableInfo();
} else {
NS_ABORT_IF_FALSE(!mFlattenedJSObject, "What object do we have?");
MOZ_ASSERT(!mFlattenedJSObject, "What object do we have?");
}
if (!JSID_IS_VOID(name))
@ -240,7 +239,7 @@ XPCCallContext::~XPCCallContext()
mXPCContext->SetCallingLangType(mPrevCallerLanguage);
DebugOnly<XPCCallContext*> old = XPCJSRuntime::Get()->SetCallContext(mPrevCallContext);
NS_ASSERTION(old == this, "bad pop from per thread data");
MOZ_ASSERT(old == this, "bad pop from per thread data");
}
}

Просмотреть файл

@ -3261,8 +3261,7 @@ xpc_CreateSandboxObject(JSContext *cx, jsval *vp, nsISupports *prinOrSop, Sandbo
principal = sop->GetPrincipal();
} else {
principal = do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
NS_ASSERTION(NS_FAILED(rv) || principal,
"Bad return from do_CreateInstance");
MOZ_ASSERT(NS_FAILED(rv) || principal, "Bad return from do_CreateInstance");
if (!principal || NS_FAILED(rv)) {
if (NS_SUCCEEDED(rv)) {
@ -3860,7 +3859,7 @@ xpc_EvalInSandbox(JSContext *cx, HandleObject sandboxArg, const nsAString& sourc
nsIScriptObjectPrincipal *sop =
(nsIScriptObjectPrincipal*)xpc_GetJSPrivate(sandbox);
NS_ASSERTION(sop, "Invalid sandbox passed");
MOZ_ASSERT(sop, "Invalid sandbox passed");
nsCOMPtr<nsIPrincipal> prin = sop->GetPrincipal();
NS_ENSURE_TRUE(prin, NS_ERROR_FAILURE);
@ -4211,7 +4210,7 @@ FunctionWrapper(JSContext *cx, unsigned argc, Value *vp)
CallArgs args = CallArgsFromVp(argc, vp);
RootedValue v(cx, js::GetFunctionNativeReserved(&args.callee(), 0));
NS_ASSERTION(v.isObject(), "weird function");
MOZ_ASSERT(v.isObject(), "weird function");
JSObject *obj = JS_THIS_OBJECT(cx, vp);
if (!obj) {
@ -4735,7 +4734,7 @@ nsXPCComponents::GetStack(nsIStackFrame * *aStack)
NS_IMETHODIMP
nsXPCComponents::GetManager(nsIComponentManager * *aManager)
{
NS_ASSERTION(aManager, "bad param");
MOZ_ASSERT(aManager, "bad param");
return NS_GetComponentManager(aManager);
}

Просмотреть файл

@ -25,14 +25,14 @@ XPCContext::XPCContext(XPCJSRuntime* aRuntime,
PR_INIT_CLIST(&mScopes);
NS_ASSERTION(!JS_GetSecondContextPrivate(mJSContext), "Must be null");
MOZ_ASSERT(!JS_GetSecondContextPrivate(mJSContext), "Must be null");
JS_SetSecondContextPrivate(mJSContext, this);
}
XPCContext::~XPCContext()
{
MOZ_COUNT_DTOR(XPCContext);
NS_ASSERTION(JS_GetSecondContextPrivate(mJSContext) == this, "Must match this");
MOZ_ASSERT(JS_GetSecondContextPrivate(mJSContext) == this, "Must match this");
JS_SetSecondContextPrivate(mJSContext, nullptr);
NS_IF_RELEASE(mException);

Просмотреть файл

@ -82,7 +82,7 @@ bool
XPCConvert::GetISupportsFromJSObject(JSObject* obj, nsISupports** iface)
{
JSClass* jsclass = js::GetObjectJSClass(obj);
NS_ASSERTION(jsclass, "obj has no class");
MOZ_ASSERT(jsclass, "obj has no class");
if (jsclass &&
(jsclass->flags & JSCLASS_HAS_PRIVATE) &&
(jsclass->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS)) {
@ -134,7 +134,7 @@ XPCConvert::NativeData2JS(jsval* d, const void* s,
return false;
#ifdef STRICT_CHECK_OF_UNICODE
NS_ASSERTION(! ILLEGAL_CHAR_RANGE(p) , "passing non ASCII data");
MOZ_ASSERT(! ILLEGAL_CHAR_RANGE(p) , "passing non ASCII data");
#endif // STRICT_CHECK_OF_UNICODE
JSString* str;
@ -225,7 +225,7 @@ XPCConvert::NativeData2JS(jsval* d, const void* s,
if (ILLEGAL_CHAR_RANGE(*t))
isAscii = false;
}
NS_ASSERTION(isAscii, "passing non ASCII data");
MOZ_ASSERT(isAscii, "passing non ASCII data");
#endif // STRICT_CHECK_OF_UNICODE
JSString* str;
if (!(str = JS_NewStringCopyZ(cx, p)))
@ -336,8 +336,8 @@ XPCConvert::NativeData2JS(jsval* d, const void* s,
#ifdef DEBUG
JSObject* jsobj = JSVAL_TO_OBJECT(*d);
if (jsobj && !js::GetObjectParent(jsobj))
NS_ASSERTION(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL,
"Why did we recreate this wrapper?");
MOZ_ASSERT(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL,
"Why did we recreate this wrapper?");
#endif
}
break;
@ -724,7 +724,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
case nsXPTType::T_INTERFACE:
case nsXPTType::T_INTERFACE_IS:
{
NS_ASSERTION(iid,"can't do interface conversions without iid");
MOZ_ASSERT(iid,"can't do interface conversions without iid");
if (iid->Equals(NS_GET_IID(nsIVariant))) {
XPCVariant* variant = XPCVariant::newVariant(cx, s);
@ -800,8 +800,8 @@ XPCConvert::NativeInterface2JSObject(jsval* d,
bool allowNativeWrapper,
nsresult* pErr)
{
NS_ASSERTION(!Interface || iid,
"Need the iid if you pass in an XPCNativeInterface cache.");
MOZ_ASSERT(!Interface || iid,
"Need the iid if you pass in an XPCNativeInterface cache.");
*d = JSVAL_NULL;
if (dest)
@ -883,7 +883,7 @@ XPCConvert::NativeInterface2JSObject(jsval* d,
}
}
NS_ASSERTION(!flat || IS_WN_REFLECTOR(flat), "What kind of wrapper is this?");
MOZ_ASSERT(!flat || IS_WN_REFLECTOR(flat), "What kind of wrapper is this?");
nsresult rv;
XPCWrappedNative* wrapper;
@ -966,9 +966,9 @@ XPCConvert::JSObject2NativeInterface(void** dest, HandleObject src,
nsISupports* aOuter,
nsresult* pErr)
{
NS_ASSERTION(dest, "bad param");
NS_ASSERTION(src, "bad param");
NS_ASSERTION(iid, "bad param");
MOZ_ASSERT(dest, "bad param");
MOZ_ASSERT(src, "bad param");
MOZ_ASSERT(iid, "bad param");
AutoJSContext cx;
JSAutoCompartment ac(cx, src);
@ -1057,7 +1057,7 @@ XPCConvert::ConstructException(nsresult rv, const char* message,
JSContext* cx,
jsval* jsExceptionPtr)
{
NS_ASSERTION(!cx == !jsExceptionPtr, "Expected cx and jsExceptionPtr to cooccur.");
MOZ_ASSERT(!cx == !jsExceptionPtr, "Expected cx and jsExceptionPtr to cooccur.");
static const char format[] = "\'%s\' when calling method: [%s::%s]";
const char * msg = message;
@ -1476,9 +1476,9 @@ XPCConvert::JSTypedArray2Native(void** d,
const nsXPTType& type,
nsresult* pErr)
{
NS_ABORT_IF_FALSE(jsArray, "bad param");
NS_ABORT_IF_FALSE(d, "bad param");
NS_ABORT_IF_FALSE(JS_IsTypedArrayObject(jsArray), "not a typed array");
MOZ_ASSERT(jsArray, "bad param");
MOZ_ASSERT(d, "bad param");
MOZ_ASSERT(JS_IsTypedArrayObject(jsArray), "not a typed array");
// Check the actual length of the input array against the
// given size_is.
@ -1579,7 +1579,7 @@ XPCConvert::JSArray2Native(void** d, HandleValue s,
uint32_t count, const nsXPTType& type,
const nsID* iid, nsresult* pErr)
{
NS_ABORT_IF_FALSE(d, "bad param");
MOZ_ASSERT(d, "bad param");
AutoJSContext cx;

Просмотреть файл

@ -469,12 +469,12 @@ inline void XPCNativeSet::Mark()
#ifdef DEBUG
inline void XPCNativeSet::ASSERT_NotMarked()
{
NS_ASSERTION(!IsMarked(), "bad");
MOZ_ASSERT(!IsMarked(), "bad");
XPCNativeInterface* const * pp = mInterfaces;
for (int i = (int) mInterfaceCount; i > 0; i--, pp++)
NS_ASSERTION(!(*pp)->IsMarked(), "bad");
MOZ_ASSERT(!(*pp)->IsMarked(), "bad");
}
#endif
@ -504,8 +504,8 @@ void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj)
inline
XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff()
{
NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObjectPreserveColor()),
"tearoff not empty in dtor");
MOZ_ASSERT(!(GetInterface() || GetNative() || GetJSObjectPreserveColor()),
"tearoff not empty in dtor");
}
/***************************************************************************/

Просмотреть файл

@ -51,8 +51,8 @@ void nsJSID::Reset()
bool
nsJSID::SetName(const char* name)
{
NS_ASSERTION(!mName || mName == gNoString ,"name already set");
NS_ASSERTION(name,"null name");
MOZ_ASSERT(!mName || mName == gNoString ,"name already set");
MOZ_ASSERT(name,"null name");
mName = NS_strdup(name);
return mName ? true : false;
}
@ -65,7 +65,7 @@ nsJSID::GetName(char * *aName)
if (!NameIsSet())
SetNameToNoString();
NS_ASSERTION(mName, "name not set");
MOZ_ASSERT(mName, "name not set");
*aName = NS_strdup(mName);
return *aName ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
@ -140,7 +140,7 @@ nsJSID::Initialize(const char *idString)
bool
nsJSID::InitWithName(const nsID& id, const char *nameString)
{
NS_ASSERTION(nameString, "no name");
MOZ_ASSERT(nameString, "no name");
Reset();
mID = id;
return SetName(nameString);
@ -753,7 +753,7 @@ nsJSCID::CreateInstance(const JS::Value& iidval, JSContext* cx,
nsCOMPtr<nsISupports> inst;
rv = compMgr->CreateInstance(mDetails.ID(), nullptr, *iid, getter_AddRefs(inst));
NS_ASSERTION(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!");
MOZ_ASSERT(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!");
if (NS_FAILED(rv) || !inst)
return NS_ERROR_XPC_CI_RETURNED_FAILURE;
@ -781,8 +781,8 @@ nsJSCID::GetService(const JS::Value& iidval, JSContext* cx,
nsIXPCSecurityManager* sm;
sm = nsXPConnect::XPConnect()->GetDefaultSecurityManager();
if (sm && NS_FAILED(sm->CanCreateInstance(cx, mDetails.ID()))) {
NS_ASSERTION(JS_IsExceptionPending(cx),
"security manager vetoed GetService without setting exception");
MOZ_ASSERT(JS_IsExceptionPending(cx),
"security manager vetoed GetService without setting exception");
return NS_OK;
}
@ -798,7 +798,7 @@ nsJSCID::GetService(const JS::Value& iidval, JSContext* cx,
nsCOMPtr<nsISupports> srvc;
rv = svcMgr->GetService(mDetails.ID(), *iid, getter_AddRefs(srvc));
NS_ASSERTION(NS_FAILED(rv) || srvc, "service manager returned success, but service is null!");
MOZ_ASSERT(NS_FAILED(rv) || srvc, "service manager returned success, but service is null!");
if (NS_FAILED(rv) || !srvc)
return NS_ERROR_XPC_GS_RETURNED_FAILURE;
@ -847,7 +847,7 @@ nsJSCID::HasInstance(nsIXPConnectWrappedNative *wrapper,
// we have a JSObject
RootedObject obj(cx, &val.toObject());
NS_ASSERTION(obj, "when is an object not an object?");
MOZ_ASSERT(obj, "when is an object not an object?");
// is this really a native xpcom object with a wrapper?
nsIClassInfo* ci = nullptr;
@ -918,7 +918,7 @@ xpc_JSObjectToID(JSContext *cx, JSObject* obj)
bool
xpc_JSObjectIsID(JSContext *cx, JSObject* obj)
{
NS_ASSERTION(cx && obj, "bad param");
MOZ_ASSERT(cx && obj, "bad param");
// NOTE: this call does NOT addref
XPCWrappedNative* wrapper = nullptr;
obj = js::CheckedUnwrap(obj);

Просмотреть файл

@ -669,12 +669,12 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCo
switch (status) {
case JSFINALIZE_GROUP_START:
{
NS_ASSERTION(!self->mDoingFinalization, "bad state");
MOZ_ASSERT(!self->mDoingFinalization, "bad state");
// mThreadRunningGC indicates that GC is running
{ // scoped lock
XPCAutoLock lock(self->GetMapLock());
NS_ASSERTION(!self->mThreadRunningGC, "bad state");
MOZ_ASSERT(!self->mThreadRunningGC, "bad state");
self->mThreadRunningGC = PR_GetCurrentThread();
}
@ -699,7 +699,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCo
}
case JSFINALIZE_GROUP_END:
{
NS_ASSERTION(self->mDoingFinalization, "bad state");
MOZ_ASSERT(self->mDoingFinalization, "bad state");
self->mDoingFinalization = false;
// Release all the members whose JSObjects are now known
@ -713,7 +713,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCo
// Clear it and notify waiters.
{ // scoped lock
XPCAutoLock lock(self->GetMapLock());
NS_ASSERTION(self->mThreadRunningGC == PR_GetCurrentThread(), "bad state");
MOZ_ASSERT(self->mThreadRunningGC == PR_GetCurrentThread(), "bad state");
self->mThreadRunningGC = nullptr;
xpc_NotifyAll(self->GetMapLock());
}
@ -725,7 +725,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCo
// mThreadRunningGC indicates that GC is running
{ // scoped lock
XPCAutoLock lock(self->GetMapLock());
NS_ASSERTION(!self->mThreadRunningGC, "bad state");
MOZ_ASSERT(!self->mThreadRunningGC, "bad state");
self->mThreadRunningGC = PR_GetCurrentThread();
}
@ -886,7 +886,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCo
// Clear it and notify waiters.
{ // scoped lock
XPCAutoLock lock(self->GetMapLock());
NS_ASSERTION(self->mThreadRunningGC == PR_GetCurrentThread(), "bad state");
MOZ_ASSERT(self->mThreadRunningGC == PR_GetCurrentThread(), "bad state");
self->mThreadRunningGC = nullptr;
xpc_NotifyAll(self->GetMapLock());
}
@ -1352,7 +1352,7 @@ DEBUG_WrapperChecker(PLDHashTable *table, PLDHashEntryHdr *hdr,
uint32_t number, void *arg)
{
XPCWrappedNative* wrapper = (XPCWrappedNative*)((PLDHashEntryStub*)hdr)->key;
NS_ASSERTION(!wrapper->IsValid(), "found a 'valid' wrapper!");
MOZ_ASSERT(!wrapper->IsValid(), "found a 'valid' wrapper!");
++ *((int*)arg);
return PL_DHASH_NEXT;
}
@ -1513,7 +1513,7 @@ XPCJSRuntime::~XPCJSRuntime()
#ifdef DEBUG
for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) {
NS_ASSERTION(!mScratchStrings[i].mInUse, "Uh, string wrapper still in use!");
MOZ_ASSERT(!mScratchStrings[i].mInUse, "Uh, string wrapper still in use!");
}
#endif
}
@ -2026,7 +2026,7 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
// sundries, which would be a pain.
size_t asmJSHeap = cStats.objectsExtra.elementsAsmJSHeap;
size_t asmJSNonHeap = cStats.objectsExtra.elementsAsmJSNonHeap;
JS_ASSERT(asmJSHeap == 0 || asmJSNonHeap == 0);
MOZ_ASSERT(asmJSHeap == 0 || asmJSNonHeap == 0);
if (asmJSHeap > 0) {
REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/elements/asm.js"),
KIND_HEAP, asmJSHeap,
@ -2805,7 +2805,7 @@ ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, uint32
rv = scriptStream->Read(reinterpret_cast<char *>(ptr), end - ptr, &bytesRead);
if (NS_FAILED(rv))
return rv;
NS_ASSERTION(bytesRead > 0, "stream promised more bytes before EOF");
MOZ_ASSERT(bytesRead > 0, "stream promised more bytes before EOF");
ptr += bytesRead;
}
@ -3177,14 +3177,14 @@ XPCJSRuntime::DebugDump(int16_t depth)
void
XPCRootSetElem::AddToRootSet(XPCLock *lock, XPCRootSetElem **listHead)
{
NS_ASSERTION(!mSelfp, "Must be not linked");
MOZ_ASSERT(!mSelfp, "Must be not linked");
XPCAutoLock autoLock(lock);
mSelfp = listHead;
mNext = *listHead;
if (mNext) {
NS_ASSERTION(mNext->mSelfp == listHead, "Must be list start");
MOZ_ASSERT(mNext->mSelfp == listHead, "Must be list start");
mNext->mSelfp = &mNext;
}
*listHead = this;
@ -3196,11 +3196,11 @@ XPCRootSetElem::RemoveFromRootSet(XPCLock *lock)
nsXPConnect *xpc = nsXPConnect::XPConnect();
JS::PokeGC(xpc->GetRuntime()->Runtime());
NS_ASSERTION(mSelfp, "Must be linked");
MOZ_ASSERT(mSelfp, "Must be linked");
XPCAutoLock autoLock(lock);
NS_ASSERTION(*mSelfp == this, "Link invariant");
MOZ_ASSERT(*mSelfp == this, "Link invariant");
*mSelfp = mNext;
if (mNext)
mNext->mSelfp = mSelfp;
@ -3213,14 +3213,14 @@ XPCRootSetElem::RemoveFromRootSet(XPCLock *lock)
void
XPCJSRuntime::AddGCCallback(xpcGCCallback cb)
{
NS_ASSERTION(cb, "null callback");
MOZ_ASSERT(cb, "null callback");
extraGCCallbacks.AppendElement(cb);
}
void
XPCJSRuntime::RemoveGCCallback(xpcGCCallback cb)
{
NS_ASSERTION(cb, "null callback");
MOZ_ASSERT(cb, "null callback");
bool found = extraGCCallbacks.RemoveElement(cb);
if (!found) {
NS_ERROR("Removing a callback which was never added.");
@ -3230,14 +3230,14 @@ XPCJSRuntime::RemoveGCCallback(xpcGCCallback cb)
void
XPCJSRuntime::AddContextCallback(xpcContextCallback cb)
{
NS_ASSERTION(cb, "null callback");
MOZ_ASSERT(cb, "null callback");
extraContextCallbacks.AppendElement(cb);
}
void
XPCJSRuntime::RemoveContextCallback(xpcContextCallback cb)
{
NS_ASSERTION(cb, "null callback");
MOZ_ASSERT(cb, "null callback");
bool found = extraContextCallbacks.RemoveElement(cb);
if (!found) {
NS_ERROR("Removing a callback which was never added.");

Просмотреть файл

@ -183,7 +183,7 @@ private:
nsAutoString localeStr;
rv = appLocale->
GetCategory(NS_LITERAL_STRING(NSILOCALE_TIME), localeStr);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get app locale info");
MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to get app locale info");
nsCOMPtr<nsIPlatformCharset> platformCharset =
do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
@ -268,7 +268,7 @@ xpc_LocalizeRuntime(JSRuntime *rt)
nsAutoString localeStr;
rv = appLocale->GetCategory(NS_LITERAL_STRING(NSILOCALE_TIME), localeStr);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get app locale info");
MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to get app locale info");
NS_LossyConvertUTF16toASCII locale(localeStr);
return !!JS_SetDefaultLocale(rt, locale.get());

Просмотреть файл

@ -54,7 +54,7 @@ HashNativeKey(PLDHashTable *table, const void *key)
}
if (!Set) {
NS_ASSERTION(Addition, "bad key");
MOZ_ASSERT(Addition, "bad key");
// This would be an XOR like below.
// But "0 ^ x == x". So it does not matter.
h = (js::HashNumber) NS_PTR_TO_INT32(Addition) >> 2;
@ -86,7 +86,7 @@ JSObject2WrappedJSMap::FindDyingJSObjects(nsTArray<nsXPCWrappedJS*>* dying)
{
for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) {
nsXPCWrappedJS* wrapper = r.front().value;
NS_ASSERTION(wrapper, "found a null JS wrapper!");
MOZ_ASSERT(wrapper, "found a null JS wrapper!");
// walk the wrapper chain and find any whose JSObject is to be finalized
while (wrapper) {
@ -102,8 +102,8 @@ JSObject2WrappedJSMap::ShutdownMarker(JSRuntime* rt)
{
for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) {
nsXPCWrappedJS* wrapper = r.front().value;
NS_ASSERTION(wrapper, "found a null JS wrapper!");
NS_ASSERTION(wrapper->IsValid(), "found an invalid JS wrapper!");
MOZ_ASSERT(wrapper, "found a null JS wrapper!");
MOZ_ASSERT(wrapper->IsValid(), "found an invalid JS wrapper!");
wrapper->SystemIsBeingShutDown(rt);
}
}

Просмотреть файл

@ -142,10 +142,10 @@ public:
NS_PRECONDITION(wrapper,"bad param");
#ifdef DEBUG
XPCWrappedNative* wrapperInMap = Find(wrapper->GetIdentityObject());
NS_ASSERTION(!wrapperInMap || wrapperInMap == wrapper,
"About to remove a different wrapper with the same "
"nsISupports identity! This will most likely cause serious "
"problems!");
MOZ_ASSERT(!wrapperInMap || wrapperInMap == wrapper,
"About to remove a different wrapper with the same "
"nsISupports identity! This will most likely cause serious "
"problems!");
#endif
PL_DHashTableOperate(mTable, wrapper->GetIdentityObject(), PL_DHASH_REMOVE);
}

Просмотреть файл

@ -69,7 +69,7 @@ LookupInterfaceOrAncestor(uint32_t tableSize, const xpc_qsHashEntry *table,
static MOZ_ALWAYS_INLINE bool
HasBitInInterfacesBitmap(JSObject *obj, uint32_t interfaceBit)
{
NS_ASSERTION(IS_WN_REFLECTOR(obj), "Not a wrapper?");
MOZ_ASSERT(IS_WN_REFLECTOR(obj), "Not a wrapper?");
XPCWrappedNativeJSClass *clasp =
(XPCWrappedNativeJSClass*)js::GetObjectClass(obj);
@ -198,8 +198,8 @@ static void
GetMethodInfo(JSContext *cx, jsval *vp, const char **ifaceNamep, jsid *memberIdp)
{
RootedObject funobj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
NS_ASSERTION(JS_ObjectIsFunction(cx, funobj),
"JSNative callee should be Function object");
MOZ_ASSERT(JS_ObjectIsFunction(cx, funobj),
"JSNative callee should be Function object");
RootedString str(cx, JS_GetFunctionId(JS_GetObjectFunction(funobj)));
RootedId methodId(cx, str ? INTERNED_STRING_TO_JSID(cx, str) : JSID_VOID);
GetMemberInfo(JSVAL_TO_OBJECT(vp[1]), methodId, ifaceNamep);
@ -849,8 +849,8 @@ xpc_qsXPCOMObjectToJsval(JSContext *cx, qsObjectHelper &aHelper,
#ifdef DEBUG
JSObject* jsobj = JSVAL_TO_OBJECT(*rval);
if (jsobj && !js::GetObjectParent(jsobj))
NS_ASSERTION(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL,
"Why did we recreate this wrapper?");
MOZ_ASSERT(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL,
"Why did we recreate this wrapper?");
#endif
return true;
@ -883,6 +883,6 @@ xpc_qsAssertContextOK(JSContext *cx)
JSContext *topJSContext = stack->Peek();
// This is what we're actually trying to assert here.
NS_ASSERTION(cx == topJSContext, "wrong context on XPCJSContextStack!");
MOZ_ASSERT(cx == topJSContext, "wrong context on XPCJSContextStack!");
}
#endif

Просмотреть файл

@ -54,7 +54,7 @@ XPCTraceableVariant::~XPCTraceableVariant()
{
jsval val = GetJSValPreserveColor();
NS_ASSERTION(JSVAL_IS_GCTHING(val), "Must be traceable or unlinked");
MOZ_ASSERT(JSVAL_IS_GCTHING(val), "Must be traceable or unlinked");
// If val is JSVAL_STRING, we don't need to clean anything up; simply
// removing the string from the root set is good.
@ -205,7 +205,7 @@ XPCArrayHomogenizer::GetTypeForArray(JSContext* cx, HandleObject array,
} else if (val.isString()) {
type = tStr;
} else {
NS_ASSERTION(val.isObject(), "invalid type of jsval!");
MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
jsobj = &val.toObject();
if (JS_IsArrayObject(cx, jsobj))
type = tArr;
@ -215,15 +215,15 @@ XPCArrayHomogenizer::GetTypeForArray(JSContext* cx, HandleObject array,
type = tISup;
}
NS_ASSERTION(state != tErr, "bad state table!");
NS_ASSERTION(type != tErr, "bad type!");
NS_ASSERTION(type != tVar, "bad type!");
NS_ASSERTION(type != tUnk, "bad type!");
MOZ_ASSERT(state != tErr, "bad state table!");
MOZ_ASSERT(type != tErr, "bad type!");
MOZ_ASSERT(type != tVar, "bad type!");
MOZ_ASSERT(type != tUnk, "bad type!");
state = StateTable[state][type];
NS_ASSERTION(state != tErr, "bad state table!");
NS_ASSERTION(state != tUnk, "bad state table!");
MOZ_ASSERT(state != tErr, "bad state table!");
MOZ_ASSERT(state != tUnk, "bad state table!");
if (state == tVar)
break;
@ -292,8 +292,8 @@ bool XPCVariant::InitializeData(JSContext* cx)
// Don't use nsVariant::SetFromWStringWithSize, because that will copy
// the data. Just handle this ourselves. Note that it's ok to not
// copy because we added mJSVal as a GC root.
NS_ASSERTION(mData.mType == nsIDataType::VTYPE_EMPTY,
"Why do we already have data?");
MOZ_ASSERT(mData.mType == nsIDataType::VTYPE_EMPTY,
"Why do we already have data?");
// Despite the fact that the variant holds the length, there are
// implicit assumptions that mWStringValue[mWStringLength] == 0
@ -312,7 +312,7 @@ bool XPCVariant::InitializeData(JSContext* cx)
}
// leaving only JSObject...
NS_ASSERTION(val.isObject(), "invalid type of jsval!");
MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
RootedObject jsobj(cx, &val.toObject());
@ -398,9 +398,9 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
nsCOMPtr<XPCVariant> xpcvariant = do_QueryInterface(variant);
if (xpcvariant && xpcvariant->mReturnRawObject) {
NS_ASSERTION(type == nsIDataType::VTYPE_INTERFACE ||
type == nsIDataType::VTYPE_INTERFACE_IS,
"Weird variant");
MOZ_ASSERT(type == nsIDataType::VTYPE_INTERFACE ||
type == nsIDataType::VTYPE_INTERFACE_IS,
"Weird variant");
if (!JS_WrapValue(cx, realVal.address()))
return false;

Просмотреть файл

@ -23,8 +23,7 @@ NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse
(void *p, nsCycleCollectionTraversalCallback &cb)
{
nsISupports *s = static_cast<nsISupports*>(p);
NS_ASSERTION(CheckForRightISupports(s),
"not the nsISupports pointer we expect");
MOZ_ASSERT(CheckForRightISupports(s), "not the nsISupports pointer we expect");
nsXPCWrappedJS *tmp = Downcast(s);
nsrefcnt refcnt = tmp->mRefCnt.get();
@ -75,7 +74,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMETHODIMP
nsXPCWrappedJS::AggregatedQueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_ASSERTION(IsAggregatedToNative(), "bad AggregatedQueryInterface call");
MOZ_ASSERT(IsAggregatedToNative(), "bad AggregatedQueryInterface call");
if (!IsValid())
return NS_ERROR_UNEXPECTED;
@ -181,8 +180,7 @@ nsXPCWrappedJS::Release(void)
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
// If we can't get the main thread anymore we just leak, but this really
// shouldn't happen.
NS_ASSERTION(mainThread,
"Can't get main thread, leaking nsXPCWrappedJS!");
MOZ_ASSERT(mainThread, "Can't get main thread, leaking nsXPCWrappedJS!");
if (mainThread) {
NS_ProxyRelease(mainThread,
static_cast<nsIXPConnectWrappedJS*>(this));
@ -221,7 +219,7 @@ do_decrement:
void
nsXPCWrappedJS::TraceJS(JSTracer* trc)
{
NS_ASSERTION(mRefCnt >= 2 && IsValid(), "must be strongly referenced");
MOZ_ASSERT(mRefCnt >= 2 && IsValid(), "must be strongly referenced");
JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0);
JS_CallHeapObjectTracer(trc, &mJSObj, "nsXPCWrappedJS::mJSObj");
}
@ -294,7 +292,7 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
map = rt->GetWrappedJSMap();
if (!map) {
NS_ASSERTION(map,"bad map");
MOZ_ASSERT(map,"bad map");
return NS_ERROR_FAILURE;
}
@ -384,8 +382,8 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
}
// at this point we have a root and may need to build the specific wrapper
NS_ASSERTION(root,"bad root");
NS_ASSERTION(clazz,"bad clazz");
MOZ_ASSERT(root,"bad root");
MOZ_ASSERT(clazz,"bad clazz");
if (!wrapper) {
wrapper = new nsXPCWrappedJS(cx, jsObj, clazz, root, aOuter);
@ -498,7 +496,7 @@ nsXPCWrappedJS::Unlink()
break;
}
cur = cur->mNext;
NS_ASSERTION(cur, "failed to find wrapper in its own chain");
MOZ_ASSERT(cur, "failed to find wrapper in its own chain");
}
// let the root go
NS_RELEASE(mRoot);
@ -534,7 +532,7 @@ nsXPCWrappedJS::Find(REFNSIID aIID)
nsXPCWrappedJS*
nsXPCWrappedJS::FindInherited(REFNSIID aIID)
{
NS_ASSERTION(!aIID.Equals(NS_GET_IID(nsISupports)), "bad call sequence");
MOZ_ASSERT(!aIID.Equals(NS_GET_IID(nsISupports)), "bad call sequence");
for (nsXPCWrappedJS* cur = mRoot; cur; cur = cur->mNext) {
bool found;
@ -549,8 +547,8 @@ nsXPCWrappedJS::FindInherited(REFNSIID aIID)
NS_IMETHODIMP
nsXPCWrappedJS::GetInterfaceInfo(nsIInterfaceInfo** info)
{
NS_ASSERTION(GetClass(), "wrapper without class");
NS_ASSERTION(GetClass()->GetInterfaceInfo(), "wrapper class without interface");
MOZ_ASSERT(GetClass(), "wrapper without class");
MOZ_ASSERT(GetClass()->GetInterfaceInfo(), "wrapper class without interface");
// Since failing to get this info will crash some platforms(!), we keep
// mClass valid at shutdown time.

Просмотреть файл

@ -266,8 +266,8 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
JS_SetOptions(cx, oldOpts);
if (!success) {
NS_ASSERTION(JS_IsExceptionPending(cx),
"JS failed without setting an exception!");
MOZ_ASSERT(JS_IsExceptionPending(cx),
"JS failed without setting an exception!");
RootedValue jsexception(cx, NullValue());
@ -843,8 +843,8 @@ nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
// This should be enforced by the xpidl compiler, but it's not.
// See bug 695235.
NS_ABORT_IF_FALSE(arg_param.GetType().TagPart() == nsXPTType::T_U32,
"size_is references parameter of invalid type.");
MOZ_ASSERT(arg_param.GetType().TagPart() == nsXPTType::T_U32,
"size_is references parameter of invalid type.");
if (arg_param.IsIndirect())
*result = *(uint32_t*)nativeParams[argnum].val.p;
@ -923,7 +923,7 @@ void
nsXPCWrappedJSClass::CleanupPointerTypeObject(const nsXPTType& type,
void** pp)
{
NS_ASSERTION(pp,"null pointer");
MOZ_ASSERT(pp,"null pointer");
if (type.IsInterfacePointer()) {
nsISupports* p = *((nsISupports**)pp);
if (p) p->Release();
@ -1491,7 +1491,7 @@ pre_call_clean_up:
foundDependentParam = false;
for (i = 0; i < paramCount; i++) {
const nsXPTParamInfo& param = info->params[i];
NS_ABORT_IF_FALSE(!param.IsShared(), "[shared] implies [noscript]!");
MOZ_ASSERT(!param.IsShared(), "[shared] implies [noscript]!");
if (!param.IsOut() && !param.IsDipper())
continue;

Просмотреть файл

@ -35,9 +35,9 @@ using namespace JS;
bool
xpc_OkToHandOutWrapper(nsWrapperCache *cache)
{
NS_ABORT_IF_FALSE(cache->GetWrapper(), "Must have wrapper");
NS_ABORT_IF_FALSE(IS_WN_REFLECTOR(cache->GetWrapper()),
"Must have XPCWrappedNative wrapper");
MOZ_ASSERT(cache->GetWrapper(), "Must have wrapper");
MOZ_ASSERT(IS_WN_REFLECTOR(cache->GetWrapper()),
"Must have XPCWrappedNative wrapper");
return !XPCWrappedNative::Get(cache->GetWrapper())->NeedsSOW();
}
@ -425,14 +425,14 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
AutoJSContext cx;
nsWrapperCache *cache = helper.GetWrapperCache();
NS_ASSERTION(!cache || !cache->GetWrapperPreserveColor(),
"We assume the caller already checked if it could get the "
"wrapper from the cache.");
MOZ_ASSERT(!cache || !cache->GetWrapperPreserveColor(),
"We assume the caller already checked if it could get the "
"wrapper from the cache.");
nsresult rv;
NS_ASSERTION(!Scope->GetRuntime()->GetThreadRunningGC(),
"XPCWrappedNative::GetNewOrUsed called during GC");
MOZ_ASSERT(!Scope->GetRuntime()->GetThreadRunningGC(),
"XPCWrappedNative::GetNewOrUsed called during GC");
nsISupports *identity = helper.GetCanonical();
@ -457,7 +457,7 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
if (wrapper) {
if (Interface &&
!wrapper->FindTearOff(Interface, false, &rv)) {
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
return rv;
}
*resultWrapper = wrapper.forget().get();
@ -523,8 +523,8 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
needsSOW = true;
rv = NS_OK;
NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent),
"Xray wrapper being used to parent XPCWrappedNative?");
MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(parent),
"Xray wrapper being used to parent XPCWrappedNative?");
ac.construct(static_cast<JSContext*>(cx), parent);
@ -552,7 +552,7 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
if (wrapper) {
if (Interface && !wrapper->FindTearOff(Interface, false, &rv)) {
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
return rv;
}
*resultWrapper = wrapper.forget().get();
@ -602,8 +602,8 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
DEBUG_ReportShadowedMembers(set, wrapper, nullptr);
}
NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent),
"Xray wrapper being used to parent XPCWrappedNative?");
MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(parent),
"Xray wrapper being used to parent XPCWrappedNative?");
// We use an AutoMarkingPtr here because it is possible for JS gc to happen
// after we have Init'd the wrapper but *before* we add it to the hashtable.
@ -615,7 +615,7 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
return NS_ERROR_FAILURE;
if (Interface && !wrapper->FindTearOff(Interface, false, &rv)) {
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
return rv;
}
@ -640,7 +640,7 @@ FinishCreate(XPCWrappedNativeScope* Scope,
#if DEBUG_xpc_leaks
{
char* s = wrapper->ToString();
NS_ASSERTION(wrapper->IsValid(), "eh?");
MOZ_ASSERT(wrapper->IsValid(), "eh?");
printf("Created wrapped native %s, flat JSObject is %p\n",
s, (void*)wrapper->GetFlatJSObjectNoMark());
if (s)
@ -666,10 +666,10 @@ FinishCreate(XPCWrappedNativeScope* Scope,
if (wrapper == inWrapper) {
JSObject *flat = wrapper->GetFlatJSObject();
NS_ASSERTION(!cache || !cache->GetWrapperPreserveColor() ||
flat == cache->GetWrapperPreserveColor(),
"This object has a cached wrapper that's different from "
"the JSObject held by its native wrapper?");
MOZ_ASSERT(!cache || !cache->GetWrapperPreserveColor() ||
flat == cache->GetWrapperPreserveColor(),
"This object has a cached wrapper that's different from "
"the JSObject held by its native wrapper?");
if (cache && !cache->GetWrapperPreserveColor())
cache->SetWrapper(flat);
@ -722,7 +722,7 @@ XPCWrappedNative::GetUsedOnly(nsISupports* Object,
XPCWrappedNative** resultWrapper)
{
AutoJSContext cx;
NS_ASSERTION(Object, "XPCWrappedNative::GetUsedOnly was called with a null Object");
MOZ_ASSERT(Object, "XPCWrappedNative::GetUsedOnly was called with a null Object");
nsRefPtr<XPCWrappedNative> wrapper;
nsWrapperCache* cache = nullptr;
@ -756,7 +756,7 @@ XPCWrappedNative::GetUsedOnly(nsISupports* Object,
nsresult rv;
if (Interface && !wrapper->FindTearOff(Interface, false, &rv)) {
NS_ASSERTION(NS_FAILED(rv), "returning NS_OK on failure");
MOZ_ASSERT(NS_FAILED(rv), "returning NS_OK on failure");
return rv;
}
@ -774,8 +774,8 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed<nsISupports> aIdentity,
mIdentity = aIdentity.get();
mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID);
NS_ASSERTION(mMaybeProto, "bad ctor param");
NS_ASSERTION(mSet, "bad ctor param");
MOZ_ASSERT(mMaybeProto, "bad ctor param");
MOZ_ASSERT(mSet, "bad ctor param");
DEBUG_TrackNewWrapper(this);
}
@ -792,8 +792,8 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed<nsISupports> aIdentity,
mIdentity = aIdentity.get();
mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID);
NS_ASSERTION(aScope, "bad ctor param");
NS_ASSERTION(aSet, "bad ctor param");
MOZ_ASSERT(aScope, "bad ctor param");
MOZ_ASSERT(aSet, "bad ctor param");
DEBUG_TrackNewWrapper(this);
}
@ -859,7 +859,7 @@ XPCWrappedNative::Destroy()
void
XPCWrappedNative::UpdateScriptableInfo(XPCNativeScriptableInfo *si)
{
NS_ASSERTION(mScriptableInfo, "UpdateScriptableInfo expects an existing scriptable info");
MOZ_ASSERT(mScriptableInfo, "UpdateScriptableInfo expects an existing scriptable info");
// Write barrier for incremental GC.
JSRuntime* rt = GetRuntime()->Runtime();
@ -872,7 +872,7 @@ XPCWrappedNative::UpdateScriptableInfo(XPCNativeScriptableInfo *si)
void
XPCWrappedNative::SetProto(XPCWrappedNativeProto* p)
{
NS_ASSERTION(!IsWrapperExpired(), "bad ptr!");
MOZ_ASSERT(!IsWrapperExpired(), "bad ptr!");
MOZ_ASSERT(HasProto());
@ -889,8 +889,8 @@ void
XPCWrappedNative::GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto)
{
NS_ASSERTION(classInfo, "bad param");
NS_ASSERTION(!sciProto.GetCallback(), "bad param");
MOZ_ASSERT(classInfo, "bad param");
MOZ_ASSERT(!sciProto.GetCallback(), "bad param");
nsXPCClassInfo *classInfoHelper = nullptr;
CallQueryInterface(classInfo, &classInfoHelper);
@ -925,7 +925,7 @@ XPCWrappedNative::GatherScriptableCreateInfo(nsISupports* obj,
XPCNativeScriptableCreateInfo& sciProto,
XPCNativeScriptableCreateInfo& sciWrapper)
{
NS_ASSERTION(!sciWrapper.GetCallback(), "bad param");
MOZ_ASSERT(!sciWrapper.GetCallback(), "bad param");
// Get the class scriptable helper (if present)
if (classInfo) {
@ -945,45 +945,45 @@ XPCWrappedNative::GatherScriptableCreateInfo(nsISupports* obj,
// A whole series of assertions to catch bad uses of scriptable flags on
// the siWrapper...
NS_ASSERTION(!(sciWrapper.GetFlags().WantPreCreate() &&
!sciProto.GetFlags().WantPreCreate()),
"Can't set WANT_PRECREATE on an instance scriptable "
"without also setting it on the class scriptable");
MOZ_ASSERT(!(sciWrapper.GetFlags().WantPreCreate() &&
!sciProto.GetFlags().WantPreCreate()),
"Can't set WANT_PRECREATE on an instance scriptable "
"without also setting it on the class scriptable");
NS_ASSERTION(!(sciWrapper.GetFlags().DontEnumStaticProps() &&
!sciProto.GetFlags().DontEnumStaticProps() &&
sciProto.GetCallback()),
"Can't set DONT_ENUM_STATIC_PROPS on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
MOZ_ASSERT(!(sciWrapper.GetFlags().DontEnumStaticProps() &&
!sciProto.GetFlags().DontEnumStaticProps() &&
sciProto.GetCallback()),
"Can't set DONT_ENUM_STATIC_PROPS on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().DontEnumQueryInterface() &&
!sciProto.GetFlags().DontEnumQueryInterface() &&
sciProto.GetCallback()),
"Can't set DONT_ENUM_QUERY_INTERFACE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
MOZ_ASSERT(!(sciWrapper.GetFlags().DontEnumQueryInterface() &&
!sciProto.GetFlags().DontEnumQueryInterface() &&
sciProto.GetCallback()),
"Can't set DONT_ENUM_QUERY_INTERFACE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().DontAskInstanceForScriptable() &&
!sciProto.GetFlags().DontAskInstanceForScriptable()),
"Can't set DONT_ASK_INSTANCE_FOR_SCRIPTABLE on an instance scriptable "
"without also setting it on the class scriptable");
MOZ_ASSERT(!(sciWrapper.GetFlags().DontAskInstanceForScriptable() &&
!sciProto.GetFlags().DontAskInstanceForScriptable()),
"Can't set DONT_ASK_INSTANCE_FOR_SCRIPTABLE on an instance scriptable "
"without also setting it on the class scriptable");
NS_ASSERTION(!(sciWrapper.GetFlags().ClassInfoInterfacesOnly() &&
!sciProto.GetFlags().ClassInfoInterfacesOnly() &&
sciProto.GetCallback()),
"Can't set CLASSINFO_INTERFACES_ONLY on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
MOZ_ASSERT(!(sciWrapper.GetFlags().ClassInfoInterfacesOnly() &&
!sciProto.GetFlags().ClassInfoInterfacesOnly() &&
sciProto.GetCallback()),
"Can't set CLASSINFO_INTERFACES_ONLY on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().AllowPropModsDuringResolve() &&
!sciProto.GetFlags().AllowPropModsDuringResolve() &&
sciProto.GetCallback()),
"Can't set ALLOW_PROP_MODS_DURING_RESOLVE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
MOZ_ASSERT(!(sciWrapper.GetFlags().AllowPropModsDuringResolve() &&
!sciProto.GetFlags().AllowPropModsDuringResolve() &&
sciProto.GetCallback()),
"Can't set ALLOW_PROP_MODS_DURING_RESOLVE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().AllowPropModsToPrototype() &&
!sciProto.GetFlags().AllowPropModsToPrototype() &&
sciProto.GetCallback()),
"Can't set ALLOW_PROP_MODS_TO_PROTOTYPE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
MOZ_ASSERT(!(sciWrapper.GetFlags().AllowPropModsToPrototype() &&
!sciProto.GetFlags().AllowPropModsToPrototype() &&
sciProto.GetCallback()),
"Can't set ALLOW_PROP_MODS_TO_PROTOTYPE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
return sciWrapper;
}
@ -1021,17 +1021,17 @@ XPCWrappedNative::Init(HandleObject parent,
// We should have the global jsclass flag if and only if we're a global.
MOZ_ASSERT_IF(si, !!si->GetFlags().IsGlobalObject() == !!(jsclazz->flags & JSCLASS_IS_GLOBAL));
NS_ASSERTION(jsclazz &&
jsclazz->name &&
jsclazz->flags &&
jsclazz->addProperty &&
jsclazz->delProperty &&
jsclazz->getProperty &&
jsclazz->setProperty &&
jsclazz->enumerate &&
jsclazz->resolve &&
jsclazz->convert &&
jsclazz->finalize, "bad class");
MOZ_ASSERT(jsclazz &&
jsclazz->name &&
jsclazz->flags &&
jsclazz->addProperty &&
jsclazz->delProperty &&
jsclazz->getProperty &&
jsclazz->setProperty &&
jsclazz->enumerate &&
jsclazz->resolve &&
jsclazz->convert &&
jsclazz->finalize, "bad class");
JSObject* protoJSObject = HasProto() ?
GetProto()->GetJSProtoObject() :
@ -1064,7 +1064,7 @@ XPCWrappedNative::FinishInit()
// This reference will be released when mFlatJSObject is finalized.
// Since this reference will push the refcount to 2 it will also root
// mFlatJSObject;
NS_ASSERTION(1 == mRefCnt, "unexpected refcount value");
MOZ_ASSERT(1 == mRefCnt, "unexpected refcount value");
NS_ADDREF(this);
if (mScriptableInfo && mScriptableInfo->GetFlags().WantCreate() &&
@ -1169,8 +1169,8 @@ XPCWrappedNative::FlatJSObjectFinalized()
if (obj) {
#ifdef XP_WIN
// Try to detect free'd pointer
NS_ASSERTION(*(int*)obj != 0xdddddddd, "bad pointer!");
NS_ASSERTION(*(int*)obj != 0, "bad pointer!");
MOZ_ASSERT(*(int*)obj != 0xdddddddd, "bad pointer!");
MOZ_ASSERT(*(int*)obj != 0, "bad pointer!");
#endif
XPCJSRuntime* rt = GetRuntime();
if (rt) {
@ -1193,11 +1193,11 @@ XPCWrappedNative::FlatJSObjectFinalized()
mFlatJSObject = nullptr;
mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID);
NS_ASSERTION(mIdentity, "bad pointer!");
MOZ_ASSERT(mIdentity, "bad pointer!");
#ifdef XP_WIN
// Try to detect free'd pointer
NS_ASSERTION(*(int*)mIdentity != 0xdddddddd, "bad pointer!");
NS_ASSERTION(*(int*)mIdentity != 0, "bad pointer!");
MOZ_ASSERT(*(int*)mIdentity != 0xdddddddd, "bad pointer!");
MOZ_ASSERT(*(int*)mIdentity != 0, "bad pointer!");
#endif
if (IsWrapperExpired()) {
@ -1321,7 +1321,7 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCWrappedNativeScope* aOldScope,
flat = cache->GetWrapper();
if (flat) {
wrapper = XPCWrappedNative::Get(flat);
NS_ASSERTION(wrapper->GetScope() == aOldScope,
MOZ_ASSERT(wrapper->GetScope() == aOldScope,
"Incorrect scope passed");
}
} else {
@ -1355,7 +1355,7 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCWrappedNativeScope* aOldScope,
// Cross-scope means cross-compartment.
MOZ_ASSERT(js::GetObjectCompartment(aOldScope->GetGlobalJSObject()) !=
js::GetObjectCompartment(aNewScope->GetGlobalJSObject()));
NS_ASSERTION(aNewParent, "won't be able to find the new parent");
MOZ_ASSERT(aNewParent, "won't be able to find the new parent");
if (wrapper->HasProto()) {
oldProto = wrapper->GetProto();
@ -1446,10 +1446,10 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCWrappedNativeScope* aOldScope,
// this stuff. So, if these don't match then the caller is
// doing something bad here.
NS_ASSERTION(oldProto->GetScriptableInfo()->GetScriptableShared() ==
newProto->GetScriptableInfo()->GetScriptableShared(),
"Changing proto is also changing JSObject Classname or "
"helper's nsIXPScriptable flags. This is not allowed!");
MOZ_ASSERT(oldProto->GetScriptableInfo()->GetScriptableShared() ==
newProto->GetScriptableInfo()->GetScriptableShared(),
"Changing proto is also changing JSObject Classname or "
"helper's nsIXPScriptable flags. This is not allowed!");
wrapper->UpdateScriptableInfo(newProto->GetScriptableInfo());
}
@ -1827,8 +1827,8 @@ XPCWrappedNative::InitTearOff(XPCWrappedNativeTearOff* aTearOff,
proto = jso->getProto();
NS_ASSERTION(proto && proto != our_proto,
"!!! xpconnect/xbl check - wrapper has no special proto");
MOZ_ASSERT(proto && proto != our_proto,
"!!! xpconnect/xbl check - wrapper has no special proto");
bool found_our_proto = false;
while (proto && !found_our_proto) {
@ -1837,8 +1837,8 @@ XPCWrappedNative::InitTearOff(XPCWrappedNativeTearOff* aTearOff,
found_our_proto = proto == our_proto;
}
NS_ASSERTION(found_our_proto,
"!!! xpconnect/xbl check - wrapper has extra proto");
MOZ_ASSERT(found_our_proto,
"!!! xpconnect/xbl check - wrapper has extra proto");
} else {
NS_WARNING("!!! xpconnect/xbl check - wrapper has no proto");
}
@ -2071,8 +2071,8 @@ bool
XPCWrappedNative::CallMethod(XPCCallContext& ccx,
CallMode mode /*= CALL_METHOD */)
{
NS_ASSERTION(ccx.GetXPCContext()->CallerTypeIsJavaScript(),
"Native caller for XPCWrappedNative::CallMethod?");
MOZ_ASSERT(ccx.GetXPCContext()->CallerTypeIsJavaScript(),
"Native caller for XPCWrappedNative::CallMethod?");
nsresult rv = ccx.CanCallNow();
if (NS_FAILED(rv)) {
@ -2266,8 +2266,8 @@ CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp)
if ((paramInfo.IsOut() || paramInfo.IsDipper()) &&
!paramInfo.IsRetval()) {
NS_ASSERTION(paramIndex < mArgc || paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
MOZ_ASSERT(paramIndex < mArgc || paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
jsval arg = paramIndex < mArgc ? mArgv[paramIndex] : JSVAL_NULL;
if (paramIndex < mArgc &&
(JSVAL_IS_PRIMITIVE(arg) ||
@ -2356,7 +2356,7 @@ CallMethodHelper::GatherAndConvertResults()
mCallContext.SetRetVal(v);
} else if (i < mArgc) {
// we actually assured this before doing the invoke
NS_ASSERTION(mArgv[i].isObject(), "out var is not object");
MOZ_ASSERT(mArgv[i].isObject(), "out var is not object");
if (!JS_SetPropertyById(mCallContext,
&mArgv[i].toObject(),
mIdxValueId, v)) {
@ -2364,8 +2364,8 @@ CallMethodHelper::GatherAndConvertResults()
return false;
}
} else {
NS_ASSERTION(paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
MOZ_ASSERT(paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
}
}
@ -2375,8 +2375,8 @@ CallMethodHelper::GatherAndConvertResults()
bool
CallMethodHelper::QueryInterfaceFastPath() const
{
NS_ASSERTION(mVTableIndex == 0,
"Using the QI fast-path for a method other than QueryInterface");
MOZ_ASSERT(mVTableIndex == 0,
"Using the QI fast-path for a method other than QueryInterface");
if (mArgc < 1) {
Throw(NS_ERROR_XPC_NOT_ENOUGH_ARGS, mCallContext);
@ -2511,7 +2511,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
uint8_t type_tag = type.TagPart();
nsXPTCVariant* dp = GetDispatchParam(i);
dp->type = type;
NS_ABORT_IF_FALSE(!paramInfo.IsShared(), "[shared] implies [noscript]!");
MOZ_ASSERT(!paramInfo.IsShared(), "[shared] implies [noscript]!");
// Handle dipper types separately.
if (paramInfo.IsDipper())
@ -2554,8 +2554,8 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
// so all that's left is 'in'.
if (!paramInfo.IsOut()) {
// Handle the 'in' case.
NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
MOZ_ASSERT(i < mArgc || paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
if (i < mArgc)
src = mArgv[i];
else if (type_tag == nsXPTType::T_JSVAL)
@ -2620,9 +2620,8 @@ CallMethodHelper::ConvertDependentParam(uint8_t i)
Throw(NS_ERROR_XPC_CANT_GET_ARRAY_INFO, mCallContext);
return false;
}
NS_ABORT_IF_FALSE(datum_type.TagPart() != nsXPTType::T_JSVAL,
"Arrays of JSVals not currently supported - "
"see bug 693337.");
MOZ_ASSERT(datum_type.TagPart() != nsXPTType::T_JSVAL,
"Arrays of JSVals not currently supported - see bug 693337.");
} else {
datum_type = type;
}
@ -2659,7 +2658,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i)
// so all that's left is 'in'.
if (!paramInfo.IsOut()) {
// Handle the 'in' case.
NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
MOZ_ASSERT(i < mArgc || paramInfo.IsOptional(),
"Expected either enough arguments or an optional argument");
src = i < mArgc ? mArgv[i] : JSVAL_NULL;
}
@ -2712,7 +2711,7 @@ void
CallMethodHelper::CleanupParam(nsXPTCMiniVariant& param, nsXPTType& type)
{
// We handle array elements, but not the arrays themselves.
NS_ABORT_IF_FALSE(type.TagPart() != nsXPTType::T_ARRAY, "Can't handle arrays.");
MOZ_ASSERT(type.TagPart() != nsXPTType::T_ARRAY, "Can't handle arrays.");
// Pointers may sometimes be null even if cleanup was requested. Combine
// the null checking for all the different types into one check here.
@ -2736,8 +2735,7 @@ CallMethodHelper::CleanupParam(nsXPTCMiniVariant& param, nsXPTType& type)
delete (nsCString*) param.val.p;
break;
default:
NS_ABORT_IF_FALSE(!type.IsArithmetic(),
"Cleanup requested on unexpected type.");
MOZ_ASSERT(!type.IsArithmetic(), "Cleanup requested on unexpected type.");
nsMemory::Free(param.val.p);
break;
}
@ -2772,15 +2770,15 @@ CallMethodHelper::HandleDipperParam(nsXPTCVariant* dp,
uint8_t type_tag = paramInfo.GetType().TagPart();
// Dippers always have the 'in' and 'dipper' flags set. Never 'out'.
NS_ABORT_IF_FALSE(!paramInfo.IsOut(), "Dipper has unexpected flags.");
MOZ_ASSERT(!paramInfo.IsOut(), "Dipper has unexpected flags.");
// xpidl.h specifies that dipper types will be used in exactly four
// cases, all strings. Verify that here.
NS_ABORT_IF_FALSE(type_tag == nsXPTType::T_ASTRING ||
type_tag == nsXPTType::T_DOMSTRING ||
type_tag == nsXPTType::T_UTF8STRING ||
type_tag == nsXPTType::T_CSTRING,
"Unexpected dipper type!");
MOZ_ASSERT(type_tag == nsXPTType::T_ASTRING ||
type_tag == nsXPTType::T_DOMSTRING ||
type_tag == nsXPTType::T_UTF8STRING ||
type_tag == nsXPTType::T_CSTRING,
"Unexpected dipper type!");
// ASTRING and DOMSTRING are very similar, and both use nsAutoString.
// UTF8_STRING and CSTRING are also quite similar, and both use nsCString.
@ -2853,7 +2851,7 @@ XPCWrappedNative::GetObjectPrincipal() const
equal = !objPrin->GetPrincipal();
else
principal->Equals(objPrin->GetPrincipal(), &equal);
NS_ASSERTION(equal, "Principal mismatch. Expect bad things to happen");
MOZ_ASSERT(equal, "Principal mismatch. Expect bad things to happen");
}
#endif
return principal;
@ -3185,7 +3183,7 @@ static bool InterfacesAreRelated(XPCNativeInterface* iface1,
nsIInterfaceInfo* info1 = iface1->GetInterfaceInfo();
nsIInterfaceInfo* info2 = iface2->GetInterfaceInfo();
NS_ASSERTION(info1 != info2, "should not have different iface!");
MOZ_ASSERT(info1 != info2, "should not have different iface!");
bool match;
@ -3249,7 +3247,7 @@ void DEBUG_ReportShadowedMembers(XPCNativeSet* set,
if (!(proto || wrapper) || !set || set->GetInterfaceCount() < 2)
return;
NS_ASSERTION(proto || wrapper, "bad param!");
MOZ_ASSERT(proto || wrapper, "bad param!");
XPCJSRuntime* rt = proto ? proto->GetRuntime() : wrapper->GetRuntime();
// a quicky hack to avoid reporting info for the same set too often

Просмотреть файл

@ -40,8 +40,7 @@ XPCNativeMember::NewFunctionObject(XPCCallContext& ccx,
XPCNativeInterface* iface, HandleObject parent,
jsval* pval)
{
NS_ASSERTION(!IsConstant(),
"Only call this if you're sure this is not a constant!");
MOZ_ASSERT(!IsConstant(), "Only call this if you're sure this is not a constant!");
return Resolve(ccx, iface, parent, pval);
}
@ -301,17 +300,17 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo)
jsid name = INTERNED_STRING_TO_JSID(cx, str);
if (info->IsSetter()) {
NS_ASSERTION(realTotalCount,"bad setter");
MOZ_ASSERT(realTotalCount,"bad setter");
// Note: ASSUMES Getter/Setter pairs are next to each other
// This is a rule of the typelib spec.
cur = &members[realTotalCount-1];
NS_ASSERTION(cur->GetName() == name,"bad setter");
NS_ASSERTION(cur->IsReadOnlyAttribute(),"bad setter");
NS_ASSERTION(cur->GetIndex() == i-1,"bad setter");
MOZ_ASSERT(cur->GetName() == name,"bad setter");
MOZ_ASSERT(cur->IsReadOnlyAttribute(),"bad setter");
MOZ_ASSERT(cur->GetIndex() == i-1,"bad setter");
cur->SetWritableAttribute();
} else {
// XXX need better way to find dups
// NS_ASSERTION(!LookupMemberByID(name),"duplicate method name");
// MOZ_ASSERT(!LookupMemberByID(name),"duplicate method name");
cur = &members[realTotalCount++];
cur->SetName(name);
if (info->IsGetter())
@ -338,7 +337,7 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo)
jsid name = INTERNED_STRING_TO_JSID(cx, str);
// XXX need better way to find dups
//NS_ASSERTION(!LookupMemberByID(name),"duplicate method/constant name");
//MOZ_ASSERT(!LookupMemberByID(name),"duplicate method/constant name");
cur = &members[realTotalCount++];
cur->SetName(name);
@ -494,7 +493,7 @@ XPCNativeSet::GetNewOrUsed(nsIClassInfo* classInfo)
iidCount = 0;
}
NS_ASSERTION((iidCount && iidArray) || !(iidCount || iidArray), "GetInterfaces returned bad array");
MOZ_ASSERT((iidCount && iidArray) || !(iidCount || iidArray), "GetInterfaces returned bad array");
// !!! from here on we only exit through the 'out' label !!!
@ -566,8 +565,8 @@ XPCNativeSet::GetNewOrUsed(nsIClassInfo* classInfo)
XPCNativeSet* set2 =
#endif
map->Add(classInfo, set);
NS_ASSERTION(set2, "failed to add our set!");
NS_ASSERTION(set2 == set, "hashtables inconsistent!");
MOZ_ASSERT(set2, "failed to add our set!");
MOZ_ASSERT(set2 == set, "hashtables inconsistent!");
}
out:

Просмотреть файл

@ -144,7 +144,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, unsigned argc, jsval *vp)
XPCWrappedNative* wrapper = ccx.GetWrapper();
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
NS_ASSERTION(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
MOZ_ASSERT(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
RootedObject realObject(cx, GetDoubleWrappedJSObject(ccx, wrapper));
if (!realObject) {
@ -404,7 +404,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
// else...
NS_ASSERTION(member->IsAttribute(), "way broken!");
MOZ_ASSERT(member->IsAttribute(), "way broken!");
propFlags |= JSPROP_GETTER | JSPROP_SHARED;
JSObject* funobj = JSVAL_TO_OBJECT(funval);
@ -944,7 +944,7 @@ XPC_WN_Helper_NewResolve(JSContext *cx, HandleObject obj, HandleId id, unsigned
}
old = ccx.SetResolveName(old);
NS_ASSERTION(old == id, "bad nest");
MOZ_ASSERT(old == id, "bad nest");
if (NS_FAILED(rv)) {
return Throw(rv, cx);
@ -1122,8 +1122,8 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, HandleObject obj)
XPCNativeScriptableInfo*
XPCNativeScriptableInfo::Construct(const XPCNativeScriptableCreateInfo* sci)
{
NS_ASSERTION(sci, "bad param");
NS_ASSERTION(sci->GetCallback(), "bad param");
MOZ_ASSERT(sci, "bad param");
MOZ_ASSERT(sci->GetCallback(), "bad param");
XPCNativeScriptableInfo* newObj =
new XPCNativeScriptableInfo(sci->GetCallback());
@ -1157,7 +1157,7 @@ XPCNativeScriptableInfo::Construct(const XPCNativeScriptableCreateInfo* sci)
void
XPCNativeScriptableShared::PopulateJSClass()
{
NS_ASSERTION(mJSClass.base.name, "bad state!");
MOZ_ASSERT(mJSClass.base.name, "bad state!");
mJSClass.base.flags = WRAPPER_SLOTS |
JSCLASS_PRIVATE_IS_NSISUPPORTS |
@ -1293,7 +1293,7 @@ FixUpThisIfBroken(JSObject *obj, JSObject *funobj)
bool
XPC_WN_CallMethod(JSContext *cx, unsigned argc, jsval *vp)
{
NS_ASSERTION(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
MOZ_ASSERT(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
RootedObject funobj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
@ -1318,7 +1318,7 @@ XPC_WN_CallMethod(JSContext *cx, unsigned argc, jsval *vp)
bool
XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp)
{
NS_ASSERTION(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
MOZ_ASSERT(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
RootedObject funobj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
@ -1355,11 +1355,11 @@ XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp)
static bool
XPC_WN_Shared_Proto_Enumerate(JSContext *cx, HandleObject obj)
{
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
MOZ_ASSERT(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
if (!self)
@ -1416,9 +1416,9 @@ XPC_WN_Shared_Proto_Trace(JSTracer *trc, JSObject *obj)
static bool
XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, HandleObject obj, HandleId id)
{
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass,
"bad proto");
MOZ_ASSERT(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
@ -1496,9 +1496,9 @@ static bool
XPC_WN_OnlyIWrite_Proto_AddPropertyStub(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp)
{
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
MOZ_ASSERT(js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
@ -1526,9 +1526,9 @@ XPC_WN_OnlyIWrite_Proto_SetPropertyStub(JSContext *cx, HandleObject obj, HandleI
static bool
XPC_WN_NoMods_Proto_Resolve(JSContext *cx, HandleObject obj, HandleId id)
{
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
MOZ_ASSERT(js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);

Просмотреть файл

@ -41,7 +41,7 @@ XPCWrappedNativeProto::XPCWrappedNativeProto(XPCWrappedNativeScope* Scope,
XPCWrappedNativeProto::~XPCWrappedNativeProto()
{
NS_ASSERTION(!mJSProtoObject, "JSProtoObject still alive");
MOZ_ASSERT(!mJSProtoObject, "JSProtoObject still alive");
MOZ_COUNT_DTOR(XPCWrappedNativeProto);
@ -133,7 +133,7 @@ XPCWrappedNativeProto::CallPostCreatePrototype()
void
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp *fop, JSObject *obj)
{
NS_ASSERTION(obj == mJSProtoObject, "huh?");
MOZ_ASSERT(obj == mJSProtoObject, "huh?");
// Map locking is not necessary since we are running gc.
@ -179,8 +179,8 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
bool callPostCreatePrototype)
{
AutoJSContext cx;
NS_ASSERTION(scope, "bad param");
NS_ASSERTION(classInfo, "bad param");
MOZ_ASSERT(scope, "bad param");
MOZ_ASSERT(classInfo, "bad param");
AutoMarkingWrappedNativeProtoPtr proto(cx);
ClassInfo2WrappedNativeProtoMap* map = nullptr;

Просмотреть файл

@ -294,17 +294,17 @@ XPCWrappedNativeScope::~XPCWrappedNativeScope()
// We can do additional cleanup assertions here...
if (mWrappedNativeMap) {
NS_ASSERTION(0 == mWrappedNativeMap->Count(), "scope has non-empty map");
MOZ_ASSERT(0 == mWrappedNativeMap->Count(), "scope has non-empty map");
delete mWrappedNativeMap;
}
if (mWrappedNativeProtoMap) {
NS_ASSERTION(0 == mWrappedNativeProtoMap->Count(), "scope has non-empty map");
MOZ_ASSERT(0 == mWrappedNativeProtoMap->Count(), "scope has non-empty map");
delete mWrappedNativeProtoMap;
}
if (mMainThreadWrappedNativeProtoMap) {
NS_ASSERTION(0 == mMainThreadWrappedNativeProtoMap->Count(), "scope has non-empty map");
MOZ_ASSERT(0 == mMainThreadWrappedNativeProtoMap->Count(), "scope has non-empty map");
delete mMainThreadWrappedNativeProtoMap;
}
@ -405,8 +405,7 @@ XPCWrappedNativeScope::StartFinalizationPhaseOfGC(JSFreeOp *fop, XPCJSRuntime* r
// We are in JSGC_MARK_END and JSGC_FINALIZE_END must always follow it
// calling FinishedFinalizationPhaseOfGC and clearing gDyingScopes in
// KillDyingScopes.
NS_ASSERTION(gDyingScopes == nullptr,
"JSGC_MARK_END without JSGC_FINALIZE_END");
MOZ_ASSERT(!gDyingScopes, "JSGC_MARK_END without JSGC_FINALIZE_END");
XPCWrappedNativeScope* prev = nullptr;
XPCWrappedNativeScope* cur = gScopes;

Просмотреть файл

@ -364,8 +364,8 @@ inline nsresult UnexpectedFailure(nsresult rv)
NS_IMETHODIMP
nsXPConnect::InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aGlobalJSObj, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aGlobalJSObj, "bad param");
RootedObject globalJSObj(aJSContext, aGlobalJSObj);
JSAutoCompartment ac(aJSContext, globalJSObj);
@ -465,7 +465,7 @@ CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
// Sandboxes and compilation scopes are exceptions. See bug 744034.
CheckTypeInference(cx, clasp, principal);
NS_ABORT_IF_FALSE(NS_IsMainThread(), "using a principal off the main thread?");
MOZ_ASSERT(NS_IsMainThread(), "using a principal off the main thread?");
MOZ_ASSERT(principal);
RootedObject global(cx,
@ -488,7 +488,7 @@ CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
JS_TracerInit(&trc.base, JS_GetRuntime(cx), VerifyTraceXPCGlobalCalled);
trc.ok = false;
JS_TraceChildren(&trc.base, global, JSTRACE_OBJECT);
NS_ABORT_IF_FALSE(trc.ok, "Trace hook on global needs to call TraceXPCGlobal for XPConnect compartments.");
MOZ_ASSERT(trc.ok, "Trace hook on global needs to call TraceXPCGlobal for XPConnect compartments.");
}
#endif
@ -509,9 +509,9 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
JS::CompartmentOptions& aOptions,
nsIXPConnectJSObjectHolder **_retval)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aCOMObj, "bad param");
NS_ASSERTION(_retval, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aCOMObj, "bad param");
MOZ_ASSERT(_retval, "bad param");
// We pass null for the 'extra' pointer during global object creation, so
// we need to have a principal.
@ -582,11 +582,8 @@ NativeInterface2JSObject(HandleObject aScope,
nullptr, aAllowWrapping, &rv))
return rv;
#ifdef DEBUG
NS_ASSERTION(aAllowWrapping ||
!xpc::WrapperFactory::IsXrayWrapper(JSVAL_TO_OBJECT(*aVal)),
"Shouldn't be returning a xray wrapper here");
#endif
MOZ_ASSERT(aAllowWrapping || !xpc::WrapperFactory::IsXrayWrapper(JSVAL_TO_OBJECT(*aVal)),
"Shouldn't be returning a xray wrapper here");
return NS_OK;
}
@ -599,10 +596,10 @@ nsXPConnect::WrapNative(JSContext * aJSContext,
const nsIID & aIID,
nsIXPConnectJSObjectHolder **aHolder)
{
NS_ASSERTION(aHolder, "bad param");
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aScopeArg, "bad param");
NS_ASSERTION(aCOMObj, "bad param");
MOZ_ASSERT(aHolder, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aScopeArg, "bad param");
MOZ_ASSERT(aCOMObj, "bad param");
RootedObject aScope(aJSContext, aScopeArg);
RootedValue v(aJSContext);
@ -621,9 +618,9 @@ nsXPConnect::WrapNativeToJSVal(JSContext * aJSContext,
jsval *aVal,
nsIXPConnectJSObjectHolder **aHolder)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aScopeArg, "bad param");
NS_ASSERTION(aCOMObj, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aScopeArg, "bad param");
MOZ_ASSERT(aCOMObj, "bad param");
if (aHolder)
*aHolder = nullptr;
@ -641,9 +638,9 @@ nsXPConnect::WrapJS(JSContext * aJSContext,
const nsIID & aIID,
void * *result)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aJSObjArg, "bad param");
NS_ASSERTION(result, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aJSObjArg, "bad param");
MOZ_ASSERT(result, "bad param");
*result = nullptr;
@ -679,10 +676,10 @@ nsXPConnect::WrapJSAggregatedToNative(nsISupports *aOuter,
const nsIID & aIID,
void * *result)
{
NS_ASSERTION(aOuter, "bad param");
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aJSObjArg, "bad param");
NS_ASSERTION(result, "bad param");
MOZ_ASSERT(aOuter, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aJSObjArg, "bad param");
MOZ_ASSERT(result, "bad param");
*result = nullptr;
@ -700,9 +697,9 @@ nsXPConnect::GetWrappedNativeOfJSObject(JSContext * aJSContext,
JSObject * aJSObjArg,
nsIXPConnectWrappedNative **_retval)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aJSObjArg, "bad param");
NS_ASSERTION(_retval, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aJSObjArg, "bad param");
MOZ_ASSERT(_retval, "bad param");
RootedObject aJSObj(aJSContext, aJSObjArg);
aJSObj = js::CheckedUnwrap(aJSObj, /* stopAtOuter = */ false);
@ -721,8 +718,8 @@ NS_IMETHODIMP_(nsISupports*)
nsXPConnect::GetNativeOfWrapper(JSContext * aJSContext,
JSObject * aJSObj)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aJSObj, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aJSObj, "bad param");
aJSObj = js::CheckedUnwrap(aJSObj, /* stopAtOuter = */ false);
if (!aJSObj) {
@ -748,10 +745,10 @@ nsXPConnect::GetWrappedNativeOfNativeObject(JSContext * aJSContext,
const nsIID & aIID,
nsIXPConnectWrappedNative **_retval)
{
NS_ASSERTION(aJSContext, "bad param");
NS_ASSERTION(aScopeArg, "bad param");
NS_ASSERTION(aCOMObj, "bad param");
NS_ASSERTION(_retval, "bad param");
MOZ_ASSERT(aJSContext, "bad param");
MOZ_ASSERT(aScopeArg, "bad param");
MOZ_ASSERT(aCOMObj, "bad param");
MOZ_ASSERT(_retval, "bad param");
*_retval = nullptr;
@ -870,7 +867,7 @@ nsXPConnect::CreateStackFrameLocation(uint32_t aLanguage,
nsIStackFrame *aCaller,
nsIStackFrame **_retval)
{
NS_ASSERTION(_retval, "bad param");
MOZ_ASSERT(_retval, "bad param");
return XPCJSStack::CreateStackFrameLocation(aLanguage,
aFilename,
@ -884,7 +881,7 @@ nsXPConnect::CreateStackFrameLocation(uint32_t aLanguage,
NS_IMETHODIMP
nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
{
NS_ASSERTION(aCurrentJSStack, "bad param");
MOZ_ASSERT(aCurrentJSStack, "bad param");
*aCurrentJSStack = nullptr;
// is there a current context available?
@ -912,7 +909,7 @@ nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
NS_IMETHODIMP
nsXPConnect::GetCurrentNativeCallContext(nsAXPCNativeCallContext * *aCurrentNativeCallContext)
{
NS_ASSERTION(aCurrentNativeCallContext, "bad param");
MOZ_ASSERT(aCurrentNativeCallContext, "bad param");
*aCurrentNativeCallContext = XPCJSRuntime::Get()->GetCallContext();
return NS_OK;
@ -949,8 +946,8 @@ nsXPConnect::CreateSandbox(JSContext *cx, nsIPrincipal *principal,
SandboxOptions options(cx);
nsresult rv = xpc_CreateSandboxObject(cx, rval.address(), principal, options);
NS_ASSERTION(NS_FAILED(rv) || !JSVAL_IS_PRIMITIVE(rval),
"Bad return value from xpc_CreateSandboxObject()!");
MOZ_ASSERT(NS_FAILED(rv) || !JSVAL_IS_PRIMITIVE(rval),
"Bad return value from xpc_CreateSandboxObject()!");
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(rval)) {
*_retval = XPCJSObjectHolder::newHolder(JSVAL_TO_OBJECT(rval));
@ -1363,7 +1360,7 @@ IsJSContextOnStack(JSContext *aCx)
nsIPrincipal*
nsXPConnect::GetPrincipal(JSObject* obj, bool allowShortCircuit) const
{
NS_ASSERTION(IS_WN_REFLECTOR(obj), "What kind of wrapper is this?");
MOZ_ASSERT(IS_WN_REFLECTOR(obj), "What kind of wrapper is this?");
XPCWrappedNative *xpcWrapper = XPCWrappedNative::Get(obj);
if (xpcWrapper) {

Просмотреть файл

@ -963,9 +963,9 @@ def writeQuickStub(f, customMethodCalls, stringtable, member, stubName,
checkSuccess = "NS_SUCCEEDED(debug_rv)"
if canFail:
checkSuccess += " == NS_SUCCEEDED(rv)"
f.write(" NS_ASSERTION(%s && "
f.write(" MOZ_ASSERT(%s && "
"xpc_qsSameResult(debug_result, result),\n"
" \"Got the wrong answer from the custom "
" \"Got the wrong answer from the custom "
"method call!\");\n" % checkSuccess)
f.write("#endif\n")

Просмотреть файл

@ -53,7 +53,7 @@ public:
already_AddRefed<nsISupports> forgetCanonical()
{
NS_ASSERTION(mCanonical, "Huh, no canonical to forget?");
MOZ_ASSERT(mCanonical, "Huh, no canonical to forget?");
if (!mCanonicalStrong)
mCanonicalStrong = mCanonical;

Просмотреть файл

@ -311,13 +311,13 @@ typedef mozilla::ReentrantMonitor XPCLock;
static inline void xpc_Wait(XPCLock* lock)
{
NS_ASSERTION(lock, "xpc_Wait called with null lock!");
MOZ_ASSERT(lock, "xpc_Wait called with null lock!");
lock->Wait();
}
static inline void xpc_NotifyAll(XPCLock* lock)
{
NS_ASSERTION(lock, "xpc_NotifyAll called with null lock!");
MOZ_ASSERT(lock, "xpc_NotifyAll called with null lock!");
lock->NotifyAll();
}
@ -550,8 +550,8 @@ public:
~XPCRootSetElem()
{
NS_ASSERTION(!mNext, "Must be unlinked");
NS_ASSERTION(!mSelfp, "Must be unlinked");
MOZ_ASSERT(!mNext, "Must be unlinked");
MOZ_ASSERT(!mSelfp, "Must be unlinked");
}
inline XPCRootSetElem* GetNextRoot() { return mNext; }
@ -586,7 +586,7 @@ public:
if (!chars)
return false;
NS_ASSERTION(IsEmpty(), "init() on initialized string");
MOZ_ASSERT(IsEmpty(), "init() on initialized string");
new(static_cast<nsDependentString *>(this)) nsDependentString(chars, length);
return true;
}
@ -711,17 +711,17 @@ public:
jsid GetStringID(unsigned index) const
{
NS_ASSERTION(index < IDX_TOTAL_COUNT, "index out of range");
MOZ_ASSERT(index < IDX_TOTAL_COUNT, "index out of range");
return mStrIDs[index];
}
jsval GetStringJSVal(unsigned index) const
{
NS_ASSERTION(index < IDX_TOTAL_COUNT, "index out of range");
MOZ_ASSERT(index < IDX_TOTAL_COUNT, "index out of range");
return mStrJSVals[index];
}
const char* GetStringName(unsigned index) const
{
NS_ASSERTION(index < IDX_TOTAL_COUNT, "index out of range");
MOZ_ASSERT(index < IDX_TOTAL_COUNT, "index out of range");
return mStrings[index];
}
@ -918,7 +918,7 @@ class XPCContext
public:
static XPCContext* GetXPCContext(JSContext* aJSContext)
{
NS_ASSERTION(JS_GetSecondContextPrivate(aJSContext), "should already have XPCContext");
MOZ_ASSERT(JS_GetSecondContextPrivate(aJSContext), "should already have XPCContext");
return static_cast<XPCContext *>(JS_GetSecondContextPrivate(aJSContext));
}
@ -1123,7 +1123,7 @@ private:
};
#ifdef DEBUG
inline void CHECK_STATE(int s) const {NS_ASSERTION(mState >= s, "bad state");}
inline void CHECK_STATE(int s) const {MOZ_ASSERT(mState >= s, "bad state");}
#else
#define CHECK_STATE(s) ((void)0)
#endif
@ -1502,8 +1502,8 @@ public:
bool GetConstantValue(XPCCallContext& ccx, XPCNativeInterface* iface,
jsval* pval)
{NS_ASSERTION(IsConstant(),
"Only call this if you're sure this is a constant!");
{MOZ_ASSERT(IsConstant(),
"Only call this if you're sure this is a constant!");
return Resolve(ccx, iface, JS::NullPtr(), pval);}
bool NewFunctionObject(XPCCallContext& ccx, XPCNativeInterface* iface,
@ -1537,7 +1537,7 @@ public:
{mFlags = GETTER; mIndex = index;}
void SetWritableAttribute()
{NS_ASSERTION(mFlags == GETTER,"bad"); mFlags = GETTER | SETTER_TOO;}
{MOZ_ASSERT(mFlags == GETTER,"bad"); mFlags = GETTER | SETTER_TOO;}
/* default ctor - leave random contents */
XPCNativeMember() {MOZ_COUNT_CTOR(XPCNativeMember);}
@ -1588,7 +1588,7 @@ class XPCNativeInterface
return mMemberCount;
}
XPCNativeMember* GetMemberAt(uint16_t i) {
NS_ASSERTION(i < mMemberCount, "bad index");
MOZ_ASSERT(i < mMemberCount, "bad index");
return &mMembers[i];
}
@ -1748,7 +1748,7 @@ class XPCNativeSet
}
XPCNativeInterface* GetInterfaceAt(uint16_t i)
{NS_ASSERTION(i < mInterfaceCount, "bad index"); return mInterfaces[i];}
{MOZ_ASSERT(i < mInterfaceCount, "bad index"); return mInterfaces[i];}
inline bool MatchesSetUpToInterface(const XPCNativeSet* other,
XPCNativeInterface* iface) const;
@ -2094,7 +2094,7 @@ public:
{return ClassIsThreadSafe() ? GetRuntime()->GetMapLock() : nullptr;}
void SetScriptableInfo(XPCNativeScriptableInfo* si)
{NS_ASSERTION(!mScriptableInfo, "leak here!"); mScriptableInfo = si;}
{MOZ_ASSERT(!mScriptableInfo, "leak here!"); mScriptableInfo = si;}
bool CallPostCreatePrototype();
void JSProtoObjectFinalized(js::FreeOp *fop, JSObject *obj);
@ -2293,7 +2293,7 @@ public:
static inline XPCWrappedNativeScope*
TagScope(XPCWrappedNativeScope* s)
{NS_ASSERTION(!IsTaggedScope(s), "bad pointer!");
{MOZ_ASSERT(!IsTaggedScope(s), "bad pointer!");
return (XPCWrappedNativeScope*)(XPC_SCOPE_WORD(s) | XPC_SCOPE_TAG);}
static inline XPCWrappedNativeScope*
@ -3110,7 +3110,7 @@ public:
bool InitWithName(const nsID& id, const char *nameString);
bool SetName(const char* name);
void SetNameToNoString()
{NS_ASSERTION(!mName, "name already set"); mName = gNoString;}
{MOZ_ASSERT(!mName, "name already set"); mName = gNoString;}
bool NameIsSet() const {return nullptr != mName;}
const nsID& ID() const {return mID;}
bool IsValid() const {return !mID.Equals(GetInvalidIID());}
@ -3418,7 +3418,7 @@ public:
jsid old =
#endif
XPCJSRuntime::Get()->SetResolveName(mOld);
NS_ASSERTION(old == mCheck, "Bad Nesting!");
MOZ_ASSERT(old == mCheck, "Bad Nesting!");
}
private:

Просмотреть файл

@ -237,7 +237,7 @@ AccessCheck::isCrossOriginAccessPermitted(JSContext *cx, JSObject *wrapperArg, j
const char *name;
js::Class *clasp = js::GetObjectClass(obj);
NS_ASSERTION(Jsvalify(clasp) != &XrayUtils::HolderClass, "shouldn't have a holder here");
MOZ_ASSERT(Jsvalify(clasp) != &XrayUtils::HolderClass, "shouldn't have a holder here");
if (clasp->ext.innerObject)
name = "Window";
else

Просмотреть файл

@ -295,7 +295,7 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope,
NS_ENSURE_SUCCESS(rv, nullptr);
obj = JSVAL_TO_OBJECT(v);
NS_ASSERTION(IS_WN_REFLECTOR(obj), "bad object");
MOZ_ASSERT(IS_WN_REFLECTOR(obj), "bad object");
// Because the underlying native didn't have a PreCreate hook, we had
// to a new (or possibly pre-existing) XPCWN in our compartment.

Просмотреть файл

@ -1035,8 +1035,7 @@ DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper,
if (!XrayResolveNativeProperty(cx, wrapper, obj, id, desc))
return false;
NS_ASSERTION(!desc.object() || desc.object() == wrapper,
"What did we resolve this on?");
MOZ_ASSERT(!desc.object() || desc.object() == wrapper, "What did we resolve this on?");
return true;
}
@ -1056,8 +1055,7 @@ DOMXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObjec
if (!XrayResolveOwnProperty(cx, wrapper, obj, id, desc, flags))
return false;
NS_ASSERTION(!desc.object() || desc.object() == wrapper,
"What did we resolve this on?");
MOZ_ASSERT(!desc.object() || desc.object() == wrapper, "What did we resolve this on?");
return true;
}
@ -1170,11 +1168,11 @@ namespace XrayUtils {
JSObject *
GetNativePropertiesObject(JSContext *cx, JSObject *wrapper)
{
NS_ASSERTION(js::IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper),
"bad object passed in");
MOZ_ASSERT(js::IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper),
"bad object passed in");
JSObject *holder = GetHolder(wrapper);
NS_ASSERTION(holder, "uninitialized wrapper being used?");
MOZ_ASSERT(holder, "uninitialized wrapper being used?");
return holder;
}