Bug 842186 - Update instances of jsval to JS::Value in .cpp and .h files within the toolkit and netwerk directories. r=jwalden
authorJose Cortes <escozzia@gmail.com>
Wed, 06 Mar 2013 13:16:46 -0800
changeset 135237 1deed14c3a6b1128878bfcf93ccc73b37706b5c7
parent 135236 761cb9b8686297882fe0ac73f301373237892fcf
child 135238 4a5a0a07f4f676438a6dd20d0284fdb1e75d0c88
push id336
push userakeybl@mozilla.com
push dateMon, 17 Jun 2013 22:53:19 +0000
treeherdermozilla-release@574a39cdf657 [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 - Update instances of jsval to JS::Value in .cpp and .h files within the toolkit and netwerk directories. r=jwalden
netwerk/base/src/Dashboard.cpp
netwerk/base/src/ProxyAutoConfig.cpp
netwerk/base/src/ProxyAutoConfig.h
toolkit/components/ctypes/ctypes.cpp
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/places/History.cpp
toolkit/components/places/PlaceInfo.cpp
toolkit/components/reflect/reflect.cpp
toolkit/components/telemetry/Telemetry.cpp
toolkit/xre/nsEmbedFunctions.cpp
--- a/netwerk/base/src/Dashboard.cpp
+++ b/netwerk/base/src/Dashboard.cpp
@@ -57,17 +57,17 @@ Dashboard::GetSocketsDispatch()
         gSocketTransportService->GetSocketConnections(&mSock.data);
     nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &Dashboard::GetSockets);
     mSock.thread->Dispatch(event, NS_DISPATCH_NORMAL);
 }
 
 nsresult
 Dashboard::GetSockets()
 {
-    jsval val;
+    JS::Value val;
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JSAutoRequest request(cx);
 
     JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr);
     if (!finalObject)
         return NS_ERROR_OUT_OF_MEMORY;
 
     CREATE_ARRAY_OBJECT(hostJs);
@@ -133,17 +133,17 @@ Dashboard::GetHttpDispatch()
     nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &Dashboard::GetHttpConnections);
     mHttp.thread->Dispatch(event, NS_DISPATCH_NORMAL);
 }
 
 
 nsresult
 Dashboard::GetHttpConnections()
 {
-    jsval val;
+    JS::Value val;
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JSAutoRequest request(cx);
 
     JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr);
     if (!finalObject)
         return NS_ERROR_OUT_OF_MEMORY;
 
     CREATE_ARRAY_OBJECT(hostJs);
@@ -283,17 +283,17 @@ Dashboard::RequestWebsocketConnections(N
     nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &Dashboard::GetWebSocketConnections);
     mWs.thread->Dispatch(event, NS_DISPATCH_NORMAL);
     return NS_OK;
 }
 
 nsresult
 Dashboard::GetWebSocketConnections()
 {
-    jsval val;
+    JS::Value val;
     JSString* jsstring;
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JSAutoRequest request(cx);
 
     JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr);
     if (!finalObject)
         return NS_ERROR_OUT_OF_MEMORY;
 
@@ -357,17 +357,17 @@ Dashboard::GetDnsInfoDispatch()
         mDns.serv->GetDNSCacheEntries(&mDns.data);
     nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &Dashboard::GetDNSCacheEntries);
     mDns.thread->Dispatch(event, NS_DISPATCH_NORMAL);
 }
 
 nsresult
 Dashboard::GetDNSCacheEntries()
 {
-    jsval val;
+    JS::Value val;
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JSAutoRequest request(cx);
 
     JSObject* finalObject = JS_NewObject(cx, nullptr, nullptr, nullptr);
     if (!finalObject)
        return NS_ERROR_OUT_OF_MEMORY;
 
     CREATE_ARRAY_OBJECT(nameJs);
--- a/netwerk/base/src/ProxyAutoConfig.cpp
+++ b/netwerk/base/src/ProxyAutoConfig.cpp
@@ -376,17 +376,17 @@ bool PACResolveToString(const nsCString 
     return false;
 
   aDottedDecimal.Assign(dottedDecimal);
   return true;
 }
 
 // dnsResolve(host) javascript implementation
 static
-JSBool PACDnsResolve(JSContext *cx, unsigned int argc, jsval *vp)
+JSBool PACDnsResolve(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   if (NS_IsMainThread()) {
     NS_WARNING("DNS Resolution From PAC on Main Thread. How did that happen?");
     return false;
   }
 
   JSString *arg1 = nullptr;
   if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &arg1))
@@ -405,34 +405,34 @@ JSBool PACDnsResolve(JSContext *cx, unsi
     JS_SET_RVAL(cx, vp, JSVAL_NULL);
   }
   
   return true;
 }
 
 // myIpAddress() javascript implementation
 static
-JSBool PACMyIpAddress(JSContext *cx, unsigned int argc, jsval *vp)
+JSBool PACMyIpAddress(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   if (NS_IsMainThread()) {
     NS_WARNING("DNS Resolution From PAC on Main Thread. How did that happen?");
     return false;
   }
 
   if (!sRunning) {
     NS_WARNING("PAC myIPAddress without a running ProxyAutoConfig object");
     return JS_FALSE;
   }
 
   return sRunning->MyIPAddress(vp);
 }
 
 // proxyAlert(msg) javascript implementation
 static
-JSBool PACProxyAlert(JSContext *cx, unsigned int argc, jsval *vp)
+JSBool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
 {
   JSString *arg1 = nullptr;
   if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &arg1))
     return false;
 
   nsDependentJSString message;
   if (!message.init(cx, arg1))
     return false;
@@ -635,18 +635,18 @@ ProxyAutoConfig::GetProxyForURI(const ns
   nsresult rv = NS_ERROR_FAILURE;
   js::RootedString uriString(cx, JS_NewStringCopyZ(cx, aTestURI.get()));
   js::RootedString hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
 
   if (uriString && hostString) {
     js::RootedValue uriValue(cx, STRING_TO_JSVAL(uriString));
     js::RootedValue hostValue(cx, STRING_TO_JSVAL(hostString));
 
-    jsval argv[2] = { uriValue, hostValue };
-    jsval rval;
+    JS::Value argv[2] = { uriValue, hostValue };
+    JS::Value rval;
     JSBool ok = JS_CallFunctionName(cx, mJSRuntime->Global(),
                                     "FindProxyForURL", 2, argv, &rval);
 
     if (ok && rval.isString()) {
       nsDependentJSString pacString;
       if (pacString.init(cx, rval.toString())) {
         CopyUTF16toUTF8(pacString, result);
         rv = NS_OK;
@@ -723,34 +723,34 @@ ProxyAutoConfig::SrcAddress(const NetAdd
 
 // hostName is run through a dns lookup and then a udp socket is connected
 // to the result. If that all works, the local IP address of the socket is
 // returned to the javascript caller and true is returned from this function.
 // otherwise false is returned.
 bool
 ProxyAutoConfig::MyIPAddressTryHost(const nsCString &hostName,
                                     unsigned int timeout,
-                                    jsval *vp)
+                                    JS::Value *vp)
 {
   NetAddr remoteAddress;
   nsAutoCString localDottedDecimal;
   JSContext *cx = mJSRuntime->Context();
 
   if (PACResolve(hostName, &remoteAddress, timeout) &&
       SrcAddress(&remoteAddress, localDottedDecimal)) {
     JSString *dottedDecimalString =
       JS_NewStringCopyZ(cx, localDottedDecimal.get());
     JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(dottedDecimalString));
     return true;
   }
   return false;
 }
 
 bool
-ProxyAutoConfig::MyIPAddress(jsval *vp)
+ProxyAutoConfig::MyIPAddress(JS::Value *vp)
 {
   nsAutoCString remoteDottedDecimal;
   nsAutoCString localDottedDecimal;
   JSContext *cx = mJSRuntime->Context();
 
   // first, lookup the local address of a socket connected
   // to the host of uri being resolved by the pac file. This is
   // v6 safe.. but is the last step like that
--- a/netwerk/base/src/ProxyAutoConfig.h
+++ b/netwerk/base/src/ProxyAutoConfig.h
@@ -32,17 +32,17 @@ public:
     MOZ_COUNT_CTOR(ProxyAutoConfig);
   }
   ~ProxyAutoConfig();
 
   nsresult Init(const nsCString &aPACURI,
                 const nsCString &aPACScript);
   void     Shutdown();
   void     GC();
-  bool     MyIPAddress(jsval *vp);
+  bool     MyIPAddress(JS::Value *vp);
   bool     ResolveAddress(const nsCString &aHostName,
                           NetAddr *aNetAddr, unsigned int aTimeout);
 
   /**
    * Get the proxy string for the specified URI.  The proxy string is
    * given by the following:
    *
    *   result      = proxy-spec *( proxy-sep proxy-spec )
@@ -82,17 +82,17 @@ public:
 private:
   const static unsigned int kTimeout = 1000; // ms to allow for myipaddress dns queries
 
   // used to compile the PAC file and setup the execution context
   nsresult SetupJS();
 
   bool SrcAddress(const NetAddr *remoteAddress, nsCString &localAddress);
   bool MyIPAddressTryHost(const nsCString &hostName, unsigned int timeout,
-                          jsval *vp);
+                          JS::Value *vp);
 
   JSRuntimeWrapper *mJSRuntime;
   bool              mJSNeedsSetup;
   bool              mShutdown;
   nsCString         mPACScript;
   nsCString         mPACURI;
   nsCString         mRunningHost;
   nsCOMPtr<nsITimer> mTimer;
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -61,17 +61,17 @@ Module::~Module()
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 static JSBool
 SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
 {
-  jsval prop;
+  JS::Value prop;
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
 
   if (prop.isUndefined()) {
     // Pretend we sealed the object.
     return true;
   }
 
@@ -86,17 +86,17 @@ SealObjectAndPrototype(JSContext* cx, JS
 static JSBool
 InitAndSealCTypesClass(JSContext* cx, JSObject* global)
 {
   // Init the ctypes object.
   if (!JS_InitCTypesClass(cx, global))
     return false;
 
   // Set callbacks for charset conversion and such.
-  jsval ctypes;
+  JS::Value ctypes;
   if (!JS_GetProperty(cx, global, "ctypes", &ctypes))
     return false;
 
   JS_SetCTypesCallbacks(JSVAL_TO_OBJECT(ctypes), &sCallbacks);
 
   // Seal up Object, Function, Array and Error and their prototypes.  (This
   // single object instance is shared amongst everyone who imports the ctypes
   // module.)
@@ -111,18 +111,18 @@ InitAndSealCTypesClass(JSContext* cx, JS
   return JS_FreezeObject(cx, global);
 }
 
 NS_IMETHODIMP
 Module::Call(nsIXPConnectWrappedNative* wrapper,
              JSContext* cx,
              JSObject* obj,
              uint32_t argc,
-             jsval* argv,
-             jsval* vp,
+             JS::Value* argv,
+             JS::Value* vp,
              bool* _retval)
 {
   JSObject* targetObj = nullptr;
 
   mozJSComponentLoader* loader = mozJSComponentLoader::Get();
   nsresult rv = loader->FindTargetObject(cx, &targetObj);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -36,17 +36,17 @@ Module::~Module()
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 static JSBool
 SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
 {
-  jsval prop;
+  JS::Value prop;
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
 
   if (prop.isUndefined()) {
     // Pretend we sealed the object.
     return true;
   }
 
@@ -77,18 +77,18 @@ InitAndSealPerfMeasurementClass(JSContex
   return JS_FreezeObject(cx, global);
 }
 
 NS_IMETHODIMP
 Module::Call(nsIXPConnectWrappedNative* wrapper,
              JSContext* cx,
              JSObject* obj,
              uint32_t argc,
-             jsval* argv,
-             jsval* vp,
+             JS::Value* argv,
+             JS::Value* vp,
              bool* _retval)
 {
   JSObject* targetObj = nullptr;
 
   mozJSComponentLoader* loader = mozJSComponentLoader::Get();
   nsresult rv = loader->FindTargetObject(cx, &targetObj);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -226,17 +226,17 @@ namespace {
  *        The name of the property to get the URI from.
  * @return the URI if it exists.
  */
 already_AddRefed<nsIURI>
 GetURIFromJSObject(JSContext* aCtx,
                    JSObject* aObject,
                    const char* aProperty)
 {
-  jsval uriVal;
+  JS::Value uriVal;
   JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal);
   NS_ENSURE_TRUE(rc, nullptr);
 
   if (!JSVAL_IS_PRIMITIVE(uriVal)) {
     nsCOMPtr<nsIXPConnect> xpc = mozilla::services::GetXPConnect();
 
     nsCOMPtr<nsIXPConnectWrappedNative> wrappedObj;
     nsresult rv = xpc->GetWrappedNativeOfJSObject(aCtx, JSVAL_TO_OBJECT(uriVal),
@@ -261,17 +261,17 @@ GetURIFromJSObject(JSContext* aCtx,
  *        The string to populate with the value, or set it to void.
  */
 void
 GetStringFromJSObject(JSContext* aCtx,
                       JSObject* aObject,
                       const char* aProperty,
                       nsString& _string)
 {
-  jsval val;
+  JS::Value val;
   JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val);
   if (!rc || JSVAL_IS_VOID(val) ||
       !(JSVAL_IS_NULL(val) || JSVAL_IS_STRING(val))) {
     _string.SetIsVoid(true);
     return;
   }
   // |null| in JS maps to the empty string.
   if (JSVAL_IS_NULL(val)) {
@@ -302,17 +302,17 @@ GetStringFromJSObject(JSContext* aCtx,
  */
 template <typename IntType>
 nsresult
 GetIntFromJSObject(JSContext* aCtx,
                    JSObject* aObject,
                    const char* aProperty,
                    IntType* _int)
 {
-  jsval value;
+  JS::Value value;
   JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
   NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
   if (JSVAL_IS_VOID(value)) {
     return NS_ERROR_INVALID_ARG;
   }
   NS_ENSURE_ARG(JSVAL_IS_PRIMITIVE(value));
   NS_ENSURE_ARG(JSVAL_IS_NUMBER(value));
 
@@ -343,17 +343,17 @@ nsresult
 GetJSObjectFromArray(JSContext* aCtx,
                      JSObject* aArray,
                      uint32_t aIndex,
                      JSObject** _rooter)
 {
   NS_PRECONDITION(JS_IsArrayObject(aCtx, aArray),
                   "Must provide an object that is an array!");
 
-  jsval value;
+  JS::Value value;
   JSBool rc = JS_GetElement(aCtx, aArray, aIndex, &value);
   NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
   NS_ENSURE_ARG(!JSVAL_IS_PRIMITIVE(value));
   *_rooter = JSVAL_TO_OBJECT(value);
   return NS_OK;
 }
 
 class VisitedQuery : public AsyncStatementCallback
@@ -2532,17 +2532,17 @@ History::RemoveAllDownloads()
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIAsyncHistory
 
 NS_IMETHODIMP
-History::UpdatePlaces(const jsval& aPlaceInfos,
+History::UpdatePlaces(const JS::Value& aPlaceInfos,
                       mozIVisitInfoCallback* aCallback,
                       JSContext* aCtx)
 {
   NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_UNEXPECTED);
   NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(aPlaceInfos), NS_ERROR_INVALID_ARG);
 
   uint32_t infosLength = 1;
   JSObject* infos;
@@ -2593,17 +2593,17 @@ History::UpdatePlaces(const jsval& aPlac
     bool isValidGUID = IsValidGUID(guid);
     NS_ENSURE_ARG(guid.IsVoid() || isValidGUID);
 
     nsString title;
     GetStringFromJSObject(aCtx, info, "title", title);
 
     JSObject* visits = NULL;
     {
-      jsval visitsVal;
+      JS::Value visitsVal;
       JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal);
       NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
       if (!JSVAL_IS_PRIMITIVE(visitsVal)) {
         visits = JSVAL_TO_OBJECT(visitsVal);
         NS_ENSURE_ARG(JS_IsArrayObject(aCtx, visits));
       }
     }
     NS_ENSURE_ARG(visits);
--- a/toolkit/components/places/PlaceInfo.cpp
+++ b/toolkit/components/places/PlaceInfo.cpp
@@ -66,17 +66,17 @@ NS_IMETHODIMP
 PlaceInfo::GetFrecency(int64_t* _frecency)
 {
   *_frecency = mFrecency;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PlaceInfo::GetVisits(JSContext* aContext,
-                     jsval* _visits)
+                     JS::Value* _visits)
 {
   // TODO bug 625913 when we use this in situations that have more than one
   // visit here, we will likely want to make this cache the value.
   JSObject* visits = JS_NewArrayObject(aContext, 0, NULL);
   NS_ENSURE_TRUE(visits, NS_ERROR_OUT_OF_MEMORY);
 
   JSObject* global = JS_GetGlobalForScopeChain(aContext);
   NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
@@ -88,17 +88,17 @@ PlaceInfo::GetVisits(JSContext* aContext
     nsresult rv = xpc->WrapNative(aContext, global, mVisits[idx],
                                   NS_GET_IID(mozIVisitInfo),
                                   getter_AddRefs(wrapper));
     NS_ENSURE_SUCCESS(rv, rv);
 
     JSObject* jsobj;
     rv = wrapper->GetJSObject(&jsobj);
     NS_ENSURE_SUCCESS(rv, rv);
-    jsval wrappedVisit = OBJECT_TO_JSVAL(jsobj);
+    JS::Value wrappedVisit = OBJECT_TO_JSVAL(jsobj);
 
     JSBool rc = JS_SetElement(aContext, visits, idx, &wrappedVisit);
     NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
   }
 
   *_visits = OBJECT_TO_JSVAL(visits);
 
   return NS_OK;
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -37,18 +37,18 @@ Module::~Module()
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 NS_IMETHODIMP
 Module::Call(nsIXPConnectWrappedNative* wrapper,
              JSContext* cx,
              JSObject* obj,
              uint32_t argc,
-             jsval* argv,
-             jsval* vp,
+             JS::Value* argv,
+             JS::Value* vp,
              bool* _retval)
 {
   JSObject* global = JS_GetGlobalForScopeChain(cx);
   if (!global)
     return NS_ERROR_NOT_AVAILABLE;
 
   *_retval = !!JS_InitReflect(cx, global);
   return NS_OK;
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -284,17 +284,17 @@ private:
                                    JSObject *obj);
   static bool ReflectOtherThreadsSQL(SlowSQLEntryType *entry, JSContext *cx,
                                      JSObject *obj);
   static bool ReflectSQL(const SlowSQLEntryType *entry, const Stat *stat,
                          JSContext *cx, JSObject *obj);
 
   bool AddSQLInfo(JSContext *cx, JSObject *rootObj, bool mainThread,
                   bool privateSQL);
-  bool GetSQLStats(JSContext *cx, jsval *ret, bool includePrivateSql);
+  bool GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql);
 
   // Like GetHistogramById, but returns the underlying C++ object, not the JS one.
   nsresult GetHistogramByName(const nsACString &name, Histogram **ret);
   bool ShouldReflectHistogram(Histogram *h);
   void IdentifyCorruptHistograms(StatisticsRecorder::Histograms &hs);
   typedef StatisticsRecorder::Histograms::iterator HistogramIterator;
 
   struct AddonHistogramInfo {
@@ -610,24 +610,24 @@ IsEmpty(const Histogram *h)
 {
   Histogram::SampleSet ss;
   h->SnapshotSample(&ss);
 
   return ss.counts(0) == 0 && ss.sum() == 0;
 }
 
 JSBool
-JSHistogram_Add(JSContext *cx, unsigned argc, jsval *vp)
+JSHistogram_Add(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   if (!argc) {
     JS_ReportError(cx, "Expected one argument");
     return JS_FALSE;
   }
 
-  jsval v = JS_ARGV(cx, vp)[0];
+  JS::Value v = JS_ARGV(cx, vp)[0];
 
   if (!(JSVAL_IS_NUMBER(v) || JSVAL_IS_BOOLEAN(v))) {
     JS_ReportError(cx, "Not a number");
     return JS_FALSE;
   }
 
   int32_t value;
   if (!JS_ValueToECMAInt32(cx, v, &value)) {
@@ -642,17 +642,17 @@ JSHistogram_Add(JSContext *cx, unsigned 
 
     Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
     h->Add(value);
   }
   return JS_TRUE;
 }
 
 JSBool
-JSHistogram_Snapshot(JSContext *cx, unsigned argc, jsval *vp)
+JSHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   JSObject *obj = JS_THIS_OBJECT(cx, vp);
   if (!obj) {
     return JS_FALSE;
   }
 
   Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
   JSObject *snapshot = JS_NewObject(cx, nullptr, nullptr, nullptr);
@@ -671,30 +671,30 @@ JSHistogram_Snapshot(JSContext *cx, unsi
     return JS_TRUE;
   default:
     MOZ_NOT_REACHED("unhandled reflection status");
     return JS_FALSE;
   }
 }
 
 JSBool
-JSHistogram_Clear(JSContext *cx, unsigned argc, jsval *vp)
+JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   JSObject *obj = JS_THIS_OBJECT(cx, vp);
   if (!obj) {
     return JS_FALSE;
   }
 
   Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
   h->Clear();
   return JS_TRUE;
 }
 
 nsresult 
-WrapAndReturnHistogram(Histogram *h, JSContext *cx, jsval *ret)
+WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::Value *ret)
 {
   static JSClass JSHistogram_class = {
     "JSHistogram",  /* name */
     JSCLASS_HAS_PRIVATE, /* flags */
     JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
     JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
   };
 
@@ -969,17 +969,19 @@ mFailedLockCount(0)
 }
 
 TelemetryImpl::~TelemetryImpl() {
   NS_UnregisterMemoryReporter(mMemoryReporter);
   mMemoryReporter = nullptr;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::NewHistogram(const nsACString &name, uint32_t min, uint32_t max, uint32_t bucketCount, uint32_t histogramType, JSContext *cx, jsval *ret)
+TelemetryImpl::NewHistogram(const nsACString &name, uint32_t min, uint32_t max,
+                            uint32_t bucketCount, uint32_t histogramType,
+                            JSContext *cx, JS::Value *ret)
 {
   Histogram *h;
   nsresult rv = HistogramGet(PromiseFlatCString(name).get(), min, max, bucketCount, histogramType, &h);
   if (NS_FAILED(rv))
     return rv;
   h->ClearFlags(Histogram::kUmaTargetedHistogramFlag);
   h->SetFlags(Histogram::kExtendedStatisticsFlag);
   return WrapAndReturnHistogram(h, cx, ret);
@@ -990,18 +992,18 @@ TelemetryImpl::ReflectSQL(const SlowSQLE
                           const Stat *stat,
                           JSContext *cx,
                           JSObject *obj)
 {
   if (stat->hitCount == 0)
     return true;
 
   const nsACString &sql = entry->GetKey();
-  jsval hitCount = UINT_TO_JSVAL(stat->hitCount);
-  jsval totalTime = UINT_TO_JSVAL(stat->totalTime);
+  JS::Value hitCount = UINT_TO_JSVAL(stat->hitCount);
+  JS::Value totalTime = UINT_TO_JSVAL(stat->totalTime);
 
   JSObject *arrayObj = JS_NewArrayObject(cx, 0, nullptr);
   if (!arrayObj) {
     return false;
   }
   JS::AutoObjectRooter root(cx, arrayObj);
   return (JS_SetElement(cx, arrayObj, 0, &hitCount)
           && JS_SetElement(cx, arrayObj, 1, &totalTime)
@@ -1090,17 +1092,17 @@ TelemetryImpl::GetHistogramByName(const 
   if (NS_FAILED(rv))
     return rv;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelemetryImpl::HistogramFrom(const nsACString &name, const nsACString &existing_name,
-                             JSContext *cx, jsval *ret)
+                             JSContext *cx, JS::Value *ret)
 {
   Histogram *existing;
   nsresult rv = GetHistogramByName(existing_name, &existing);
   if (NS_FAILED(rv))
     return rv;
 
   uint32_t histogramType;
   bool success = TelemetryHistogramType(existing, &histogramType);
@@ -1230,17 +1232,17 @@ TelemetryImpl::RegisterAddonHistogram(co
   info.bucketCount = bucketCount;
   info.histogramType = histogramType;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetAddonHistogram(const nsACString &id, const nsACString &name,
-                                 JSContext *cx, jsval *ret)
+                                 JSContext *cx, JS::Value *ret)
 {
   AddonEntryType *addonEntry = mAddonMap.GetEntry(id);
   // The given id has not been registered.
   if (!addonEntry) {
     return NS_ERROR_INVALID_ARG;
   }
 
   AddonHistogramMapType *histogramMap = addonEntry->mData;
@@ -1273,17 +1275,17 @@ TelemetryImpl::UnregisterAddonHistograms
     delete addonEntry->mData;
     mAddonMap.RemoveEntry(id);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetHistogramSnapshots(JSContext *cx, jsval *ret)
+TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
 {
   JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
   if (!root_obj)
     return NS_ERROR_FAILURE;
   *ret = OBJECT_TO_JSVAL(root_obj);
 
   // Ensure that all the HISTOGRAM_FLAG histograms have been created, so
   // that their values are snapshotted.
@@ -1417,34 +1419,34 @@ TelemetryImpl::AddonReflector(AddonEntry
                              OBJECT_TO_JSVAL(subobj), NULL, NULL,
                              JSPROP_ENUMERATE))) {
     return false;
   }
   return true;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, jsval *ret)
+TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
 {
   *ret = JSVAL_VOID;
   JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
   if (!obj) {
     return NS_ERROR_FAILURE;
   }
   JS::AutoObjectRooter r(cx, obj);
 
   if (!mAddonMap.ReflectIntoJS(AddonReflector, cx, obj)) {
     return NS_ERROR_FAILURE;
   }
   *ret = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
 bool
-TelemetryImpl::GetSQLStats(JSContext *cx, jsval *ret, bool includePrivateSql)
+TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql)
 {
   JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
   if (!root_obj)
     return false;
   *ret = OBJECT_TO_JSVAL(root_obj);
 
   MutexAutoLock hashMutex(mHashMutex);
   // Add info about slow SQL queries on the main thread
@@ -1453,35 +1455,35 @@ TelemetryImpl::GetSQLStats(JSContext *cx
   // Add info about slow SQL queries on other threads
   if (!AddSQLInfo(cx, root_obj, false, includePrivateSql))
     return false;
   
   return true;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetSlowSQL(JSContext *cx, jsval *ret)
+TelemetryImpl::GetSlowSQL(JSContext *cx, JS::Value *ret)
 {
   if (GetSQLStats(cx, ret, false))
     return NS_OK;
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetDebugSlowSQL(JSContext *cx, jsval *ret)
+TelemetryImpl::GetDebugSlowSQL(JSContext *cx, JS::Value *ret)
 {
   bool revealPrivateSql =
     Preferences::GetBool("toolkit.telemetry.debugSlowSql", false);
   if (GetSQLStats(cx, ret, revealPrivateSql))
     return NS_OK;
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetChromeHangs(JSContext *cx, jsval *ret)
+TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
 {
   MutexAutoLock hangReportMutex(mHangReportsMutex);
 
   const CombinedStacks& stacks = mHangReports.GetStacks();
   JSObject *fullReportObj = CreateJSStackObject(cx, stacks);
   if (!fullReportObj) {
     return NS_ERROR_FAILURE;
   }
@@ -1496,17 +1498,17 @@ TelemetryImpl::GetChromeHangs(JSContext 
                                 OBJECT_TO_JSVAL(durationArray),
                                 NULL, NULL, JSPROP_ENUMERATE);
   if (!ok) {
     return NS_ERROR_FAILURE;
   }
 
   const size_t length = stacks.GetStackCount();
   for (size_t i = 0; i < length; ++i) {
-    jsval duration = INT_TO_JSVAL(mHangReports.GetDuration(i));
+    JS::Value duration = INT_TO_JSVAL(mHangReports.GetDuration(i));
     if (!JS_SetElement(cx, durationArray, i, &duration)) {
       return NS_ERROR_FAILURE;
     }
   }
 
   return NS_OK;
 }
 
@@ -1533,17 +1535,17 @@ CreateJSStackObject(JSContext *cx, const
     // Current module
     const Telemetry::ProcessedStack::Module& module =
       stacks.GetModule(moduleIndex);
 
     JSObject *moduleInfoArray = JS_NewArrayObject(cx, 0, nullptr);
     if (!moduleInfoArray) {
       return nullptr;
     }
-    jsval val = OBJECT_TO_JSVAL(moduleInfoArray);
+    JS::Value val = OBJECT_TO_JSVAL(moduleInfoArray);
     if (!JS_SetElement(cx, moduleArray, moduleIndex, &val)) {
       return nullptr;
     }
 
     unsigned index = 0;
 
     // Module name
     JSString *str = JS_NewStringCopyZ(cx, module.mName.c_str());
@@ -1580,40 +1582,40 @@ CreateJSStackObject(JSContext *cx, const
   const size_t length = stacks.GetStackCount();
   for (size_t i = 0; i < length; ++i) {
     // Represent call stack PCs as (module index, offset) pairs.
     JSObject *pcArray = JS_NewArrayObject(cx, 0, nullptr);
     if (!pcArray) {
       return nullptr;
     }
 
-    jsval pcArrayVal = OBJECT_TO_JSVAL(pcArray);
+    JS::Value pcArrayVal = OBJECT_TO_JSVAL(pcArray);
     if (!JS_SetElement(cx, reportArray, i, &pcArrayVal)) {
       return nullptr;
     }
 
     const CombinedStacks::Stack& stack = stacks.GetStack(i);
     const uint32_t pcCount = stack.size();
     for (size_t pcIndex = 0; pcIndex < pcCount; ++pcIndex) {
       const Telemetry::ProcessedStack::Frame& frame = stack[pcIndex];
       JSObject *framePair = JS_NewArrayObject(cx, 0, nullptr);
       if (!framePair) {
         return nullptr;
       }
       int modIndex = (std::numeric_limits<uint16_t>::max() == frame.mModIndex) ?
         -1 : frame.mModIndex;
-      jsval modIndexVal = INT_TO_JSVAL(modIndex);
+      JS::Value modIndexVal = INT_TO_JSVAL(modIndex);
       if (!JS_SetElement(cx, framePair, 0, &modIndexVal)) {
         return nullptr;
       }
-      jsval mOffsetVal = INT_TO_JSVAL(frame.mOffset);
+      JS::Value mOffsetVal = INT_TO_JSVAL(frame.mOffset);
       if (!JS_SetElement(cx, framePair, 1, &mOffsetVal)) {
         return nullptr;
       }
-      jsval framePairVal = OBJECT_TO_JSVAL(framePair);
+      JS::Value framePairVal = OBJECT_TO_JSVAL(framePair);
       if (!JS_SetElement(cx, pcArray, pcIndex, &framePairVal)) {
         return nullptr;
       }
     }
   }
 
   return ret;
 }
@@ -1747,17 +1749,17 @@ TelemetryImpl::ReadLateWritesStacks()
     }
     // Delete the file so that we don't report it again on the next run.
     PR_Delete(stackNativePath.get());
   }
   PR_CloseDir(dir);
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetLateWrites(JSContext *cx, jsval *ret)
+TelemetryImpl::GetLateWrites(JSContext *cx, JS::Value *ret)
 {
   // The user must call AsyncReadTelemetryData first. We return an empty list
   // instead of reporting a failure so that the rest of telemetry can uniformly
   // handle the read not being available yet.
 
   // FIXME: we allocate the js object again and again in the getter. We should
   // figure out a way to cache it. In order to do that we have to call
   // JS_AddNamedObjectRoot. A natural place to do so is in the TelemetryImpl
@@ -1779,17 +1781,17 @@ TelemetryImpl::GetLateWrites(JSContext *
     return NS_ERROR_FAILURE;
   }
 
   *ret = OBJECT_TO_JSVAL(report);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetRegisteredHistograms(JSContext *cx, jsval *ret)
+TelemetryImpl::GetRegisteredHistograms(JSContext *cx, JS::Value *ret)
 {
   size_t count = ArrayLength(gHistograms);
   JSObject *info = JS_NewObject(cx, NULL, NULL, NULL);
   if (!info)
     return NS_ERROR_FAILURE;
   JS::AutoObjectRooter root(cx, info);
 
   for (size_t i = 0; i < count; ++i) {
@@ -1803,17 +1805,17 @@ TelemetryImpl::GetRegisteredHistograms(J
     }
   }
 
   *ret = OBJECT_TO_JSVAL(info);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx, jsval *ret)
+TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx, JS::Value *ret)
 {
   Histogram *h;
   nsresult rv = GetHistogramByName(name, &h);
   if (NS_FAILED(rv))
     return rv;
 
   return WrapAndReturnHistogram(h, cx, ret);
 }
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -721,17 +721,17 @@ XRE_SendTestShellCommand(JSContext* aCx,
     if (!aCallback) {
         return tsp->SendExecuteCommand(command);
     }
 
     TestShellCommandParent* callback = static_cast<TestShellCommandParent*>(
         tsp->SendPTestShellCommandConstructor(command));
     NS_ENSURE_TRUE(callback, false);
 
-    jsval callbackVal = *reinterpret_cast<jsval*>(aCallback);
+    JS::Value callbackVal = *reinterpret_cast<JS::Value*>(aCallback);
     NS_ENSURE_TRUE(callback->SetCallback(aCx, callbackVal), false);
 
     return true;
 }
 
 bool
 XRE_GetChildGlobalObject(JSContext* aCx, JSObject** aGlobalP)
 {