Bug 712873 - Part 1: Replace JS_ASSERT with MOZ_ASSERT outside js/ directory. r=luke
authorChris Peterson <cpeterson@mozilla.com>
Mon, 17 Feb 2014 22:09:06 -0800
changeset 169629 c952f7937ec1eb1251fef2d3d506b63b2ed6445c
parent 169628 9da5cb817aae508800351853a862a1f7ab9e52e0
child 169630 28fa156efc31a3e832957b3643af9f59f7fcd3dd
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersluke
bugs712873
milestone30.0a1
Bug 712873 - Part 1: Replace JS_ASSERT with MOZ_ASSERT outside js/ directory. r=luke
dom/plugins/base/nsJSNPRuntime.cpp
dom/workers/File.cpp
dom/workers/WorkerPrivate.cpp
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1584,17 +1584,17 @@ NPObjWrapper_NewResolve(JSContext *cx, J
 
   // no property or method
   return true;
 }
 
 static bool
 NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::MutableHandle<JS::Value> vp)
 {
-  JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
+  MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
 
   // Plugins do not simply use JS_ConvertStub, and the default [[DefaultValue]]
   // behavior, because that behavior involves calling toString or valueOf on
   // objects which weren't designed to accommodate this.  Usually this wouldn't
   // be a problem, because the absence of either property, or the presence of
   // either property with a value that isn't callable, will cause that property
   // to simply be ignored.  But there is a problem in one specific case: Java,
   // specifically java.lang.Integer.  The Integer class has static valueOf
--- a/dom/workers/File.cpp
+++ b/dom/workers/File.cpp
@@ -41,17 +41,17 @@ public:
   {
     return JS_InitClass(aCx, aObj, JS::NullPtr(), &sClass, Construct, 0,
                         sProperties, sFunctions, nullptr, nullptr);
   }
 
   static JSObject*
   Create(JSContext* aCx, nsIDOMBlob* aBlob)
   {
-    JS_ASSERT(SameCOMIdentity(static_cast<nsISupports*>(aBlob), aBlob));
+    MOZ_ASSERT(SameCOMIdentity(static_cast<nsISupports*>(aBlob), aBlob));
 
     JSObject* obj = JS_NewObject(aCx, &sClass, JS::NullPtr(), JS::NullPtr());
     if (obj) {
       JS_SetPrivate(obj, aBlob);
       NS_ADDREF(aBlob);
     }
     return obj;
   }
@@ -96,17 +96,17 @@ private:
 
     JS_SET_RVAL(aCx, aVp, OBJECT_TO_JSVAL(obj));
     return true;
   }
 
   static void
   Finalize(JSFreeOp* aFop, JSObject* aObj)
   {
-    JS_ASSERT(JS_GetClass(aObj) == &sClass);
+    MOZ_ASSERT(JS_GetClass(aObj) == &sClass);
 
     nsIDOMBlob* blob = GetPrivate(aObj);
     NS_IF_RELEASE(blob);
   }
 
   static bool
   IsBlob(JS::Handle<JS::Value> v)
   {
@@ -243,17 +243,17 @@ public:
   {
     return JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct, 0,
                         sProperties, nullptr, nullptr, nullptr);
   }
 
   static JSObject*
   Create(JSContext* aCx, nsIDOMFile* aFile)
   {
-    JS_ASSERT(SameCOMIdentity(static_cast<nsISupports*>(aFile), aFile));
+    MOZ_ASSERT(SameCOMIdentity(static_cast<nsISupports*>(aFile), aFile));
 
     JSObject* obj = JS_NewObject(aCx, &sClass, JS::NullPtr(), JS::NullPtr());
     if (obj) {
       JS_SetPrivate(obj, aFile);
       NS_ADDREF(aFile);
     }
     return obj;
   }
@@ -261,17 +261,17 @@ public:
   static nsIDOMFile*
   GetPrivate(JSObject* aObj)
   {
     if (aObj) {
       const JSClass* classPtr = JS_GetClass(aObj);
       if (classPtr == &sClass) {
         nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aObj));
         nsCOMPtr<nsIDOMFile> file = do_QueryInterface(priv);
-        JS_ASSERT_IF(priv, file);
+        MOZ_ASSERT_IF(priv, file);
         return file;
       }
     }
     return nullptr;
   }
 
   static const JSClass*
   Class()
@@ -301,17 +301,17 @@ private:
                          JSMSG_WRONG_CONSTRUCTOR,
                          sClass.name);
     return false;
   }
 
   static void
   Finalize(JSFreeOp* aFop, JSObject* aObj)
   {
-    JS_ASSERT(JS_GetClass(aObj) == &sClass);
+    MOZ_ASSERT(JS_GetClass(aObj) == &sClass);
 
     nsIDOMFile* file = GetPrivate(aObj);
     NS_IF_RELEASE(file);
   }
 
   static bool
   IsFile(JS::Handle<JS::Value> v)
   {
@@ -445,17 +445,17 @@ const JSPropertySpec File::sProperties[]
 nsIDOMBlob*
 Blob::GetPrivate(JSObject* aObj)
 {
   if (aObj) {
     const JSClass* classPtr = JS_GetClass(aObj);
     if (classPtr == &sClass || classPtr == File::Class()) {
       nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aObj));
       nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(priv);
-      JS_ASSERT_IF(priv, blob);
+      MOZ_ASSERT_IF(priv, blob);
       return blob;
     }
   }
   return nullptr;
 }
 
 } // anonymous namespace
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -297,21 +297,21 @@ LogErrorToConsole(const nsAString& aMess
 struct WorkerStructuredCloneCallbacks
 {
   static JSObject*
   Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag,
        uint32_t aData, void* aClosure)
   {
     // See if object is a nsIDOMFile pointer.
     if (aTag == DOMWORKER_SCTAG_FILE) {
-      JS_ASSERT(!aData);
+      MOZ_ASSERT(!aData);
 
       nsIDOMFile* file;
       if (JS_ReadBytes(aReader, &file, sizeof(file))) {
-        JS_ASSERT(file);
+        MOZ_ASSERT(file);
 
 #ifdef DEBUG
         {
           // File should not be mutable.
           nsCOMPtr<nsIMutable> mutableFile = do_QueryInterface(file);
           bool isMutable;
           NS_ASSERTION(NS_SUCCEEDED(mutableFile->GetMutable(&isMutable)) &&
                        !isMutable,
@@ -322,21 +322,21 @@ struct WorkerStructuredCloneCallbacks
         // nsIDOMFiles should be threadsafe, thus we will use the same instance
         // in the worker.
         JSObject* jsFile = file::CreateFile(aCx, file);
         return jsFile;
       }
     }
     // See if object is a nsIDOMBlob pointer.
     else if (aTag == DOMWORKER_SCTAG_BLOB) {
-      JS_ASSERT(!aData);
+      MOZ_ASSERT(!aData);
 
       nsIDOMBlob* blob;
       if (JS_ReadBytes(aReader, &blob, sizeof(blob))) {
-        JS_ASSERT(blob);
+        MOZ_ASSERT(blob);
 
 #ifdef DEBUG
         {
           // Blob should not be mutable.
           nsCOMPtr<nsIMutable> mutableBlob = do_QueryInterface(blob);
           bool isMutable;
           NS_ASSERTION(NS_SUCCEEDED(mutableBlob->GetMutable(&isMutable)) &&
                        !isMutable,
@@ -347,17 +347,17 @@ struct WorkerStructuredCloneCallbacks
         // nsIDOMBlob should be threadsafe, thus we will use the same instance
         // in the worker.
         JSObject* jsBlob = file::CreateBlob(aCx, blob);
         return jsBlob;
       }
     }
     // See if the object is an ImageData.
     else if (aTag == SCTAG_DOM_IMAGEDATA) {
-      JS_ASSERT(!aData);
+      MOZ_ASSERT(!aData);
 
       // Read the information out of the stream.
       uint32_t width, height;
       JS::Rooted<JS::Value> dataArray(aCx);
       if (!JS_ReadUint32Pair(aReader, &width, &height) ||
           !JS_ReadTypedArray(aReader, dataArray.address()))
       {
         return nullptr;
@@ -454,21 +454,21 @@ struct MainThreadWorkerStructuredCloneCa
   static JSObject*
   Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag,
        uint32_t aData, void* aClosure)
   {
     AssertIsOnMainThread();
 
     // See if object is a nsIDOMFile pointer.
     if (aTag == DOMWORKER_SCTAG_FILE) {
-      JS_ASSERT(!aData);
+      MOZ_ASSERT(!aData);
 
       nsIDOMFile* file;
       if (JS_ReadBytes(aReader, &file, sizeof(file))) {
-        JS_ASSERT(file);
+        MOZ_ASSERT(file);
 
 #ifdef DEBUG
         {
           // File should not be mutable.
           nsCOMPtr<nsIMutable> mutableFile = do_QueryInterface(file);
           bool isMutable;
           NS_ASSERTION(NS_SUCCEEDED(mutableFile->GetMutable(&isMutable)) &&
                        !isMutable,
@@ -488,21 +488,21 @@ struct MainThreadWorkerStructuredCloneCa
           return nullptr;
         }
 
         return &wrappedFile.toObject();
       }
     }
     // See if object is a nsIDOMBlob pointer.
     else if (aTag == DOMWORKER_SCTAG_BLOB) {
-      JS_ASSERT(!aData);
+      MOZ_ASSERT(!aData);
 
       nsIDOMBlob* blob;
       if (JS_ReadBytes(aReader, &blob, sizeof(blob))) {
-        JS_ASSERT(blob);
+        MOZ_ASSERT(blob);
 
 #ifdef DEBUG
         {
           // Blob should not be mutable.
           nsCOMPtr<nsIMutable> mutableBlob = do_QueryInterface(blob);
           bool isMutable;
           NS_ASSERTION(NS_SUCCEEDED(mutableBlob->GetMutable(&isMutable)) &&
                        !isMutable,