Bug 903849 - Use MOZ_ASSERT consistently in XPConnect; r=bholley
authorMs2ger <ms2ger@gmail.com>
Wed, 14 Aug 2013 09:00:34 +0200
changeset 142937 b05548b721dfff31bc77628943dbb7479269316b
parent 142936 0fc783d3cd639e6226e961b80ae9d5324472e072
child 142938 6d18692b08785b5aa328ccb70d178c8fb7dc5519
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbholley
bugs903849
milestone26.0a1
Bug 903849 - Use MOZ_ASSERT consistently in XPConnect; r=bholley
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/public/nsAutoJSValHolder.h
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/src/XPCCallContext.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCContext.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCInlines.h
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCLocale.cpp
js/xpconnect/src/XPCMaps.cpp
js/xpconnect/src/XPCMaps.h
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCVariant.cpp
js/xpconnect/src/XPCWrappedJS.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeInfo.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/XPCWrappedNativeProto.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/qsgen.py
js/xpconnect/src/xpcObjectHelper.h
js/xpconnect/src/xpcprivate.h
js/xpconnect/wrappers/AccessCheck.cpp
js/xpconnect/wrappers/WrapperFactory.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -194,17 +194,17 @@ File(JSContext *cx, unsigned argc, Value
     nsCOMPtr<nsISupports> native;
     nsresult rv = nsDOMMultipartFile::NewFile(getter_AddRefs(native));
     if (NS_FAILED(rv)) {
         XPCThrower::Throw(rv, cx);
         return false;
     }
 
     nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
-    NS_ASSERTION(initializer, "what?");
+    MOZ_ASSERT(initializer);
 
     rv = initializer->Initialize(nullptr, cx, nullptr, args);
     if (NS_FAILED(rv)) {
         XPCThrower::Throw(rv, cx);
         return false;
     }
 
     nsXPConnect* xpc = nsXPConnect::XPConnect();
@@ -229,17 +229,17 @@ Blob(JSContext *cx, unsigned argc, Value
     nsCOMPtr<nsISupports> native;
     nsresult rv = nsDOMMultipartFile::NewBlob(getter_AddRefs(native));
     if (NS_FAILED(rv)) {
         XPCThrower::Throw(rv, cx);
         return false;
     }
 
     nsCOMPtr<nsIJSNativeInitializer> initializer = do_QueryInterface(native);
-    NS_ASSERTION(initializer, "what?");
+    MOZ_ASSERT(initializer);
 
     rv = initializer->Initialize(nullptr, cx, nullptr, args);
     if (NS_FAILED(rv)) {
         XPCThrower::Throw(rv, cx);
         return false;
     }
 
     nsXPConnect* xpc = nsXPConnect::XPConnect();
@@ -342,17 +342,17 @@ ReportOnCaller(JSCLContextHelper &helper
 }
 
 mozJSComponentLoader::mozJSComponentLoader()
     : mRuntime(nullptr),
       mContext(nullptr),
       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) {
         gJSCLLog = PR_NewLogModule("JSComponentLoader");
     }
 #endif
 
     sSelf = this;
@@ -1267,17 +1267,17 @@ mozJSComponentLoader::ImportInto(const n
         // about:memory may use that information
         if (!mReuseLoaderGlobal) {
             xpc::SetLocationForGlobal(newEntry->obj, 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) {
         JSCLContextHelper cxhelper(mContext);
         JSAutoCompartment ac(mContext, mod->obj);
 
         RootedValue symbols(mContext);
         if (!JS_GetProperty(mContext, mod->obj,
@@ -1412,17 +1412,17 @@ mozJSComponentLoader::Observe(nsISupport
     return NS_OK;
 }
 
 /* static */ already_AddRefed<nsIFactory>
 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));
     if (NS_FAILED(rv))
         return nullptr;
 
     return f.forget();
 }
@@ -1449,11 +1449,11 @@ JSCLContextHelper::~JSCLContextHelper()
     if (mBuf) {
         JS_smprintf_free(mBuf);
     }
 }
 
 void
 JSCLContextHelper::reportErrorAfterPop(char *buf)
 {
-    NS_ASSERTION(!mBuf, "Already called reportErrorAfterPop");
+    MOZ_ASSERT(!mBuf, "Already called reportErrorAfterPop");
     mBuf = buf;
 }
--- a/js/xpconnect/public/nsAutoJSValHolder.h
+++ b/js/xpconnect/public/nsAutoJSValHolder.h
@@ -120,17 +120,17 @@ public:
 
   nsAutoJSValHolder &operator=(JSObject* aOther) {
     return *this = OBJECT_TO_JSVAL(aOther);
   }
 
   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;
     return *this;
   }
 
 private:
   jsval mVal;
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -742,17 +742,17 @@ Blob(JSContext *cx, unsigned argc, jsval
   nsCOMPtr<nsISupports> native =
     do_CreateInstance("@mozilla.org/dom/multipart-blob;1");
   if (!native) {
     JS_ReportError(cx, "Could not create native object!");
     return false;
   }
 
   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)) {
     JS_ReportError(cx, "Could not initialize native object!");
     return false;
   }
 
   nsCOMPtr<nsIXPConnect> xpc = do_GetService(kXPConnectServiceContractID, &rv);
@@ -781,17 +781,17 @@ File(JSContext *cx, unsigned argc, jsval
   nsCOMPtr<nsISupports> native =
     do_CreateInstance("@mozilla.org/dom/multipart-file;1");
   if (!native) {
     JS_ReportError(cx, "Could not create native object!");
     return false;
   }
 
   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)) {
     JS_ReportError(cx, "Could not initialize native object!");
     return false;
   }
 
   nsCOMPtr<nsIXPConnect> xpc = do_GetService(kXPConnectServiceContractID, &rv);
@@ -1679,17 +1679,17 @@ main(int argc, char **argv, char **envp)
                     JS_HoldPrincipals(gJSPrincipals);
                 }
             } else {
                 fprintf(gErrFile, "+++ Failed to get ScriptSecurityManager service, running without principals");
             }
         }
 
         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);
 
 #ifdef TEST_TranslateThis
         nsCOMPtr<nsIXPCFunctionThisTranslator>
             translator(new nsXPCFunctionThisTranslator);
         xpc->SetFunctionThisTranslator(NS_GET_IID(nsITestXPCFunctionCallback), translator);
 #endif
@@ -1775,17 +1775,17 @@ main(int argc, char **argv, char **envp)
     // Get the crashreporter service while XPCOM is still active.
     // This is a special exception: it will remain usable after NS_ShutdownXPCOM().
     nsCOMPtr<nsICrashReporter> crashReporter =
         do_GetService("@mozilla.org/toolkit/crash-reporter;1");
 #endif
 
     // 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)
     JSContext* bogusCX;
     bogus->Peek(&bogusCX);
     bogus = nullptr;
 #endif
 
--- a/js/xpconnect/src/XPCCallContext.cpp
+++ b/js/xpconnect/src/XPCCallContext.cpp
@@ -34,17 +34,16 @@ XPCCallContext::XPCCallContext(XPCContex
         mCallerLanguage(callerLanguage),
         mFlattenedJSObject(cx),
         mWrapper(nullptr),
         mTearOff(nullptr),
         mName(cx)
 {
     MOZ_ASSERT(cx);
 
-    NS_ASSERTION(mJSContext, "No JSContext supplied to XPCCallContext");
     if (!mXPC)
         return;
 
     mXPCContext = XPCContext::GetXPCContext(mJSContext);
     mPrevCallerLanguage = mXPCContext->SetCallingLangType(mCallerLanguage);
 
     // hook into call context chain.
     mPrevCallContext = XPCJSRuntime::Get()->SetCallContext(this);
@@ -82,17 +81,17 @@ XPCCallContext::XPCCallContext(XPCContex
     if (mWrapper) {
         mFlattenedJSObject = mWrapper->GetFlatJSObject();
 
         if (mTearOff)
             mScriptableInfo = nullptr;
         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))
         SetName(name);
 
     if (argc != NO_ARGS)
         SetArgsAndResultPtr(argc, argv, rval);
 
@@ -235,17 +234,17 @@ XPCCallContext::SystemIsBeingShutDown()
 }
 
 XPCCallContext::~XPCCallContext()
 {
     if (mXPCContext) {
         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");
     }
 }
 
 /* readonly attribute nsISupports Callee; */
 NS_IMETHODIMP
 XPCCallContext::GetCallee(nsISupports * *aCallee)
 {
     nsISupports* temp = mWrapper ? mWrapper->GetIdentityObject() : nullptr;
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -3256,18 +3256,17 @@ xpc_CreateSandboxObject(JSContext *cx, j
 
     nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(prinOrSop);
     if (!principal) {
         nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(prinOrSop);
         if (sop) {
             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)) {
                     rv = NS_ERROR_FAILURE;
                 }
 
                 return rv;
             }
@@ -3855,17 +3854,17 @@ xpc_EvalInSandbox(JSContext *cx, HandleO
     bool waiveXray = xpc::WrapperFactory::HasWaiveXrayFlag(sandboxArg);
     RootedObject sandbox(cx, js::CheckedUnwrap(sandboxArg));
     if (!sandbox || js::GetObjectJSClass(sandbox) != &SandboxClass) {
         return NS_ERROR_INVALID_ARG;
     }
 
     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);
 
     nsAutoCString filenameBuf;
     if (!filename) {
         // Default to the spec of the principal.
         nsJSPrincipals::get(prin)->GetScriptLocation(filenameBuf);
         filename = filenameBuf.get();
@@ -4206,17 +4205,17 @@ nsXPCComponents_Utils::CreateDateIn(cons
 }
 
 bool
 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) {
         return false;
     }
     return JS_CallFunctionValue(cx, obj, v, args.length(), args.array(), vp);
 }
 
@@ -4730,17 +4729,17 @@ nsXPCComponents::GetStack(nsIStackFrame 
     nsXPConnect* xpc = nsXPConnect::XPConnect();
     rv = xpc->GetCurrentJSStack(aStack);
     return rv;
 }
 
 NS_IMETHODIMP
 nsXPCComponents::GetManager(nsIComponentManager * *aManager)
 {
-    NS_ASSERTION(aManager, "bad param");
+    MOZ_ASSERT(aManager, "bad param");
     return NS_GetComponentManager(aManager);
 }
 
 /**********************************************/
 
 // The nsIXPCScriptable map declaration that will generate stubs for us...
 #define XPC_MAP_CLASSNAME           nsXPCComponents
 #define XPC_MAP_QUOTED_CLASSNAME   "nsXPCComponents"
--- a/js/xpconnect/src/XPCContext.cpp
+++ b/js/xpconnect/src/XPCContext.cpp
@@ -20,24 +20,24 @@ XPCContext::XPCContext(XPCJSRuntime* aRu
         mPendingResult(NS_OK),
         mException(nullptr),
         mCallingLangType(LANG_UNKNOWN)
 {
     MOZ_COUNT_CTOR(XPCContext);
 
     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);
 
     // Iterate over our scopes and tell them that we have been destroyed
     for (PRCList *scopeptr = PR_NEXT_LINK(&mScopes);
          scopeptr != &mScopes;
          scopeptr = PR_NEXT_LINK(scopeptr)) {
         XPCWrappedNativeScope *scope =
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -77,17 +77,17 @@ UnwrapNativeCPOW(nsISupports* wrapper)
 
 /***************************************************************************/
 
 // static
 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)) {
         *iface = (nsISupports*) xpc_GetJSPrivate(obj);
         return true;
     }
     *iface = UnwrapDOMObjectToISupports(obj);
     return !!*iface;
@@ -129,17 +129,17 @@ XPCConvert::NativeData2JS(jsval* d, cons
         }
     case nsXPTType::T_CHAR  :
         {
             char* p = (char*)s;
             if (!p)
                 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;
             if (!(str = JS_NewStringCopyN(cx, p, 1)))
                 return false;
             *d = STRING_TO_JSVAL(str);
             break;
         }
@@ -220,17 +220,17 @@ XPCConvert::NativeData2JS(jsval* d, cons
 
 #ifdef STRICT_CHECK_OF_UNICODE
                 bool isAscii = true;
                 char* t;
                 for (t=p; *t && isAscii ; t++) {
                   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)))
                     return false;
                 *d = STRING_TO_JSVAL(str);
                 break;
             }
 
@@ -331,18 +331,18 @@ XPCConvert::NativeData2JS(jsval* d, cons
                     xpcObjectHelper helper(iface);
                     if (!NativeInterface2JSObject(d, nullptr, helper, iid,
                                                   nullptr, true, pErr))
                         return false;
 
 #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;
             }
 
         default:
             NS_ERROR("bad type");
             return false;
@@ -719,17 +719,17 @@ XPCConvert::JSData2Native(void* d, Handl
         JS_EncodeStringToBuffer(cx, str, rs->BeginWriting(), length);
 
         return true;
     }
 
     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);
             if (!variant)
                 return false;
             *((nsISupports**)d) = static_cast<nsIVariant*>(variant);
             return true;
         } else if (iid->Equals(NS_GET_IID(nsIAtom)) &&
@@ -795,18 +795,18 @@ bool
 XPCConvert::NativeInterface2JSObject(jsval* d,
                                      nsIXPConnectJSObjectHolder** dest,
                                      xpcObjectHelper& aHelper,
                                      const nsID* iid,
                                      XPCNativeInterface** Interface,
                                      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)
         *dest = nullptr;
     if (!aHelper.Object())
         return true;
     if (pErr)
         *pErr = NS_ERROR_XPC_BAD_CONVERT_NATIVE;
@@ -878,17 +878,17 @@ XPCConvert::NativeInterface2JSObject(jsv
             if (!iface)
                 return false;
 
             if (Interface)
                 *Interface = iface;
         }
     }
 
-    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;
     nsRefPtr<XPCWrappedNative> strongWrapper;
     if (!flat) {
         rv = XPCWrappedNative::GetNewOrUsed(aHelper, xpcscope, iface,
                                             getter_AddRefs(strongWrapper));
 
@@ -961,19 +961,19 @@ XPCConvert::NativeInterface2JSObject(jsv
 
 // static
 bool
 XPCConvert::JSObject2NativeInterface(void** dest, HandleObject src,
                                      const nsID* iid,
                                      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);
 
     *dest = nullptr;
      if (pErr)
         *pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
 
@@ -1052,17 +1052,17 @@ XPCConvert::JSObject2NativeInterface(voi
 nsresult
 XPCConvert::ConstructException(nsresult rv, const char* message,
                                const char* ifaceName, const char* methodName,
                                nsISupports* data,
                                nsIException** exceptn,
                                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;
     char* sz = nullptr;
     nsXPIDLString xmsg;
     nsAutoCString sxmsg;
 
     nsCOMPtr<nsIScriptError> errorObject = do_QueryInterface(data);
@@ -1471,19 +1471,19 @@ CheckTargetAndPopulate(const nsXPTType& 
 // static
 bool
 XPCConvert::JSTypedArray2Native(void** d,
                                 JSObject* jsArray,
                                 uint32_t count,
                                 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.
     uint32_t len = JS_GetTypedArrayLength(jsArray);
     if (len < count) {
         if (pErr)
             *pErr = NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY;
 
@@ -1574,17 +1574,17 @@ XPCConvert::JSTypedArray2Native(void** d
 }
 
 // static
 bool
 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;
 
     // XXX add support for getting chars from strings
 
     // XXX add support to indicate *which* array element was not convertable
 
     if (s.isNullOrUndefined()) {
--- a/js/xpconnect/src/XPCInlines.h
+++ b/js/xpconnect/src/XPCInlines.h
@@ -464,22 +464,22 @@ inline void XPCNativeSet::Mark()
         (*pp)->Mark();
 
     MarkSelfOnly();
 }
 
 #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
 
 /***************************************************************************/
 
 inline
 JSObject* XPCWrappedNativeTearOff::GetJSObjectPreserveColor() const
 {
@@ -499,18 +499,18 @@ void XPCWrappedNativeTearOff::SetJSObjec
 {
     MOZ_ASSERT(!IsMarked());
     mJSObject = JSObj;
 }
 
 inline
 XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff()
 {
-    NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObjectPreserveColor()),
-                 "tearoff not empty in dtor");
+    MOZ_ASSERT(!(GetInterface() || GetNative() || GetJSObjectPreserveColor()),
+               "tearoff not empty in dtor");
 }
 
 /***************************************************************************/
 
 inline bool
 XPCWrappedNative::HasInterfaceNoQI(const nsIID& iid)
 {
     return nullptr != GetSet()->FindInterfaceWithIID(iid);
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -46,31 +46,31 @@ void nsJSID::Reset()
         NS_Free(mName);
 
     mNumber = mName = nullptr;
 }
 
 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;
 }
 
 NS_IMETHODIMP
 nsJSID::GetName(char * *aName)
 {
     if (!aName)
         return NS_ERROR_NULL_POINTER;
 
     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;
 }
 
 NS_IMETHODIMP
 nsJSID::GetNumber(char * *aNumber)
 {
     if (!aNumber)
@@ -135,17 +135,17 @@ nsJSID::Initialize(const char *idString)
         }
     }
     return NS_ERROR_FAILURE;
 }
 
 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);
 }
 
 // try to use the name, if no name, then use the number
 NS_IMETHODIMP
 nsJSID::ToString(char **_retval)
@@ -748,17 +748,17 @@ nsJSCID::CreateInstance(const JS::Value&
 
     nsCOMPtr<nsIComponentManager> compMgr;
     nsresult rv = NS_GetComponentManager(getter_AddRefs(compMgr));
     if (NS_FAILED(rv))
         return NS_ERROR_UNEXPECTED;
 
     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;
 
     rv = nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, obj, inst, nullptr, iid, true, retval, nullptr);
     if (NS_FAILED(rv) || JSVAL_IS_PRIMITIVE(*retval))
         return NS_ERROR_XPC_CANT_CREATE_WN;
     return NS_OK;
@@ -776,34 +776,34 @@ nsJSCID::GetService(const JS::Value& iid
     GetWrapperObject(&obj);
     if (!obj) {
         return NS_ERROR_UNEXPECTED;
     }
 
     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;
     }
 
     // If an IID was passed in then use it
     const nsID* iid = GetIIDArg(optionalArgc, iidval, cx);
     if (!iid)
         return NS_ERROR_XPC_BAD_IID;
 
     nsCOMPtr<nsIServiceManager> svcMgr;
     nsresult rv = NS_GetServiceManager(getter_AddRefs(svcMgr));
     if (NS_FAILED(rv))
         return rv;
 
     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;
 
     RootedObject instJSObj(cx);
     nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
     rv = nsXPConnect::XPConnect()->WrapNative(cx, obj, srvc, *iid, getter_AddRefs(holder));
     if (NS_FAILED(rv) || !holder ||
         // Assign, not compare
@@ -842,17 +842,17 @@ nsJSCID::HasInstance(nsIXPConnectWrapped
 {
     *bp = false;
     nsresult rv = NS_OK;
 
     if (!JSVAL_IS_PRIMITIVE(val)) {
         // 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;
         obj = FindObjectForHasInstance(cx, obj);
         if (!obj || !IS_WN_REFLECTOR(obj))
             return rv;
         if (XPCWrappedNative* other_wrapper = XPCWrappedNative::Get(obj))
             ci = other_wrapper->GetClassInfo();
@@ -913,17 +913,17 @@ xpc_JSObjectToID(JSContext *cx, JSObject
         return ((nsIJSID*)wrapper->GetIdentityObject())->GetID();
     }
     return nullptr;
 }
 
 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);
     if (obj && IS_WN_REFLECTOR(obj))
         wrapper = XPCWrappedNative::Get(obj);
     return wrapper &&
            (wrapper->HasInterfaceNoQI(NS_GET_IID(nsIJSID))  ||
             wrapper->HasInterfaceNoQI(NS_GET_IID(nsIJSIID)) ||
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -664,22 +664,22 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp 
 {
     XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
     if (!self)
         return;
 
     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();
             }
 
             nsTArray<nsXPCWrappedJS*>* dyingWrappedJSArray =
                 &self->mWrappedJSToReleaseArray;
 
             // Add any wrappers whose JSObjects are to be finalized to
             // this array. Note that we do not want to be changing the
@@ -694,43 +694,43 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp 
 
             XPCStringConvert::ClearCache();
 
             self->mDoingFinalization = true;
             break;
         }
         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
             // to be dead.
             DoDeferredRelease(self->mWrappedJSToReleaseArray);
 
             // Sweep scopes needing cleanup
             XPCWrappedNativeScope::FinishedFinalizationPhaseOfGC();
 
             // mThreadRunningGC indicates that GC is running.
             // 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());
             }
 
             break;
         }
         case JSFINALIZE_COLLECTION_END:
         {
             // 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();
             }
 
 #ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
             printf("--------------------------------------------------------------\n");
             int setsBefore = (int) self->mNativeSetMap->Count();
             int ifacesBefore = (int) self->mIID2NativeInterfaceMap->Count();
 #endif
@@ -881,17 +881,17 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp 
 
             self->mDyingWrappedNativeProtoMap->
                 Enumerate(DyingProtoKiller, nullptr);
 
             // mThreadRunningGC indicates that GC is running.
             // 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());
             }
 
             break;
         }
     }
 }
@@ -1347,17 +1347,17 @@ XPCJSRuntime::DeleteString(nsAString *st
 /***************************************************************************/
 
 #ifdef XPC_CHECK_WRAPPERS_AT_SHUTDOWN
 static PLDHashOperator
 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;
 }
 #endif
 
 static PLDHashOperator
 DetachedWrappedNativeProtoShutdownMarker(PLDHashTable *table, PLDHashEntryHdr *hdr,
                                          uint32_t number, void *arg)
@@ -1508,17 +1508,17 @@ XPCJSRuntime::~XPCJSRuntime()
 #ifdef MOZ_ENABLE_PROFILER_SPS
     // Tell the profiler that the runtime is gone
     if (PseudoStack *stack = mozilla_get_pseudo_stack())
         stack->sampleRuntime(nullptr);
 #endif
 
 #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
 }
 
 static void
 GetCompartmentName(JSCompartment *c, nsCString &name, bool replaceSlashes)
 {
     if (js::IsAtomsCompartment(c)) {
@@ -2021,17 +2021,17 @@ ReportCompartmentStats(const JS::Compart
 
     // asm.js arrays are heap-allocated on some platforms and
     // non-heap-allocated on others.  We never put them under sundries,
     // because (a) in practice they're almost always larger than the sundries
     // threshold, and (b) we'd need a third category of non-heap, non-GC
     // 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,
                      "Memory allocated on the malloc heap for object element arrays used as asm.js "
                      "array buffers.");
     }
     if (asmJSNonHeap > 0) {
         REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/non-heap/elements/asm.js"),
@@ -2800,17 +2800,17 @@ ReadSourceFromFilename(JSContext *cx, co
     return NS_ERROR_OUT_OF_MEMORY;
 
   unsigned char *ptr = buf, *end = ptr + rawLen;
   while (ptr < end) {
     uint32_t bytesRead;
     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;
   }
 
   nsString decoded;
   rv = nsScriptLoader::ConvertToUTF16(scriptChannel, buf, rawLen, EmptyString(), NULL, decoded);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Copy to JS engine.
@@ -3172,77 +3172,77 @@ XPCJSRuntime::DebugDump(int16_t depth)
 #endif
 }
 
 /***************************************************************************/
 
 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;
 }
 
 void
 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;
 #ifdef DEBUG
     mSelfp = nullptr;
     mNext = nullptr;
 #endif
 }
 
 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.");
     }
 }
 
 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.");
     }
 }
 
 JSObject *
 XPCJSRuntime::GetJunkScope()
--- a/js/xpconnect/src/XPCLocale.cpp
+++ b/js/xpconnect/src/XPCLocale.cpp
@@ -178,17 +178,17 @@ private:
         do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
       if (NS_SUCCEEDED(rv)) {
         nsCOMPtr<nsILocale> appLocale;
         rv = localeService->GetApplicationLocale(getter_AddRefs(appLocale));
         if (NS_SUCCEEDED(rv)) {
           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);
 
           if (NS_SUCCEEDED(rv)) {
             nsAutoCString charset;
             rv = platformCharset->GetDefaultCharsetForLocale(localeStr, charset);
             if (NS_SUCCEEDED(rv)) {
@@ -263,17 +263,17 @@ xpc_LocalizeRuntime(JSRuntime *rt)
 
   nsCOMPtr<nsILocale> appLocale;
   nsresult rv = localeService->GetApplicationLocale(getter_AddRefs(appLocale));
   if (NS_FAILED(rv))
     return false;
 
   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());
 }
 
 NS_EXPORT_(void)
 xpc_DelocalizeRuntime(JSRuntime *rt)
 {
--- a/js/xpconnect/src/XPCMaps.cpp
+++ b/js/xpconnect/src/XPCMaps.cpp
@@ -49,17 +49,17 @@ HashNativeKey(PLDHashTable *table, const
         Position = Key->GetPosition();
     } else {
         Set      = (XPCNativeSet*) Key;
         Addition = nullptr;
         Position = 0;
     }
 
     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;
     } else {
         XPCNativeInterface** Current = Set->GetInterfaceArray();
         uint16_t count = Set->GetInterfaceCount();
         if (Addition) {
             count++;
@@ -81,34 +81,34 @@ HashNativeKey(PLDHashTable *table, const
 /***************************************************************************/
 // implement JSObject2WrappedJSMap...
 
 void
 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) {
             if (wrapper->IsSubjectToFinalization() && wrapper->IsObjectAboutToBeFinalized())
                 dying->AppendElement(wrapper);
             wrapper = wrapper->GetNextWrapper();
         }
     }
 }
 
 void
 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);
     }
 }
 
 /***************************************************************************/
 // implement Native2WrappedNativeMap...
 
 // static
--- a/js/xpconnect/src/XPCMaps.h
+++ b/js/xpconnect/src/XPCMaps.h
@@ -137,20 +137,20 @@ public:
         return wrapper;
     }
 
     inline void Remove(XPCWrappedNative* wrapper)
     {
         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);
     }
 
     inline uint32_t Count() {return mTable->entryCount;}
     inline uint32_t Enumerate(PLDHashEnumerator f, void *arg)
         {return PL_DHashTableEnumerate(mTable, f, arg);}
 
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -64,17 +64,17 @@ LookupInterfaceOrAncestor(uint32_t table
         }
     }
     return entry;
 }
 
 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);
     return (clasp->interfacesBitmap & (1 << interfaceBit)) != 0;
 }
 
 static void
 PointerFinalize(JSFreeOp *fop, JSObject *obj)
@@ -193,18 +193,18 @@ GetMemberInfo(JSObject *obj, jsid member
         }
     }
 }
 
 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);
     *memberIdp = methodId;
 }
 
 static bool
 ThrowCallFailed(JSContext *cx, nsresult rv,
@@ -844,18 +844,18 @@ xpc_qsXPCOMObjectToJsval(JSContext *cx, 
         if (!JS_IsExceptionPending(cx))
             xpc_qsThrow(cx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED);
         return false;
     }
 
 #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;
 }
 
 bool
 xpc_qsVariantToJsval(JSContext *aCx,
                      nsIVariant *p,
@@ -878,11 +878,11 @@ xpc_qsVariantToJsval(JSContext *aCx,
 void
 xpc_qsAssertContextOK(JSContext *cx)
 {
     XPCJSContextStack* stack = XPCJSRuntime::Get()->GetJSContextStack();
 
     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
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -49,17 +49,17 @@ XPCVariant::XPCVariant(JSContext* cx, js
     } else
         mReturnRawObject = false;
 }
 
 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.
     if (!JSVAL_IS_STRING(val))
         nsVariant::Cleanup(&mData);
 
     if (!JSVAL_IS_NULL(val))
         RemoveFromRootSet(nsXPConnect::GetRuntimeInstance()->GetMapLock());
@@ -200,35 +200,35 @@ XPCArrayHomogenizer::GetTypeForArray(JSC
         } else if (val.isUndefined()) {
             state = tVar;
             break;
         } else if (val.isNull()) {
             type = tNull;
         } 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;
             else if (xpc_JSObjectIsID(cx, jsobj))
                 type = tID;
             else
                 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;
     }
 
     switch (state) {
         case tInt :
             *resultType = nsXPTType((uint8_t)TD_INT32);
@@ -287,18 +287,18 @@ bool XPCVariant::InitializeData(JSContex
     if (val.isString()) {
         JSString* str = val.toString();
         if (!str)
             return false;
 
         // 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
         size_t length;
         const jschar *chars = JS_GetStringCharsZAndLength(cx, str, &length);
         if (!chars)
             return false;
 
@@ -307,17 +307,17 @@ bool XPCVariant::InitializeData(JSContex
         // uint32_t is not valid on some platforms.
         mData.u.wstr.mWStringLength = (uint32_t)length;
         mData.mType = nsIDataType::VTYPE_WSTRING_SIZE_IS;
 
         return true;
     }
 
     // leaving only JSObject...
-    NS_ASSERTION(val.isObject(), "invalid type of jsval!");
+    MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
 
     RootedObject jsobj(cx, &val.toObject());
 
     // Let's see if it is a xpcJSID.
 
     const nsID* id = xpc_JSObjectToID(cx, jsobj);
     if (id)
         return NS_SUCCEEDED(nsVariant::SetFromID(&mData, *id));
@@ -393,19 +393,19 @@ XPCVariant::VariantDataToJS(nsIVariant* 
         if (!JS_WrapValue(cx, realVal.address()))
             return false;
         *pJSVal = realVal;
         return true;
     }
 
     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;
         *pJSVal = realVal;
         return true;
     }
 
     // else, it's an object and we really need to double wrap it if we've
--- a/js/xpconnect/src/XPCWrappedJS.cpp
+++ b/js/xpconnect/src/XPCWrappedJS.cpp
@@ -18,18 +18,17 @@ using namespace mozilla;
 
 // NOTE: much of the fancy footwork is done in xpcstubs.cpp
 
 NS_IMETHODIMP
 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();
     if (cb.WantDebugInfo()) {
         char name[72];
         if (tmp->GetClass())
             JS_snprintf(name, sizeof(name), "nsXPCWrappedJS (%s)",
                         tmp->GetClass()->GetInterfaceName());
@@ -70,17 +69,17 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXPCWrap
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXPCWrappedJS)
     tmp->Unlink();
 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;
 
     // Put this here rather that in DelegatedQueryInterface because it needs
     // to be in QueryInterface before the possible delegation to 'outer', but
     // we don't want to do this check twice in one call in the normal case:
     // once in QueryInterface and once in DelegatedQueryInterface.
@@ -176,18 +175,17 @@ nsXPCWrappedJS::Release(void)
     NS_PRECONDITION(0 != mRefCnt, "dup release");
 
     if (mMainThreadOnly && !NS_IsMainThread()) {
         // We'd like to abort here, but this can happen if someone uses a proxy
         // for the nsXPCWrappedJS.
         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));
         }
         return mRefCnt;
     }
 
     // need to take the map lock here to prevent GetNewOrUsed from trying
@@ -216,17 +214,17 @@ do_decrement:
             goto do_decrement;
     }
     return cnt;
 }
 
 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");
 }
 
 // static
 void
 nsXPCWrappedJS::GetTraceName(JSTracer* trc, char *buf, size_t bufsize)
 {
@@ -289,17 +287,17 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleO
     nsXPCWrappedJS* root = nullptr;
     nsXPCWrappedJS* wrapper = nullptr;
     nsXPCWrappedJSClass* clazz = nullptr;
     XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
     bool release_root = false;
 
     map = rt->GetWrappedJSMap();
     if (!map) {
-        NS_ASSERTION(map,"bad map");
+        MOZ_ASSERT(map,"bad map");
         return NS_ERROR_FAILURE;
     }
 
     nsXPCWrappedJSClass::GetNewOrUsed(cx, aIID, &clazz);
     if (!clazz)
         return NS_ERROR_FAILURE;
     // from here on we need to return through 'return_wrapper'
 
@@ -379,18 +377,18 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleO
                 map->Remove(root);
 
                 goto return_wrapper;
             }
         }
     }
 
     // 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);
         if (!wrapper)
             goto return_wrapper;
 #if DEBUG_xpc_leaks
         printf("Created nsXPCWrappedJS %p, JSObject is %p\n",
                (void*)wrapper, (void*)jsObj);
@@ -493,17 +491,17 @@ nsXPCWrappedJS::Unlink()
         // unlink this wrapper
         nsXPCWrappedJS* cur = mRoot;
         while (1) {
             if (cur->mNext == this) {
                 cur->mNext = mNext;
                 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);
     }
 
     NS_IF_RELEASE(mClass);
     if (mOuter) {
         XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
@@ -529,33 +527,33 @@ nsXPCWrappedJS::Find(REFNSIID aIID)
 
     return nullptr;
 }
 
 // check if asking for an interface that some wrapper in the chain inherits from
 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;
         if (NS_SUCCEEDED(cur->GetClass()->GetInterfaceInfo()->
                          HasAncestor(&aIID, &found)) && found)
             return cur;
     }
 
     return nullptr;
 }
 
 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.
 
     if (!(*info = GetClass()->GetInterfaceInfo()))
         return NS_ERROR_UNEXPECTED;
     NS_ADDREF(*info);
     return NS_OK;
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -261,18 +261,18 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
           JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
 
         jsval args[1] = {OBJECT_TO_JSVAL(id)};
         success = JS_CallFunctionValue(cx, jsobj, fun, 1, args, retval.address());
 
         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());
 
             if (JS_GetPendingException(cx, jsexception.address())) {
                 nsresult rv;
                 if (jsexception.isObject()) {
                     // XPConnect may have constructed an object to represent a
                     // C++ QI failure. See if that is the case.
@@ -838,18 +838,18 @@ nsXPCWrappedJSClass::GetArraySizeFromPar
     rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, &param, 0, &argnum);
     if (NS_FAILED(rv))
         return false;
 
     const nsXPTParamInfo& arg_param = method->params[argnum];
 
     // 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;
     else
         *result = nativeParams[argnum].val.u32;
 
     return true;
 }
@@ -918,17 +918,17 @@ nsXPCWrappedJSClass::CleanupPointerArray
         }
     }
 }
 
 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();
     } else {
         void* p = *((void**)pp);
         if (p) nsMemory::Free(p);
     }
 }
@@ -1486,17 +1486,17 @@ pre_call_clean_up:
     // Convert independent params only.
     // When we later convert the dependent params (if any) we will know that
     // the params upon which they depend will have already been converted -
     // regardless of ordering.
 
     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;
 
         const nsXPTType& type = param.GetType();
         if (type.IsDependent()) {
             foundDependentParam = true;
             continue;
         }
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -30,19 +30,19 @@
 using namespace xpc;
 using namespace mozilla;
 using namespace mozilla::dom;
 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();
 }
 
 /***************************************************************************/
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(XPCWrappedNative)
 
 NS_IMETHODIMP
@@ -420,24 +420,24 @@ nsresult
 XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
                                XPCWrappedNativeScope* Scope,
                                XPCNativeInterface* Interface,
                                XPCWrappedNative** resultWrapper)
 {
     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();
 
     if (!identity) {
         NS_ERROR("This XPCOM object fails in QueryInterface to nsISupports!");
         return NS_ERROR_FAILURE;
     }
 
@@ -452,17 +452,17 @@ XPCWrappedNative::GetNewOrUsed(xpcObject
     {   // scoped lock
         XPCAutoLock lock(mapLock);
         wrapper = map->Find(identity);
     }
 
     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();
         return NS_OK;
     }
 
     // There is a chance that the object wants to have the self-same JSObject
     // reflection regardless of the scope into which we are reflecting it.
@@ -518,18 +518,18 @@ XPCWrappedNative::GetNewOrUsed(xpcObject
                                                           parent, parent.address());
         if (NS_FAILED(rv))
             return rv;
 
         if (rv == NS_SUCCESS_CHROME_ACCESS_ONLY)
             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);
 
         if (parent != plannedParent) {
             XPCWrappedNativeScope* betterScope = GetObjectScope(parent);
             if (betterScope != Scope)
                 return GetNewOrUsed(helper, betterScope, Interface, resultWrapper);
 
@@ -547,17 +547,17 @@ XPCWrappedNative::GetNewOrUsed(xpcObject
         } else {
             // scoped lock
             XPCAutoLock lock(mapLock);
             wrapper = map->Find(identity);
         }
 
         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();
             return NS_OK;
         }
     } else {
         ac.construct(static_cast<JSContext*>(cx), parent);
 
@@ -597,30 +597,30 @@ XPCWrappedNative::GetNewOrUsed(xpcObject
             return NS_ERROR_FAILURE;
 
         wrapper =
             new XPCWrappedNative(helper.forgetCanonical(), Scope, set);
 
         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.
     // This would cause the mSet to get collected and we'd later crash. I've
     // *seen* this happen.
     AutoMarkingWrappedNativePtr wrapperMarker(cx, wrapper);
 
     if (!wrapper->Init(parent, &sciWrapper))
         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;
     }
 
     if (needsSOW)
         wrapper->SetNeedsSOW();
     if (needsCOW)
         wrapper->SetNeedsCOW();
 
@@ -635,17 +635,17 @@ FinishCreate(XPCWrappedNativeScope* Scop
              XPCWrappedNative** resultWrapper)
 {
     AutoJSContext cx;
     MOZ_ASSERT(inWrapper);
 
 #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)
             JS_smprintf_free(s);
     }
 #endif
 
     XPCLock* mapLock = Scope->GetRuntime()->GetMapLock();
@@ -661,20 +661,20 @@ FinishCreate(XPCWrappedNativeScope* Scop
         XPCAutoLock lock(mapLock);
         wrapper = map->Add(inWrapper);
         if (!wrapper)
             return NS_ERROR_FAILURE;
     }
 
     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);
 
         // Our newly created wrapper is the one that we just added to the table.
         // All is well. Call PostCreate as necessary.
         XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
         if (si && si->GetFlags().WantPostCreate()) {
@@ -717,17 +717,17 @@ FinishCreate(XPCWrappedNativeScope* Scop
 // static
 nsresult
 XPCWrappedNative::GetUsedOnly(nsISupports* Object,
                               XPCWrappedNativeScope* Scope,
                               XPCNativeInterface* Interface,
                               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;
     CallQueryInterface(Object, &cache);
     if (cache) {
         RootedObject flat(cx, cache->GetWrapper());
         if (!flat) {
             *resultWrapper = nullptr;
@@ -751,17 +751,17 @@ XPCWrappedNative::GetUsedOnly(nsISupport
                 *resultWrapper = nullptr;
                 return NS_OK;
             }
         }
     }
 
     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;
     }
 
     wrapper.forget(resultWrapper);
     return NS_OK;
 }
 
 // This ctor is used if this object will have a proto.
@@ -769,36 +769,36 @@ XPCWrappedNative::XPCWrappedNative(alrea
                                    XPCWrappedNativeProto* aProto)
     : mMaybeProto(aProto),
       mSet(aProto->GetSet()),
       mScriptableInfo(nullptr)
 {
     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);
 }
 
 // This ctor is used if this object will NOT have a proto.
 XPCWrappedNative::XPCWrappedNative(already_AddRefed<nsISupports> aIdentity,
                                    XPCWrappedNativeScope* aScope,
                                    XPCNativeSet* aSet)
 
     : mMaybeScope(TagScope(aScope)),
       mSet(aSet),
       mScriptableInfo(nullptr)
 {
     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);
 }
 
 XPCWrappedNative::~XPCWrappedNative()
 {
     DEBUG_TrackDeleteWrapper(this);
 
@@ -854,48 +854,48 @@ XPCWrappedNative::Destroy()
     }
 
     mMaybeScope = nullptr;
 }
 
 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();
     if (IsIncrementalBarrierNeeded(rt))
         mScriptableInfo->Mark();
 
     mScriptableInfo = si;
 }
 
 void
 XPCWrappedNative::SetProto(XPCWrappedNativeProto* p)
 {
-    NS_ASSERTION(!IsWrapperExpired(), "bad ptr!");
+    MOZ_ASSERT(!IsWrapperExpired(), "bad ptr!");
 
     MOZ_ASSERT(HasProto());
 
     // Write barrier for incremental GC.
     JSRuntime* rt = GetRuntime()->Runtime();
     GetProto()->WriteBarrierPre(rt);
 
     mMaybeProto = p;
 }
 
 // This is factored out so that it can be called publicly
 // static
 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);
     if (classInfoHelper) {
         nsCOMPtr<nsIXPCScriptable> helper =
           dont_AddRef(static_cast<nsIXPCScriptable*>(classInfoHelper));
         uint32_t flags = classInfoHelper->GetScriptableFlags();
         sciProto.SetCallback(helper.forget());
@@ -920,17 +920,17 @@ XPCWrappedNative::GatherProtoScriptableC
 
 // static
 const XPCNativeScriptableCreateInfo&
 XPCWrappedNative::GatherScriptableCreateInfo(nsISupports* obj,
                                              nsIClassInfo* classInfo,
                                              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) {
         GatherProtoScriptableCreateInfo(classInfo, sciProto);
 
         if (sciProto.GetFlags().DontAskInstanceForScriptable())
             return sciProto;
     }
@@ -940,55 +940,55 @@ XPCWrappedNative::GatherScriptableCreate
     if (helper) {
         uint32_t flags = helper->GetScriptableFlags();
         sciWrapper.SetCallback(helper.forget());
         sciWrapper.SetFlags(flags);
 
         // 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");
-
-        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)");
-
-        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)");
-
-        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");
-
-        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)");
-
-        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)");
-
-        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().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().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().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().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().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().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().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;
     }
 
     return sciProto;
 }
 
 bool
@@ -1016,27 +1016,27 @@ XPCWrappedNative::Init(HandleObject pare
 
     // create our flatJSObject
 
     JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass.base);
 
     // 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() :
                                 JS_GetObjectPrototype(cx, parent);
     if (!protoJSObject) {
         return false;
     }
 
@@ -1059,17 +1059,17 @@ XPCWrappedNative::FinishInit()
 
     // For all WNs, we want to make sure that the expando chain slot starts out
     // as null.
     JS_SetReservedSlot(mFlatJSObject, WN_XRAYEXPANDOCHAIN_SLOT, JSVAL_NULL);
 
     // 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() &&
         NS_FAILED(mScriptableInfo->GetCallback()->Create(this, cx,
                                                          mFlatJSObject))) {
         return false;
     }
 
@@ -1164,18 +1164,18 @@ XPCWrappedNative::FlatJSObjectFinalized(
                 to->JSObjectFinalized();
             }
 
             // We also need to release any native pointers held...
             nsISupports* obj = to->GetNative();
             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) {
                     nsContentUtils::DeferredFinalize(obj);
                 } else {
                     obj->Release();
                 }
                 to->SetNative(nullptr);
@@ -1188,21 +1188,21 @@ XPCWrappedNative::FlatJSObjectFinalized(
     nsWrapperCache *cache = nullptr;
     CallQueryInterface(mIdentity, &cache);
     if (cache)
         cache->ClearWrapper();
 
     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()) {
         Destroy();
     }
 
     // Note that it's not safe to touch mNativeWrapper here since it's
     // likely that it has already been finalized.
@@ -1316,17 +1316,17 @@ XPCWrappedNative::ReparentWrapperIfFound
     nsRefPtr<XPCWrappedNative> wrapper;
     RootedObject flat(cx);
     nsWrapperCache* cache = nullptr;
     CallQueryInterface(aCOMObj, &cache);
     if (cache) {
         flat = cache->GetWrapper();
         if (flat) {
             wrapper = XPCWrappedNative::Get(flat);
-            NS_ASSERTION(wrapper->GetScope() == aOldScope,
+            MOZ_ASSERT(wrapper->GetScope() == aOldScope,
                          "Incorrect scope passed");
         }
     } else {
         rv = XPCWrappedNative::GetUsedOnly(aCOMObj, aOldScope, iface,
                                            getter_AddRefs(wrapper));
         if (NS_FAILED(rv))
             return rv;
 
@@ -1350,17 +1350,17 @@ XPCWrappedNative::ReparentWrapperIfFound
     if (aOldScope != aNewScope) {
         // Oh, so now we need to move the wrapper to a different scope.
         AutoMarkingWrappedNativeProtoPtr oldProto(cx);
         AutoMarkingWrappedNativeProtoPtr newProto(cx);
 
         // 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();
             XPCNativeScriptableInfo *info = oldProto->GetScriptableInfo();
             XPCNativeScriptableCreateInfo ci(*info);
             newProto =
                 XPCWrappedNativeProto::GetNewOrUsed(aNewScope,
                                                     oldProto->GetClassInfo(),
@@ -1441,20 +1441,20 @@ XPCWrappedNative::ReparentWrapperIfFound
 
             if (wrapper->mScriptableInfo &&
                 wrapper->mScriptableInfo == oldProto->GetScriptableInfo()) {
                 // The new proto had better have the same JSClass stuff as
                 // the old one! We maintain a runtime wide unique map of
                 // 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());
             }
 
             // Crash if the wrapper is already in the new scope.
             if (newMap->Find(wrapper->GetIdentityObject()))
                 MOZ_CRASH();
 
@@ -1822,28 +1822,28 @@ XPCWrappedNative::InitTearOff(XPCWrapped
                     // this is only going to run for the few people in the
                     // DEBUG_xpc_hacker list.
                     if (HasProto()) {
                         JSObject* proto  = nullptr;
                         JSObject* our_proto = GetProto()->GetJSProtoObject();
 
                         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) {
                             proto = proto->getProto();
 
                             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");
                     }
                 }
 #endif
                 NS_RELEASE(obj);
                 aTearOff->SetInterface(nullptr);
                 return NS_OK;
@@ -2066,18 +2066,18 @@ public:
 
 };
 
 // static
 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)) {
         return Throw(rv, ccx);
     }
 
     DEBUG_TrackWrapperCall(ccx.GetWrapper(), mode);
 
@@ -2261,18 +2261,18 @@ CallMethodHelper::GetInterfaceTypeFromPa
 
 bool
 CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const
 {
     const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(paramIndex);
 
     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) ||
              !JS_GetPropertyById(mCallContext,
                                  JSVAL_TO_OBJECT(arg),
                                  mIdxValueId,
                                  srcp))) {
             // Explicitly passed in unusable value for out param.  Note
@@ -2351,37 +2351,37 @@ CallMethodHelper::GatherAndConvertResult
                 return false;
             }
         }
 
         if (paramInfo.IsRetval()) {
             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)) {
                 ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, i, mCallContext);
                 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");
         }
     }
 
     return true;
 }
 
 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);
         return false;
     }
 
     if (!mArgv[0].isObject()) {
         ThrowBadParam(NS_ERROR_XPC_BAD_CONVERT_JS, 0, mCallContext);
@@ -2506,17 +2506,17 @@ CallMethodHelper::ConvertIndependentPara
 bool
 CallMethodHelper::ConvertIndependentParam(uint8_t i)
 {
     const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(i);
     const nsXPTType& type = paramInfo.GetType();
     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())
         return HandleDipperParam(dp, paramInfo);
 
     // Specify the correct storage/calling semantics.
     if (paramInfo.IsIndirect())
         dp->SetIndirect();
@@ -2549,18 +2549,18 @@ CallMethodHelper::ConvertIndependentPara
         return true;
 
     // We're definitely some variety of 'in' now, so there's something to
     // convert. The source value for conversion depends on whether we're
     // dealing with an 'in' or an 'inout' parameter. 'inout' was handled above,
     // 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)
             src = JSVAL_VOID;
         else
             src = JSVAL_NULL;
     }
 
@@ -2615,19 +2615,18 @@ CallMethodHelper::ConvertDependentParam(
     dp->type = type;
 
     if (isArray) {
         if (NS_FAILED(mIFaceInfo->GetTypeForParam(mVTableIndex, &paramInfo, 1,
                                                   &datum_type))) {
             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;
     }
 
     // Specify the correct storage/calling semantics.
     if (paramInfo.IsIndirect())
         dp->SetIndirect();
 
@@ -2654,17 +2653,17 @@ CallMethodHelper::ConvertDependentParam(
         return true;
 
     // We're definitely some variety of 'in' now, so there's something to
     // convert. The source value for conversion depends on whether we're
     // dealing with an 'in' or an 'inout' parameter. 'inout' was handled above,
     // 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;
     }
 
     nsID param_iid;
     if (datum_type.IsInterfacePointer() &&
         !GetInterfaceTypeFromParam(i, datum_type, &param_iid))
         return false;
@@ -2707,17 +2706,17 @@ CallMethodHelper::ConvertDependentParam(
 // Performs all necessary teardown on a parameter after method invocation.
 //
 // This method should only be called if the value in question was flagged
 // for cleanup (ie, if dp->DoesValNeedCleanup()).
 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.
     if (type.TagPart() != nsXPTType::T_JSVAL && param.val.p == nullptr)
         return;
 
     switch (type.TagPart()) {
         case nsXPTType::T_JSVAL:
@@ -2731,18 +2730,17 @@ CallMethodHelper::CleanupParam(nsXPTCMin
         case nsXPTType::T_DOMSTRING:
             nsXPConnect::GetRuntimeInstance()->DeleteString((nsAString*)param.val.p);
             break;
         case nsXPTType::T_UTF8STRING:
         case nsXPTType::T_CSTRING:
             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;
     }
 }
 
 // Handle parameters with dipper types.
 //
 // Dipper types are one of the more inscrutable aspects of xpidl. In a
@@ -2767,25 +2765,25 @@ CallMethodHelper::CleanupParam(nsXPTCMin
 bool
 CallMethodHelper::HandleDipperParam(nsXPTCVariant* dp,
                                     const nsXPTParamInfo& paramInfo)
 {
     // Get something we can make comparisons with.
     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.
     if (type_tag == nsXPTType::T_ASTRING || type_tag == nsXPTType::T_DOMSTRING)
         dp->val.p = new nsAutoString();
     else
         dp->val.p = new nsCString();
 
@@ -2848,17 +2846,17 @@ XPCWrappedNative::GetObjectPrincipal() c
     // just check same-origin here.
     nsCOMPtr<nsIScriptObjectPrincipal> objPrin(do_QueryInterface(mIdentity));
     if (objPrin) {
         bool equal;
         if (!principal)
             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;
 }
 
 /* XPCNativeInterface FindInterfaceWithMember (in JSHandleId name); */
 NS_IMETHODIMP XPCWrappedNative::FindInterfaceWithMember(HandleId name,
                                                         nsIInterfaceInfo * *_retval)
@@ -3180,17 +3178,17 @@ static void ShowDuplicateInterface(jsval
 }
 
 static bool InterfacesAreRelated(XPCNativeInterface* iface1,
                                  XPCNativeInterface* iface2)
 {
     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;
 
     return
         (NS_SUCCEEDED(info1->HasAncestor(iface2->GetIID(), &match)) && match) ||
         (NS_SUCCEEDED(info2->HasAncestor(iface1->GetIID(), &match)) && match);
 }
 
@@ -3244,17 +3242,17 @@ void DEBUG_ReportShadowedMembers(XPCNati
                                  XPCWrappedNative* wrapper,
                                  XPCWrappedNativeProto* proto)
 {
     // NOTE: Either wrapper or proto could be null...
 
     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
     static int nextSeenSet = 0;
     static const int MAX_SEEN_SETS = 128;
     static XPCNativeSet* SeenSets[MAX_SEEN_SETS];
     for (int seen = 0; seen < MAX_SEEN_SETS; seen++)
         if (set == SeenSets[seen])
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -35,18 +35,17 @@ XPCNativeMember::GetCallInfo(JSObject* f
     return true;
 }
 
 bool
 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);
 }
 
 bool
 XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
                          HandleObject parent, jsval *vp)
 {
@@ -296,27 +295,27 @@ XPCNativeInterface::NewInstance(nsIInter
         if (!str) {
             NS_ERROR("bad method name");
             failed = true;
             break;
         }
         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())
                 cur->SetReadOnlyAttribute(i);
             else
                 cur->SetMethod(i);
         }
     }
@@ -333,17 +332,17 @@ XPCNativeInterface::NewInstance(nsIInter
             if (!str) {
                 NS_ERROR("bad constant name");
                 failed = true;
                 break;
             }
             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);
             cur->SetConstant(i);
         }
     }
 
     if (!failed) {
@@ -489,17 +488,17 @@ XPCNativeSet::GetNewOrUsed(nsIClassInfo*
         // nsIClassInfo to classes implemented in script without requiring this
         // method to be implemented.
 
         // Make sure these are set correctly...
         iidArray = nullptr;
         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 !!!
 
     if (iidCount) {
         AutoMarkingNativeInterfacePtrArrayPtr
             arr(cx, new XPCNativeInterface*[iidCount], iidCount, true);
         if (!arr)
             goto out;
@@ -561,18 +560,18 @@ XPCNativeSet::GetNewOrUsed(nsIClassInfo*
     if (set)
     {   // scoped lock
         XPCAutoLock lock(rt->GetMapLock());
 
 #ifdef DEBUG
         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:
     if (iidArray)
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(iidCount, iidArray);
     if (interfaceArray)
         delete [] interfaceArray.get();
 
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -139,17 +139,17 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx
     RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx, obj);
     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) {
         // This is pretty unexpected at this point. The object originally
         // responded to this get property call and now gives no object.
         // XXX Should this throw something at the caller?
         *vp = JSVAL_NULL;
         return true;
@@ -399,17 +399,17 @@ DefinePropertyIfFound(XPCCallContext& cc
         if (resolved)
             *resolved = true;
         return JS_DefinePropertyById(ccx, obj, id, funval, nullptr, nullptr,
                                      propFlags);
     }
 
     // else...
 
-    NS_ASSERTION(member->IsAttribute(), "way broken!");
+    MOZ_ASSERT(member->IsAttribute(), "way broken!");
 
     propFlags |= JSPROP_GETTER | JSPROP_SHARED;
     JSObject* funobj = JSVAL_TO_OBJECT(funval);
     JSPropertyOp getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj);
     JSStrictPropertyOp setter;
     if (member->IsWritableAttribute()) {
         propFlags |= JSPROP_SETTER;
         propFlags &= ~JSPROP_READONLY;
@@ -939,17 +939,17 @@ XPC_WN_Helper_NewResolve(JSContext *cx, 
         rv = si->GetCallback()->NewResolve(wrapper, cx, obj, id, flags,
                                            obj2FromScriptable.address(), &retval);
 
         if (allowPropMods)
             (void)ccx.SetResolvingWrapper(oldResolvingWrapper);
     }
 
     old = ccx.SetResolveName(old);
-    NS_ASSERTION(old == id, "bad nest");
+    MOZ_ASSERT(old == id, "bad nest");
 
     if (NS_FAILED(rv)) {
         return Throw(rv, cx);
     }
 
     if (obj2FromScriptable) {
         objp.set(obj2FromScriptable);
     } else if (wrapper->HasMutatedSet()) {
@@ -1117,18 +1117,18 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, Ha
 }
 
 /***************************************************************************/
 
 // static
 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());
     if (!newObj)
         return nullptr;
 
     char* name = nullptr;
     if (NS_FAILED(sci->GetCallback()->GetClassName(&name)) || !name) {
@@ -1152,17 +1152,17 @@ XPCNativeScriptableInfo::Construct(const
     }
 
     return newObj;
 }
 
 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 |
                           JSCLASS_NEW_RESOLVE;
 
     if (mFlags.IsGlobalObject())
         mJSClass.base.flags |= XPCONNECT_GLOBAL_FLAGS;
 
@@ -1288,17 +1288,17 @@ FixUpThisIfBroken(JSObject *obj, JSObjec
         }
     }
     return obj;
 }
 
 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));
     if (!obj)
         return false;
 
     obj = FixUpThisIfBroken(obj, funobj);
     XPCCallContext ccx(JS_CALLER, cx, obj, funobj, JSID_VOIDHANDLE, argc,
@@ -1313,17 +1313,17 @@ XPC_WN_CallMethod(JSContext *cx, unsigne
         return Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, cx);
     ccx.SetCallInfo(iface, member, false);
     return XPCWrappedNative::CallMethod(ccx);
 }
 
 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));
     if (!obj)
         return false;
 
     obj = FixUpThisIfBroken(obj, funobj);
     XPCCallContext ccx(JS_CALLER, cx, obj, funobj, JSID_VOIDHANDLE, argc,
@@ -1350,21 +1350,21 @@ XPC_WN_GetterSetter(JSContext *cx, unsig
     return XPCWrappedNative::GetAttribute(ccx);
 }
 
 /***************************************************************************/
 
 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)
         return false;
 
     if (self->GetScriptableInfo() &&
         self->GetScriptableInfo()->GetFlags().DontEnumStaticProps())
         return true;
@@ -1411,19 +1411,19 @@ XPC_WN_Shared_Proto_Trace(JSTracer *trc,
         p->TraceInside(trc);
 }
 
 /*****************************************************/
 
 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);
     if (!self)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx);
     if (!ccx.IsValid())
@@ -1491,19 +1491,19 @@ js::Class XPC_WN_ModsAllowed_NoCall_Prot
 };
 
 /***************************************************************************/
 
 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);
     if (!self)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx);
     if (!ccx.IsValid())
@@ -1521,19 +1521,19 @@ XPC_WN_OnlyIWrite_Proto_SetPropertyStub(
                                         MutableHandleValue vp)
 {
     return XPC_WN_OnlyIWrite_Proto_AddPropertyStub(cx, obj, id, vp);
 }
 
 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);
     if (!self)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx);
     if (!ccx.IsValid())
--- a/js/xpconnect/src/XPCWrappedNativeProto.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeProto.cpp
@@ -36,17 +36,17 @@ XPCWrappedNativeProto::XPCWrappedNativeP
 
 #ifdef DEBUG
     PR_ATOMIC_INCREMENT(&gDEBUG_LiveProtoCount);
 #endif
 }
 
 XPCWrappedNativeProto::~XPCWrappedNativeProto()
 {
-    NS_ASSERTION(!mJSProtoObject, "JSProtoObject still alive");
+    MOZ_ASSERT(!mJSProtoObject, "JSProtoObject still alive");
 
     MOZ_COUNT_DTOR(XPCWrappedNativeProto);
 
 #ifdef DEBUG
     PR_ATOMIC_DECREMENT(&gDEBUG_LiveProtoCount);
 #endif
 
     // Note that our weak ref to mScope is not to be trusted at this point.
@@ -128,17 +128,17 @@ XPCWrappedNativeProto::CallPostCreatePro
     }
 
     return true;
 }
 
 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.
 
     // Only remove this proto from the map if it is the one in the map.
     ClassInfo2WrappedNativeProtoMap* map =
         GetScope()->GetWrappedNativeProtoMap(ClassIsMainThreadOnly());
     if (map->Find(mClassInfo) == this)
         map->Remove(mClassInfo);
@@ -174,18 +174,18 @@ XPCWrappedNativeProto::SystemIsBeingShut
 // static
 XPCWrappedNativeProto*
 XPCWrappedNativeProto::GetNewOrUsed(XPCWrappedNativeScope* scope,
                                     nsIClassInfo* classInfo,
                                     const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
                                     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;
     XPCLock* lock = nullptr;
 
     uint32_t ciFlags;
     if (NS_FAILED(classInfo->GetFlags(&ciFlags)))
         ciFlags = 0;
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -289,27 +289,27 @@ bool AllowXBLScope(JSCompartment *c)
 XPCWrappedNativeScope::~XPCWrappedNativeScope()
 {
     MOZ_COUNT_DTOR(XPCWrappedNativeScope);
     DEBUG_TrackDeleteScope(this);
 
     // 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;
     }
 
     if (mContext)
         mContext->RemoveScope(this);
 
     // This should not be necessary, since the Components object should die
     // with the scope but just in case.
@@ -400,18 +400,17 @@ XPCWrappedNativeScope::StartFinalization
 {
     // FIXME The lock may not be necessary since we are inside JSGC_MARK_END
     // callback and GX serializes access to JS runtime. See bug 380139.
     XPCAutoLock lock(rt->GetMapLock());
 
     // 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;
 
     while (cur) {
         // Sweep waivers.
         if (cur->mWaiverWrapperMap)
             cur->mWaiverWrapperMap->Sweep();
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -359,18 +359,18 @@ inline nsresult UnexpectedFailure(nsresu
     NS_ERROR("This is not supposed to fail!");
     return rv;
 }
 
 /* void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj); */
 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);
 
     XPCWrappedNativeScope* scope =
         XPCWrappedNativeScope::GetNewOrUsed(aJSContext, globalJSObj);
 
     if (!scope)
@@ -460,17 +460,17 @@ namespace xpc {
 JSObject*
 CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
                    JS::CompartmentOptions& aOptions)
 {
     // Make sure that Type Inference is enabled for everything non-chrome.
     // 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,
                         JS_NewGlobalObject(cx, clasp, nsJSPrincipals::get(principal),
                                            JS::DontFireOnNewGlobalHook, aOptions));
     if (!global)
         return nullptr;
     JSAutoCompartment ac(cx, global);
@@ -483,17 +483,17 @@ CreateGlobalObject(JSContext *cx, JSClas
     // work right for wrapped globals, since the tracing situation there is
     // more complicated. Manual inspection shows that they do the right thing.
     if (!((js::Class*)clasp)->ext.isWrappedNative)
     {
         VerifyTraceXPCGlobalCalledTracer trc;
         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
 
     if (clasp->flags & JSCLASS_DOM_GLOBAL) {
         AllocateProtoAndIfaceCache(global);
     }
 
     return global;
@@ -504,19 +504,19 @@ CreateGlobalObject(JSContext *cx, JSClas
 NS_IMETHODIMP
 nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
                                              nsISupports *aCOMObj,
                                              nsIPrincipal * aPrincipal,
                                              uint32_t aFlags,
                                              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.
     MOZ_ASSERT(aPrincipal);
 
     // Call into XPCWrappedNative to make a new global object, scope, and global
     // prototype.
     xpcObjectHelper helper(aCOMObj);
@@ -577,37 +577,34 @@ NativeInterface2JSObject(HandleObject aS
     JSAutoCompartment ac(cx, aScope);
 
     nsresult rv;
     xpcObjectHelper helper(aCOMObj, aCache);
     if (!XPCConvert::NativeInterface2JSObject(aVal, aHolder, helper, aIID,
                                               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;
 }
 
 /* nsIXPConnectJSObjectHolder wrapNative (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
 NS_IMETHODIMP
 nsXPConnect::WrapNative(JSContext * aJSContext,
                         JSObject * aScopeArg,
                         nsISupports *aCOMObj,
                         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);
     return NativeInterface2JSObject(aScope, aCOMObj, nullptr, &aIID,
                                     false, v.address(), aHolder);
 }
 
 /* void wrapNativeToJSVal (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDPtr aIID, out jsval aVal, out nsIXPConnectJSObjectHolder aHolder); */
@@ -616,19 +613,19 @@ nsXPConnect::WrapNativeToJSVal(JSContext
                                JSObject * aScopeArg,
                                nsISupports *aCOMObj,
                                nsWrapperCache *aCache,
                                const nsIID * aIID,
                                bool aAllowWrapping,
                                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;
 
     RootedObject aScope(aJSContext, aScopeArg);
 
     return NativeInterface2JSObject(aScope, aCOMObj, aCache, aIID,
                                     aAllowWrapping, aVal, aHolder);
@@ -636,19 +633,19 @@ nsXPConnect::WrapNativeToJSVal(JSContext
 
 /* void wrapJS (in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
 NS_IMETHODIMP
 nsXPConnect::WrapJS(JSContext * aJSContext,
                     JSObject * aJSObjArg,
                     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;
 
     RootedObject aJSObj(aJSContext, aJSObjArg);
     JSAutoCompartment ac(aJSContext, aJSObj);
 
     nsresult rv = NS_ERROR_UNEXPECTED;
     if (!XPCConvert::JSObject2NativeInterface(result, aJSObj,
@@ -674,20 +671,20 @@ nsXPConnect::JSValToVariant(JSContext *c
 /* void wrapJSAggregatedToNative (in nsISupports aOuter, in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
 NS_IMETHODIMP
 nsXPConnect::WrapJSAggregatedToNative(nsISupports *aOuter,
                                       JSContext * aJSContext,
                                       JSObject * aJSObjArg,
                                       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;
 
     RootedObject aJSObj(aJSContext, aJSObjArg);
     nsresult rv;
     if (!XPCConvert::JSObject2NativeInterface(result, aJSObj,
                                               &aIID, aOuter, &rv))
         return rv;
@@ -695,19 +692,19 @@ nsXPConnect::WrapJSAggregatedToNative(ns
 }
 
 /* nsIXPConnectWrappedNative getWrappedNativeOfJSObject (in JSContextPtr aJSContext, in JSObjectPtr aJSObj); */
 NS_IMETHODIMP
 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);
     if (aJSObj && IS_WN_REFLECTOR(aJSObj)) {
         NS_IF_ADDREF(*_retval = XPCWrappedNative::Get(aJSObj));
         return NS_OK;
     }
 
@@ -716,18 +713,18 @@ nsXPConnect::GetWrappedNativeOfJSObject(
     return NS_ERROR_FAILURE;
 }
 
 /* nsISupports getNativeOfWrapper(in JSContextPtr aJSContext, in JSObjectPtr  aJSObj); */
 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) {
         JS_ReportError(aJSContext, "Permission denied to get native of security wrapper");
         return nullptr;
     }
     if (IS_WN_REFLECTOR(aJSObj)) {
         if (XPCWrappedNative *wn = XPCWrappedNative::Get(aJSObj))
@@ -743,20 +740,20 @@ nsXPConnect::GetNativeOfWrapper(JSContex
 /* nsIXPConnectWrappedNative getWrappedNativeOfNativeObject (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
 NS_IMETHODIMP
 nsXPConnect::GetWrappedNativeOfNativeObject(JSContext * aJSContext,
                                             JSObject * aScopeArg,
                                             nsISupports *aCOMObj,
                                             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;
 
     RootedObject aScope(aJSContext, aScopeArg);
 
     XPCWrappedNativeScope* scope = GetObjectScope(aScope);
     if (!scope)
         return UnexpectedFailure(NS_ERROR_FAILURE);
@@ -865,31 +862,31 @@ nsXPConnect::SetDefaultSecurityManager(n
 NS_IMETHODIMP
 nsXPConnect::CreateStackFrameLocation(uint32_t aLanguage,
                                       const char *aFilename,
                                       const char *aFunctionName,
                                       int32_t aLineNumber,
                                       nsIStackFrame *aCaller,
                                       nsIStackFrame **_retval)
 {
-    NS_ASSERTION(_retval, "bad param");
+    MOZ_ASSERT(_retval, "bad param");
 
     return XPCJSStack::CreateStackFrameLocation(aLanguage,
                                                 aFilename,
                                                 aFunctionName,
                                                 aLineNumber,
                                                 aCaller,
                                                 _retval);
 }
 
 /* readonly attribute nsIStackFrame CurrentJSStack; */
 NS_IMETHODIMP
 nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
 {
-    NS_ASSERTION(aCurrentJSStack, "bad param");
+    MOZ_ASSERT(aCurrentJSStack, "bad param");
     *aCurrentJSStack = nullptr;
 
     // is there a current context available?
     if (JSContext *cx = GetCurrentJSContext()) {
         nsCOMPtr<nsIStackFrame> stack;
         XPCJSStack::CreateStack(cx, getter_AddRefs(stack));
         if (stack) {
             // peel off native frames...
@@ -907,17 +904,17 @@ nsXPConnect::GetCurrentJSStack(nsIStackF
     }
     return NS_OK;
 }
 
 /* readonly attribute nsIXPCNativeCallContext CurrentNativeCallContext; */
 NS_IMETHODIMP
 nsXPConnect::GetCurrentNativeCallContext(nsAXPCNativeCallContext * *aCurrentNativeCallContext)
 {
-    NS_ASSERTION(aCurrentNativeCallContext, "bad param");
+    MOZ_ASSERT(aCurrentNativeCallContext, "bad param");
 
     *aCurrentNativeCallContext = XPCJSRuntime::Get()->GetCallContext();
     return NS_OK;
 }
 
 /* void setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator); */
 NS_IMETHODIMP
 nsXPConnect::SetFunctionThisTranslator(const nsIID & aIID,
@@ -944,18 +941,18 @@ nsXPConnect::CreateSandbox(JSContext *cx
                            nsIXPConnectJSObjectHolder **_retval)
 {
     *_retval = nullptr;
 
     RootedValue rval(cx, JSVAL_VOID);
 
     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));
         NS_ENSURE_TRUE(*_retval, NS_ERROR_OUT_OF_MEMORY);
 
         NS_ADDREF(*_retval);
     }
 
@@ -1358,17 +1355,17 @@ IsJSContextOnStack(JSContext *aCx)
   return XPCJSRuntime::Get()->GetJSContextStack()->HasJSContext(aCx);
 }
 
 } // namespace xpc
 
 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) {
         if (allowShortCircuit) {
             nsIPrincipal *result = xpcWrapper->GetObjectPrincipal();
             if (result) {
                 return result;
             }
--- a/js/xpconnect/src/qsgen.py
+++ b/js/xpconnect/src/qsgen.py
@@ -958,19 +958,19 @@ def writeQuickStub(f, customMethodCalls,
         if canFail or debugGetter:
             f.write("%s = " % nsresultname)
         f.write("%s->%s(%s);\n" % (selfname, comName, args))
 
         if debugGetter:
             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")
 
     if canFail:
         # Check for errors.
         f.write("    if (NS_FAILED(rv))\n")
         if isMethod:
             f.write("        return xpc_qsThrowMethodFailed("
--- a/js/xpconnect/src/xpcObjectHelper.h
+++ b/js/xpconnect/src/xpcObjectHelper.h
@@ -48,17 +48,17 @@ public:
             mCanonicalStrong = do_QueryInterface(mObject);
             mCanonical = mCanonicalStrong;
         }
         return mCanonical;
     }
 
     already_AddRefed<nsISupports> forgetCanonical()
     {
-        NS_ASSERTION(mCanonical, "Huh, no canonical to forget?");
+        MOZ_ASSERT(mCanonical, "Huh, no canonical to forget?");
 
         if (!mCanonicalStrong)
             mCanonicalStrong = mCanonical;
         mCanonical = NULL;
         return mCanonicalStrong.forget();
     }
 
     nsIClassInfo *GetClassInfo()
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -306,23 +306,23 @@ inline JSObject* GetWNExpandoChain(JSObj
 #ifdef _MSC_VER
 #pragma warning(disable : 4355) // OK to pass "this" in member initializer
 #endif
 
 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();
     }
 
 // This is a cloned subset of nsAutoMonitor. We want the use of a monitor -
 // mostly because we need reenterability - but we also want to support passing
 // a null monitor in without things blowing up. This is used for wrappers that
 // are guaranteed to be used only on one thread. We avoid lock overhead by
 // using a null monitor. By changing this class we can avoid having multiplte
@@ -545,18 +545,18 @@ public:
 #ifdef DEBUG
         mNext = nullptr;
         mSelfp = nullptr;
 #endif
     }
 
     ~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; }
     void AddToRootSet(XPCLock *lock, XPCRootSetElem **listHead);
     void RemoveFromRootSet(XPCLock *lock);
 
 private:
     XPCRootSetElem *mNext;
@@ -581,17 +581,17 @@ public:
 
     bool init(JSContext* aContext, JSString* str)
     {
         size_t length;
         const jschar* chars = JS_GetStringCharsZAndLength(aContext, str, &length);
         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;
     }
 };
 
 // In the current xpconnect system there can only be one XPCJSRuntime.
 // So, xpconnect can only be used on one JSRuntime within the process.
 
@@ -706,27 +706,27 @@ public:
         IDX_PROTO                   ,
         IDX_ITERATOR                ,
         IDX_EXPOSEDPROPS            ,
         IDX_TOTAL_COUNT // just a count of the above
     };
 
     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];
     }
 
     void TraceNativeBlackRoots(JSTracer* trc) MOZ_OVERRIDE;
     void TraceAdditionalNativeGrayRoots(JSTracer* aTracer) MOZ_OVERRIDE;
     void TraverseAdditionalNativeRoots(nsCycleCollectionNoteRootCallback& cb) MOZ_OVERRIDE;
     void UnmarkSkippableJSHolders();
     void PrepareForForgetSkippable() MOZ_OVERRIDE;
@@ -913,17 +913,17 @@ private:
 
 // no virtuals
 class XPCContext
 {
     friend class XPCJSRuntime;
 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));
         }
 
     XPCJSRuntime* GetRuntime() const {return mRuntime;}
     JSContext* GetJSContext() const {return mJSContext;}
 
     enum LangType {LANG_UNKNOWN, LANG_JS, LANG_NATIVE};
 
@@ -1118,17 +1118,17 @@ private:
         HAVE_OBJECT,
         HAVE_NAME,
         HAVE_ARGS,
         READY_TO_CALL,
         CALL_DONE
     };
 
 #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
 
 private:
     mozilla::AutoPushJSContext      mPusher;
     State                           mState;
 
@@ -1497,18 +1497,18 @@ public:
                             XPCNativeMember**    pMember);
 
     jsid   GetName() const {return mName;}
 
     uint16_t GetIndex() const {return mIndex;}
 
     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,
                            JS::HandleObject parent, jsval* pval);
 
     bool IsMethod() const
         {return 0 != (mFlags & METHOD);}
 
@@ -1532,17 +1532,17 @@ public:
 
     void SetConstant(uint16_t index)
         {mFlags = CONSTANT; mIndex = index;}
 
     void SetReadOnlyAttribute(uint16_t index)
         {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);}
     ~XPCNativeMember() {MOZ_COUNT_DTOR(XPCNativeMember);}
 
 private:
     bool Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
                  JS::HandleObject parent, jsval *vp);
@@ -1583,17 +1583,17 @@ class XPCNativeInterface
     inline XPCNativeMember* FindMember(jsid name) const;
 
     inline bool HasAncestor(const nsIID* iid) const;
 
     uint16_t GetMemberCount() const {
         return mMemberCount;
     }
     XPCNativeMember* GetMemberAt(uint16_t i) {
-        NS_ASSERTION(i < mMemberCount, "bad index");
+        MOZ_ASSERT(i < mMemberCount, "bad index");
         return &mMembers[i];
     }
 
     void DebugDump(int16_t depth);
 
 #define XPC_NATIVE_IFACE_MARK_FLAG ((uint16_t)JS_BIT(15)) // only high bit of 16 is set
 
     void Mark() {
@@ -1743,17 +1743,17 @@ class XPCNativeSet
     uint16_t GetInterfaceCount() const {
         return mInterfaceCount;
     }
     XPCNativeInterface **GetInterfaceArray() {
         return mInterfaces;
     }
 
     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;
 
 #define XPC_NATIVE_SET_MARK_FLAG ((uint16_t)JS_BIT(15)) // only high bit of 16 is set
 
     inline void Mark();
 
@@ -2089,17 +2089,17 @@ public:
     bool ClassIsPluginObject()        GET_IT(PLUGIN_OBJECT)
 
 #undef GET_IT
 
     XPCLock* GetLock() const
         {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);
 
     void SystemIsBeingShutDown();
 
     void DebugDump(int16_t depth);
 
@@ -2288,17 +2288,17 @@ public:
 #define XPC_WRAPPER_EXPIRED (intptr_t(0x2))
 
     static inline bool
     IsTaggedScope(XPCWrappedNativeScope* s)
         {return XPC_SCOPE_WORD(s) & XPC_SCOPE_TAG;}
 
     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*
     UnTagScope(XPCWrappedNativeScope* s)
         {return (XPCWrappedNativeScope*)(XPC_SCOPE_WORD(s) & ~XPC_SCOPE_TAG);}
 
     inline bool
     IsWrapperExpired() const
@@ -3105,17 +3105,17 @@ public:
     NS_DEFINE_STATIC_CID_ACCESSOR(NS_JS_ID_CID)
 
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIJSID
 
     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());}
 
     static nsJSID* NewID(const char* str);
     static nsJSID* NewID(const nsID& id);
 
     nsJSID();
@@ -3413,17 +3413,17 @@ public:
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoResolveName()
         {
 #ifdef DEBUG
             jsid old =
 #endif
             XPCJSRuntime::Get()->SetResolveName(mOld);
-            NS_ASSERTION(old == mCheck, "Bad Nesting!");
+            MOZ_ASSERT(old == mCheck, "Bad Nesting!");
         }
 
 private:
     JS::RootedId mOld;
 #ifdef DEBUG
     JS::RootedId mCheck;
 #endif
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
--- a/js/xpconnect/wrappers/AccessCheck.cpp
+++ b/js/xpconnect/wrappers/AccessCheck.cpp
@@ -232,17 +232,17 @@ AccessCheck::isCrossOriginAccessPermitte
     // operations but fail silently (see CrossOriginAccessiblePropertiesOnly::
     // deny). We could just fall through here and rely on the fact that none
     // of the whitelisted properties below will match JSID_VOID, but EIBTI.
     if (id == JSID_VOID)
         return false;
 
     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
         name = clasp->name;
 
     if (JSID_IS_STRING(id)) {
         if (IsPermitted(name, JSID_TO_FLAT_STRING(id), act == Wrapper::SET))
             return true;
--- a/js/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/xpconnect/wrappers/WrapperFactory.cpp
@@ -290,17 +290,17 @@ WrapperFactory::PrepareForWrapping(JSCon
     RootedValue v(cx);
     nsresult rv =
         nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, wrapScope, wn->Native(), nullptr,
                                                     &NS_GET_IID(nsISupports), false,
                                                     v.address(), getter_AddRefs(holder));
     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.
     // This could be a problem for chrome code that passes XPCOM objects
     // across compartments, because the effects of QI would disappear across
     // compartments.
     //
     // So whenever we pull an XPCWN across compartments in this manner, we
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1030,18 +1030,17 @@ bool
 DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper,
                                      HandleObject holder, HandleId id,
                                      MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
 {
     RootedObject obj(cx, getTargetObject(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;
 }
 
 bool
 DOMXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper,
                                   HandleObject holder, HandleId id,
                                   MutableHandle<JSPropertyDescriptor> desc, unsigned flags)
@@ -1051,18 +1050,17 @@ DOMXrayTraits::resolveOwnProperty(JSCont
                                              id, desc, flags);
     if (!ok || desc.object())
         return ok;
 
     RootedObject obj(cx, getTargetObject(wrapper));
     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;
 }
 
 bool
 DOMXrayTraits::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
                               MutableHandle<JSPropertyDescriptor> desc,
                               Handle<JSPropertyDescriptor> existingDesc, bool *defined)
@@ -1165,21 +1163,21 @@ XrayWrapper<Base, Traits>::~XrayWrapper(
 {
 }
 
 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;
 }
 
 bool
 IsXrayResolving(JSContext *cx, HandleObject wrapper, HandleId id)
 {
     if (!WrapperFactory::IsXrayWrapper(wrapper) ||
         GetXrayType(wrapper) != XrayForWrappedNative)