Bug 842186 - Replace a few instances of jsval with JS::Value in the WorkerPrivate class. r=jwalden
authorJose Cortes <escozzia@gmail.com>
Wed, 20 Feb 2013 10:23:40 -0800
changeset 122473 3f00aa5f44b0c9fc336332a525fe5483e999f466
parent 122472 979456163be10b9b6dee9c98606a9b1827617348
child 122474 9c0f5c517fddcf0ea7b79675411ba2dcbdadcccb
push id24342
push userryanvm@gmail.com
push dateThu, 21 Feb 2013 13:05:06 +0000
treeherdermozilla-central@702d2814efbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs842186
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 842186 - Replace a few instances of jsval with JS::Value in the WorkerPrivate class. r=jwalden
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -188,27 +188,27 @@ struct WorkerStructuredCloneCallbacks
       }
     }
     // See if the object is an ImageData.
     else if (aTag == SCTAG_DOM_IMAGEDATA) {
       JS_ASSERT(!aData);
 
       // Read the information out of the stream.
       uint32_t width, height;
-      jsval dataArray;
+      JS::Value dataArray;
       if (!JS_ReadUint32Pair(aReader, &width, &height) ||
           !JS_ReadTypedArray(aReader, &dataArray))
       {
         return nullptr;
       }
       MOZ_ASSERT(dataArray.isObject());
 
       // Construct the ImageData.
       JSObject* obj = imagedata::Create(aCx, width, height,
-                                        JSVAL_TO_OBJECT(dataArray));
+                                        &dataArray.toObject());
       return obj;
     }
 
     Error(aCx, 0);
     return nullptr;
   }
 
   static JSBool
@@ -301,26 +301,26 @@ struct MainThreadWorkerStructuredCloneCa
           NS_ASSERTION(NS_SUCCEEDED(mutableFile->GetMutable(&isMutable)) &&
                        !isMutable,
                        "Only immutable file should be passed to worker");
         }
 #endif
 
         // nsIDOMFiles should be threadsafe, thus we will use the same instance
         // on the main thread.
-        jsval wrappedFile;
+        JS::Value wrappedFile;
         nsresult rv =
           nsContentUtils::WrapNative(aCx, JS_GetGlobalForScopeChain(aCx), file,
                                      &NS_GET_IID(nsIDOMFile), &wrappedFile);
         if (NS_FAILED(rv)) {
           Error(aCx, DATA_CLONE_ERR);
           return nullptr;
         }
 
-        return JSVAL_TO_OBJECT(wrappedFile);
+        return &wrappedFile.toObject();
       }
     }
     // See if object is a nsIDOMBlob pointer.
     else if (aTag == DOMWORKER_SCTAG_BLOB) {
       JS_ASSERT(!aData);
 
       nsIDOMBlob* blob;
       if (JS_ReadBytes(aReader, &blob, sizeof(blob))) {
@@ -334,26 +334,26 @@ struct MainThreadWorkerStructuredCloneCa
           NS_ASSERTION(NS_SUCCEEDED(mutableBlob->GetMutable(&isMutable)) &&
                        !isMutable,
                        "Only immutable blob should be passed to worker");
         }
 #endif
 
         // nsIDOMBlobs should be threadsafe, thus we will use the same instance
         // on the main thread.
-        jsval wrappedBlob;
+        JS::Value wrappedBlob;
         nsresult rv =
           nsContentUtils::WrapNative(aCx, JS_GetGlobalForScopeChain(aCx), blob,
                                      &NS_GET_IID(nsIDOMBlob), &wrappedBlob);
         if (NS_FAILED(rv)) {
           Error(aCx, DATA_CLONE_ERR);
           return nullptr;
         }
 
-        return JSVAL_TO_OBJECT(wrappedBlob);
+        return &wrappedBlob.toObject();
       }
     }
 
     JS_ClearPendingException(aCx);
     return NS_DOMReadStructuredClone(aCx, aReader, aTag, aData, nullptr);
   }
 
   static JSBool
@@ -2151,18 +2151,19 @@ WorkerPrivateParent<Derived>::ForgetMain
   SwapToISupportsArray(mPrincipal, aDoomed);
   SwapToISupportsArray(mCSP, aDoomed);
 
   mMainThreadObjectsForgotten = true;
 }
 
 template <class Derived>
 bool
-WorkerPrivateParent<Derived>::PostMessage(JSContext* aCx, jsval aMessage,
-                                          jsval aTransferable)
+WorkerPrivateParent<Derived>::PostMessage(JSContext* aCx,
+                                          JS::Value aMessage,
+                                          JS::Value aTransferable)
 {
   AssertIsOnParentThread();
 
   {
     MutexAutoLock lock(mMutex);
     if (mParentStatus > Running) {
       return true;
     }
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -344,17 +344,17 @@ public:
 
   bool
   RootJSObject(JSContext* aCx, bool aRoot);
 
   void
   ForgetMainThreadObjects(nsTArray<nsCOMPtr<nsISupports> >& aDoomed);
 
   bool
-  PostMessage(JSContext* aCx, jsval aMessage, jsval aTransferable);
+  PostMessage(JSContext* aCx, JS::Value aMessage, JS::Value aTransferable);
 
   uint64_t
   GetInnerWindowId();
 
   void
   UpdateJSContextOptions(JSContext* aCx, uint32_t aOptions);
 
   void