Bug 1184564 part 1 - Use Value instead of jsval in XPConnect. r=bholley
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 18 Jul 2015 21:45:35 +0200
changeset 285263 5fc4e125b2b7c56d36efc0c1335cd71961570fe7
parent 285262 a3b08f485c17ba518bab515bc8d942803e676c45
child 285264 78740e4f499862f76bb0f8045d5398e8dcaf5aa2
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1184564
milestone42.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 1184564 part 1 - Use Value instead of jsval in XPConnect. r=bholley
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCCallContext.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCInlines.h
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/XPCVariant.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeInfo.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/XPCWrapper.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -111,17 +111,17 @@ Dump(JSContext* cx, unsigned argc, Value
     }
 #endif
     fputs(utf8str.ptr(), stdout);
     fflush(stdout);
     return true;
 }
 
 static bool
-Debug(JSContext* cx, unsigned argc, jsval* vp)
+Debug(JSContext* cx, unsigned argc, Value* vp)
 {
 #ifdef DEBUG
     return Dump(cx, argc, vp);
 #else
     return true;
 #endif
 }
 
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -105,17 +105,17 @@ already_AddRefed<nsIXPCComponents_utils_
 xpc::NewSandboxConstructor()
 {
     nsCOMPtr<nsIXPCComponents_utils_Sandbox> sbConstructor =
         new nsXPCComponents_utils_Sandbox();
     return sbConstructor.forget();
 }
 
 static bool
-SandboxDump(JSContext* cx, unsigned argc, jsval* vp)
+SandboxDump(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0)
         return true;
 
     RootedString str(cx, ToString(cx, args[0]));
     if (!str)
@@ -142,17 +142,17 @@ SandboxDump(JSContext* cx, unsigned argc
 
     fputs(cstr, stdout);
     fflush(stdout);
     args.rval().setBoolean(true);
     return true;
 }
 
 static bool
-SandboxDebug(JSContext* cx, unsigned argc, jsval* vp)
+SandboxDebug(JSContext* cx, unsigned argc, Value* vp)
 {
 #ifdef DEBUG
     return SandboxDump(cx, argc, vp);
 #else
     return true;
 #endif
 }
 
@@ -294,17 +294,17 @@ SandboxFetch(JSContext* cx, JS::HandleOb
         return ThrowMethodFailed(cx, rv);
     }
     if (!GetOrCreateDOMReflector(cx, scope, response, args.rval())) {
         return false;
     }
     return true;
 }
 
-static bool SandboxFetchPromise(JSContext* cx, unsigned argc, jsval* vp)
+static bool SandboxFetchPromise(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject callee(cx, &args.callee());
     RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
     if (SandboxFetch(cx, scope, args)) {
         return true;
     }
     return ConvertExceptionToPromise(cx, scope, args.rval());
@@ -318,17 +318,17 @@ SandboxCreateFetch(JSContext* cx, Handle
 
     return JS_DefineFunction(cx, obj, "fetch", SandboxFetchPromise, 2, 0) &&
         dom::RequestBinding::GetConstructorObject(cx, obj) &&
         dom::ResponseBinding::GetConstructorObject(cx, obj) &&
         dom::HeadersBinding::GetConstructorObject(cx, obj);
 }
 
 static bool
-SandboxIsProxy(JSContext* cx, unsigned argc, jsval* vp)
+SandboxIsProxy(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 1) {
         JS_ReportError(cx, "Function requires at least 1 argument");
         return false;
     }
     if (!args[0].isObject()) {
         args.rval().setBoolean(false);
@@ -345,30 +345,30 @@ SandboxIsProxy(JSContext* cx, unsigned a
 
 /*
  * Expected type of the arguments and the return value:
  * function exportFunction(function funToExport,
  *                         object targetScope,
  *                         [optional] object options)
  */
 static bool
-SandboxExportFunction(JSContext* cx, unsigned argc, jsval* vp)
+SandboxExportFunction(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 2) {
         JS_ReportError(cx, "Function requires at least 2 arguments");
         return false;
     }
 
     RootedValue options(cx, args.length() > 2 ? args[2] : UndefinedValue());
     return ExportFunction(cx, args[0], args[1], options, args.rval());
 }
 
 static bool
-SandboxCreateObjectIn(JSContext* cx, unsigned argc, jsval* vp)
+SandboxCreateObjectIn(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 1) {
         JS_ReportError(cx, "Function requires at least 1 argument");
         return false;
     }
 
     RootedObject optionsObj(cx);
@@ -384,17 +384,17 @@ SandboxCreateObjectIn(JSContext* cx, uns
     CreateObjectInOptions options(cx, optionsObj);
     if (calledWithOptions && !options.Parse())
         return false;
 
     return xpc::CreateObjectIn(cx, args[0], options, args.rval());
 }
 
 static bool
-SandboxCloneInto(JSContext* cx, unsigned argc, jsval* vp)
+SandboxCloneInto(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 2) {
         JS_ReportError(cx, "Function requires at least 2 arguments");
         return false;
     }
 
     RootedValue options(cx, args.length() > 2 ? args[2] : UndefinedValue());
--- a/js/xpconnect/src/XPCCallContext.cpp
+++ b/js/xpconnect/src/XPCCallContext.cpp
@@ -17,18 +17,18 @@ using namespace JS;
 #define IS_TEAROFF_CLASS(clazz) ((clazz) == &XPC_WN_Tearoff_JSClass)
 
 XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
                                JSContext* cx,
                                HandleObject obj    /* = nullptr               */,
                                HandleObject funobj /* = nullptr               */,
                                HandleId name       /* = JSID_VOID             */,
                                unsigned argc       /* = NO_ARGS               */,
-                               jsval* argv         /* = nullptr               */,
-                               jsval* rval         /* = nullptr               */)
+                               Value* argv         /* = nullptr               */,
+                               Value* rval         /* = nullptr               */)
     :   mAr(cx),
         mState(INIT_FAILED),
         mXPC(nsXPConnect::XPConnect()),
         mXPCContext(nullptr),
         mJSContext(cx),
         mCallerLanguage(callerLanguage),
         mWrapper(nullptr),
         mTearOff(nullptr),
@@ -161,18 +161,18 @@ XPCCallContext::SetCallInfo(XPCNativeInt
     mName = mMember->GetName();
 
     if (mState < HAVE_NAME)
         mState = HAVE_NAME;
 }
 
 void
 XPCCallContext::SetArgsAndResultPtr(unsigned argc,
-                                    jsval* argv,
-                                    jsval* rval)
+                                    Value* argv,
+                                    Value* rval)
 {
     CHECK_STATE(HAVE_OBJECT);
 
     if (mState < HAVE_NAME) {
         mSet = nullptr;
         mInterface = nullptr;
         mMember = nullptr;
         mStaticMemberIsLocal = false;
@@ -282,17 +282,17 @@ NS_IMETHODIMP
 XPCCallContext::GetArgc(uint32_t* aArgc)
 {
     *aArgc = (uint32_t) mArgc;
     return NS_OK;
 }
 
 /* readonly attribute JSValPtr ArgvPtr; */
 NS_IMETHODIMP
-XPCCallContext::GetArgvPtr(jsval * *aArgvPtr)
+XPCCallContext::GetArgvPtr(Value** aArgvPtr)
 {
     *aArgvPtr = mArgv;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 XPCCallContext::GetPreviousCallContext(nsAXPCNativeCallContext** aResult)
 {
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -455,17 +455,17 @@ XPCConvert::JSData2Native(void* d, Handl
         char16_t ch;
         if (!JS_GetStringCharAt(cx, str, 0, &ch))
             return false;
 
         *((uint16_t*)d) = uint16_t(ch);
         break;
     }
     case nsXPTType::T_JSVAL :
-        *((jsval*)d) = s;
+        *((Value*)d) = s;
         break;
     case nsXPTType::T_VOID:
         XPC_LOG_ERROR(("XPCConvert::JSData2Native : void* params not supported"));
         NS_ERROR("void* params not supported");
         return false;
     case nsXPTType::T_IID:
     {
         const nsID* pid = nullptr;
@@ -964,17 +964,17 @@ XPCConvert::JSObject2NativeInterface(voi
 
 // static
 nsresult
 XPCConvert::ConstructException(nsresult rv, const char* message,
                                const char* ifaceName, const char* methodName,
                                nsISupports* data,
                                nsIException** exceptn,
                                JSContext* cx,
-                               jsval* jsExceptionPtr)
+                               Value* jsExceptionPtr)
 {
     MOZ_ASSERT(!cx == !jsExceptionPtr, "Expected cx and jsExceptionPtr to cooccur.");
 
     static const char format[] = "\'%s\' when calling method: [%s::%s]";
     const char * msg = message;
     nsXPIDLString xmsg;
     nsAutoCString sxmsg;
 
@@ -1154,17 +1154,17 @@ XPCConvert::JSValToXPCException(MutableH
             }
         }
 
         if (isResult)
             return ConstructException(rv, nullptr, ifaceName, methodName,
                                       nullptr, exceptn, cx, s.address());
         else {
             // XXX all this nsISupportsDouble code seems a little redundant
-            // now that we're storing the jsval in the exception...
+            // now that we're storing the Value in the exception...
             nsISupportsDouble* data;
             nsCOMPtr<nsIComponentManager> cm;
             if (NS_FAILED(NS_GetComponentManager(getter_AddRefs(cm))) || !cm ||
                 NS_FAILED(cm->CreateInstanceByContractID(NS_SUPPORTS_DOUBLE_CONTRACTID,
                                                          nullptr,
                                                          NS_GET_IID(nsISupportsDouble),
                                                          (void**)&data)))
                 return NS_ERROR_FAILURE;
--- a/js/xpconnect/src/XPCInlines.h
+++ b/js/xpconnect/src/XPCInlines.h
@@ -182,32 +182,32 @@ XPCCallContext::GetStaticMemberIsLocal()
 
 inline unsigned
 XPCCallContext::GetArgc() const
 {
     CHECK_STATE(READY_TO_CALL);
     return mArgc;
 }
 
-inline jsval*
+inline JS::Value*
 XPCCallContext::GetArgv() const
 {
     CHECK_STATE(READY_TO_CALL);
     return mArgv;
 }
 
-inline jsval*
+inline JS::Value*
 XPCCallContext::GetRetVal() const
 {
     CHECK_STATE(READY_TO_CALL);
     return mRetVal;
 }
 
 inline void
-XPCCallContext::SetRetVal(jsval val)
+XPCCallContext::SetRetVal(JS::Value val)
 {
     CHECK_STATE(HAVE_ARGS);
     if (mRetVal)
         *mRetVal = val;
 }
 
 inline jsid
 XPCCallContext::GetResolveName() const
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -206,17 +206,17 @@ GetLine(JSContext* cx, char* bufp, FILE*
         }
         if (errno != EINTR) {
             return false;
         }
     }
 }
 
 static bool
-ReadLine(JSContext* cx, unsigned argc, jsval* vp)
+ReadLine(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // While 4096 might be quite arbitrary, this is something to be fixed in
     // bug 105707. It is also the same limit as in ProcessFile.
     char buf[4096];
     RootedString str(cx);
 
@@ -250,17 +250,17 @@ ReadLine(JSContext* cx, unsigned argc, j
     if (!str)
         return false;
 
     args.rval().setString(str);
     return true;
 }
 
 static bool
-Print(JSContext* cx, unsigned argc, jsval* vp)
+Print(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     args.rval().setUndefined();
 
     RootedString str(cx);
     nsAutoCString utf8output;
 
     for (unsigned i = 0; i < args.length(); i++) {
@@ -278,17 +278,17 @@ Print(JSContext* cx, unsigned argc, jsva
     }
     utf8output.Append('\n');
     fputs(utf8output.get(), gOutFile);
     fflush(gOutFile);
     return true;
 }
 
 static bool
-Dump(JSContext* cx, unsigned argc, jsval* vp)
+Dump(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     args.rval().setUndefined();
 
     if (!args.length())
          return true;
 
     RootedString str(cx, ToString(cx, args[0]));
@@ -311,17 +311,17 @@ Dump(JSContext* cx, unsigned argc, jsval
     }
 #endif
     fputs(utf8str.ptr(), gOutFile);
     fflush(gOutFile);
     return true;
 }
 
 static bool
-Load(JSContext* cx, unsigned argc, jsval* vp)
+Load(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     JS::Rooted<JSObject*> obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     if (!JS_IsGlobalObject(obj)) {
@@ -360,42 +360,42 @@ Load(JSContext* cx, unsigned argc, jsval
             }
         }
     }
     args.rval().setUndefined();
     return true;
 }
 
 static bool
-Version(JSContext* cx, unsigned argc, jsval* vp)
+Version(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     args.rval().setInt32(JS_GetVersion(cx));
     if (args.get(0).isInt32())
         JS_SetVersionForCompartment(js::GetContextCompartment(cx),
                                     JSVersion(args[0].toInt32()));
     return true;
 }
 
 static bool
-Quit(JSContext* cx, unsigned argc, jsval* vp)
+Quit(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     gExitCode = 0;
     if (!ToInt32(cx, args.get(0), &gExitCode))
         return false;
 
     gQuitting = true;
 //    exit(0);
     return false;
 }
 
 static bool
-DumpXPC(JSContext* cx, unsigned argc, jsval* vp)
+DumpXPC(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = CallArgsFromVp(argc, vp);
 
     uint16_t depth = 2;
     if (args.length() > 0) {
         if (!JS::ToUint16(cx, args[0], &depth))
             return false;
     }
@@ -403,31 +403,31 @@ DumpXPC(JSContext* cx, unsigned argc, js
     nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
     if (xpc)
         xpc->DebugDump(int16_t(depth));
     args.rval().setUndefined();
     return true;
 }
 
 static bool
-GC(JSContext* cx, unsigned argc, jsval* vp)
+GC(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JSRuntime* rt = JS_GetRuntime(cx);
     JS_GC(rt);
 #ifdef JS_GCMETER
     js_DumpGCStats(rt, stdout);
 #endif
     args.rval().setUndefined();
     return true;
 }
 
 #ifdef JS_GC_ZEAL
 static bool
-GCZeal(JSContext* cx, unsigned argc, jsval* vp)
+GCZeal(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     uint32_t zeal;
     if (!ToUint32(cx, args.get(0), &zeal))
         return false;
 
     JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
     args.rval().setUndefined();
@@ -461,17 +461,17 @@ SendCommand(JSContext* cx, unsigned argc
         return false;
     }
 
     args.rval().setUndefined();
     return true;
 }
 
 static bool
-Options(JSContext* cx, unsigned argc, jsval* vp)
+Options(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = CallArgsFromVp(argc, vp);
     RuntimeOptions oldRuntimeOptions = RuntimeOptionsRef(cx);
 
     for (unsigned i = 0; i < args.length(); ++i) {
         JSString* str = ToString(cx, args[i]);
         if (!str)
             return false;
@@ -566,17 +566,17 @@ XPCShellInterruptCallback(JSContext* cx)
         JS_ClearPendingException(cx);
         return false;
     }
 
     return rv.toBoolean();
 }
 
 static bool
-SetInterruptCallback(JSContext* cx, unsigned argc, jsval* vp)
+SetInterruptCallback(JSContext* cx, unsigned argc, Value* vp)
 {
     MOZ_ASSERT(sScriptedInterruptCallback.initialized());
 
     // Sanity-check args.
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     if (args.length() != 1) {
         JS_ReportError(cx, "Wrong number of arguments");
         return false;
@@ -595,30 +595,30 @@ SetInterruptCallback(JSContext* cx, unsi
     }
 
     sScriptedInterruptCallback = args[0];
 
     return true;
 }
 
 static bool
-SimulateActivityCallback(JSContext* cx, unsigned argc, jsval* vp)
+SimulateActivityCallback(JSContext* cx, unsigned argc, Value* vp)
 {
     // Sanity-check args.
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     if (args.length() != 1 || !args[0].isBoolean()) {
         JS_ReportError(cx, "Wrong number of arguments");
         return false;
     }
     xpc::SimulateActivityCallback(args[0].toBoolean());
     return true;
 }
 
 static bool
-RegisterAppManifest(JSContext* cx, unsigned argc, jsval* vp)
+RegisterAppManifest(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     if (args.length() != 1) {
         JS_ReportError(cx, "Wrong number of arguments");
         return false;
     }
     if (!args[0].isObject()) {
         JS_ReportError(cx, "Expected object as argument 1 to registerAppManifest");
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -24,17 +24,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_IMPL_QUERY_CLASSINFO(XPCVariant)
 NS_INTERFACE_MAP_END
 NS_IMPL_CI_INTERFACE_GETTER(XPCVariant, XPCVariant, nsIVariant)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(XPCVariant)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(XPCVariant)
 
-XPCVariant::XPCVariant(JSContext* cx, jsval aJSVal)
+XPCVariant::XPCVariant(JSContext* cx, Value aJSVal)
     : mJSVal(aJSVal), mCCGeneration(0)
 {
     nsVariant::Initialize(&mData);
     if (!mJSVal.isPrimitive()) {
         // XXXbholley - The innerization here was from bug 638026. Blake says
         // the basic problem was that we were storing the C++ inner but the JS
         // outer, which meant that, after navigation, the JS inner could be
         // collected, which would cause us to try to recreate the JS inner at
@@ -50,17 +50,17 @@ XPCVariant::XPCVariant(JSContext* cx, js
         JSObject* unwrapped = js::CheckedUnwrap(obj, /* stopAtOuter = */ false);
         mReturnRawObject = !(unwrapped && IS_WN_REFLECTOR(unwrapped));
     } else
         mReturnRawObject = false;
 }
 
 XPCTraceableVariant::~XPCTraceableVariant()
 {
-    jsval val = GetJSValPreserveColor();
+    Value val = GetJSValPreserveColor();
 
     MOZ_ASSERT(val.isGCThing(), "Must be traceable or unlinked");
 
     nsVariant::Cleanup(&mData);
 
     if (!val.isNull())
         RemoveFromRootSet();
 }
@@ -92,17 +92,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(XP
         XPCTraceableVariant* v = static_cast<XPCTraceableVariant*>(tmp);
         v->RemoveFromRootSet();
     }
     tmp->mJSVal = JS::NullValue();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 // static
 already_AddRefed<XPCVariant>
-XPCVariant::newVariant(JSContext* cx, jsval aJSVal)
+XPCVariant::newVariant(JSContext* cx, Value aJSVal)
 {
     nsRefPtr<XPCVariant> variant;
 
     if (!aJSVal.isMarkable())
         variant = new XPCVariant(cx, aJSVal);
     else
         variant = new XPCTraceableVariant(cx, aJSVal);
 
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -317,17 +317,17 @@ nsXPCWrappedJSClass::GetNamedPropertyAsV
 {
     JSContext* cx = ccx.GetJSContext();
     RootedObject aJSObj(cx, aJSObjArg);
 
     AutoScriptEvaluate scriptEval(cx);
     if (!scriptEval.StartEvaluating(aJSObj))
         return NS_ERROR_FAILURE;
 
-    // Wrap the string in a jsval after the AutoScriptEvaluate, so that the
+    // Wrap the string in a Value after the AutoScriptEvaluate, so that the
     // resulting value ends up in the correct compartment.
     nsStringBuffer* buf;
     RootedValue value(cx);
     if (!XPCStringConvert::ReadableToJSVal(ccx, aName, &buf, &value))
         return NS_ERROR_OUT_OF_MEMORY;
     if (buf)
         buf->AddRef();
 
@@ -938,18 +938,18 @@ nsXPCWrappedJSClass::CheckForException(X
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
                                 const XPTMethodDescriptor* info_,
                                 nsXPTCMiniVariant* nativeParams)
 {
-    jsval* sp = nullptr;
-    jsval* argv = nullptr;
+    Value* sp = nullptr;
+    Value* argv = nullptr;
     uint8_t i;
     nsresult retval = NS_ERROR_FAILURE;
     bool success;
     bool readyToDoTheCall = false;
     nsID  param_iid;
     const nsXPTMethodInfo* info = static_cast<const nsXPTMethodInfo*>(info_);
     const char* name = info->name;
     bool foundDependentParam;
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -1294,17 +1294,17 @@ class MOZ_STACK_CLASS CallMethodHelper
     nsISupports* const mCallee;
     const uint16_t mVTableIndex;
     HandleId mIdxValueId;
 
     nsAutoTArray<nsXPTCVariant, 8> mDispatchParams;
     uint8_t mJSContextIndex; // TODO make const
     uint8_t mOptArgcIndex; // TODO make const
 
-    jsval* const mArgv;
+    Value* const mArgv;
     const uint32_t mArgc;
 
     MOZ_ALWAYS_INLINE bool
     GetArraySizeFromParam(uint8_t paramIndex, HandleValue maybeArray, uint32_t* result);
 
     MOZ_ALWAYS_INLINE bool
     GetInterfaceTypeFromParam(uint8_t paramIndex,
                               const nsXPTType& datum_type,
@@ -1554,17 +1554,17 @@ bool
 CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const
 {
     const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(paramIndex);
 
     MOZ_ASSERT(!paramInfo.IsDipper(), "Dipper params are handled separately");
     if (paramInfo.IsOut() && !paramInfo.IsRetval()) {
         MOZ_ASSERT(paramIndex < mArgc || paramInfo.IsOptional(),
                    "Expected either enough arguments or an optional argument");
-        jsval arg = paramIndex < mArgc ? mArgv[paramIndex] : JS::NullValue();
+        Value arg = paramIndex < mArgc ? mArgv[paramIndex] : JS::NullValue();
         if (paramIndex < mArgc) {
             RootedObject obj(mCallContext);
             if (!arg.isPrimitive())
                 obj = &arg.toObject();
             if (!obj || !JS_GetPropertyById(mCallContext, obj, mIdxValueId, srcp)) {
                 // Explicitly passed in unusable value for out param.  Note
                 // that if i >= mArgc we already know that |arg| is JS::NullValue(),
                 // and that's ok.
@@ -2035,17 +2035,17 @@ CallMethodHelper::CleanupParam(nsXPTCMin
 
     // 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:
-            js::RemoveRawValueRoot(mCallContext, (jsval*)&param.val);
+            js::RemoveRawValueRoot(mCallContext, (Value*)&param.val);
             break;
         case nsXPTType::T_INTERFACE:
         case nsXPTType::T_INTERFACE_IS:
             ((nsISupports*)param.val.p)->Release();
             break;
         case nsXPTType::T_ASTRING:
         case nsXPTType::T_DOMSTRING:
             nsXPConnect::GetRuntimeInstance()->mScratchStrings.Destroy((nsString*)param.val.p);
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -22,39 +22,39 @@ using namespace mozilla;
 
 // static
 bool
 XPCNativeMember::GetCallInfo(JSObject* funobj,
                              XPCNativeInterface** pInterface,
                              XPCNativeMember**    pMember)
 {
     funobj = js::UncheckedUnwrap(funobj);
-    jsval memberVal =
+    Value memberVal =
         js::GetFunctionNativeReserved(funobj,
                                       XPC_FUNCTION_NATIVE_MEMBER_SLOT);
 
     *pMember = static_cast<XPCNativeMember*>(memberVal.toPrivate());
     *pInterface = (*pMember)->GetInterface();
 
     return true;
 }
 
 bool
 XPCNativeMember::NewFunctionObject(XPCCallContext& ccx,
                                    XPCNativeInterface* iface, HandleObject parent,
-                                   jsval* pval)
+                                   Value* pval)
 {
     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)
+                         HandleObject parent, Value* vp)
 {
     MOZ_ASSERT(iface == GetInterface());
     if (IsConstant()) {
         RootedValue resultVal(ccx);
         nsXPIDLCString name;
         if (NS_FAILED(iface->GetInterfaceInfo()->GetConstant(mIndex, &resultVal,
                                                              getter_Copies(name))))
             return false;
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -63,33 +63,33 @@ ToStringGuts(XPCCallContext& ccx)
 
     ccx.SetRetVal(JS::StringValue(str));
     return true;
 }
 
 /***************************************************************************/
 
 static bool
-XPC_WN_Shared_ToString(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_Shared_ToString(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx, obj);
     if (!ccx.IsValid())
         return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
     ccx.SetName(ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
     ccx.SetArgsAndResultPtr(args.length(), args.array(), vp);
     return ToStringGuts(ccx);
 }
 
 static bool
-XPC_WN_Shared_ToSource(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_Shared_ToSource(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     static const char empty[] = "({})";
     JSString* str = JS_NewStringCopyN(cx, empty, sizeof(empty)-1);
     if (!str)
         return false;
     args.rval().setString(str);
 
@@ -131,17 +131,17 @@ GetDoubleWrappedJSObject(XPCCallContext&
     }
     return obj;
 }
 
 // This is the getter native function we use to handle 'wrappedJSObject' for
 // double wrapped JSObjects.
 
 static bool
-XPC_WN_DoubleWrappedGetter(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_DoubleWrappedGetter(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx, obj);
@@ -773,34 +773,34 @@ XPC_WN_Helper_SetProperty(JSContext* cx,
                           MutableHandleValue vp, ObjectOpResult& result)
 {
     PRE_HELPER_STUB
     SetProperty(wrapper, cx, obj, id, vp.address(), &retval);
     POST_HELPER_STUB_WITH_OBJECTOPRESULT(failReadOnly)
 }
 
 static bool
-XPC_WN_Helper_Call(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_Helper_Call(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     // N.B. we want obj to be the callee, not JS_THIS(cx, vp)
     RootedObject obj(cx, &args.callee());
 
     XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
                        args.array(), args.rval().address());
     if (!ccx.IsValid())
         return false;
 
     PRE_HELPER_STUB
     Call(wrapper, cx, obj, args, &retval);
     POST_HELPER_STUB
 }
 
 static bool
-XPC_WN_Helper_Construct(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_Helper_Construct(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     RootedObject obj(cx, &args.callee());
     if (!obj)
         return false;
 
     XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
                        args.array(), args.rval().address());
@@ -1114,17 +1114,17 @@ FixUpThisIfBroken(JSObject* obj, JSObjec
         {
             return parentObj;
         }
     }
     return obj;
 }
 
 bool
-XPC_WN_CallMethod(JSContext* cx, unsigned argc, jsval* vp)
+XPC_WN_CallMethod(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     MOZ_ASSERT(JS_TypeOfValue(cx, args.calleev()) == JSTYPE_FUNCTION, "bad function");
     RootedObject funobj(cx, &args.callee());
 
     RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
@@ -1140,17 +1140,17 @@ XPC_WN_CallMethod(JSContext* cx, unsigne
 
     if (!XPCNativeMember::GetCallInfo(funobj, &iface, &member))
         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)
+XPC_WN_GetterSetter(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     MOZ_ASSERT(JS_TypeOfValue(cx, args.calleev()) == JSTYPE_FUNCTION, "bad function");
     RootedObject funobj(cx, &args.callee());
 
     RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
--- a/js/xpconnect/src/XPCWrapper.cpp
+++ b/js/xpconnect/src/XPCWrapper.cpp
@@ -6,30 +6,31 @@
 
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
 using namespace xpc;
 using namespace mozilla;
+using namespace JS;
 
 namespace XPCNativeWrapper {
 
 static inline
 bool
 ThrowException(nsresult ex, JSContext* cx)
 {
   XPCThrower::Throw(ex, cx);
 
   return false;
 }
 
 static bool
-UnwrapNW(JSContext* cx, unsigned argc, jsval* vp)
+UnwrapNW(JSContext* cx, unsigned argc, Value* vp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
   if (args.length() != 1) {
     return ThrowException(NS_ERROR_XPC_NOT_ENOUGH_ARGS, cx);
   }
 
   JS::RootedValue v(cx, args[0]);
   if (!v.isObject() || !js::IsCrossCompartmentWrapper(&v.toObject()) ||
@@ -40,17 +41,17 @@ UnwrapNW(JSContext* cx, unsigned argc, j
 
   bool ok = xpc::WrapperFactory::WaiveXrayAndWrap(cx, &v);
   NS_ENSURE_TRUE(ok, false);
   args.rval().set(v);
   return true;
 }
 
 static bool
-XrayWrapperConstructor(JSContext* cx, unsigned argc, jsval* vp)
+XrayWrapperConstructor(JSContext* cx, unsigned argc, Value* vp)
 {
   JS::CallArgs args = CallArgsFromVp(argc, vp);
   if (args.length() == 0) {
     return ThrowException(NS_ERROR_XPC_NOT_ENOUGH_ARGS, cx);
   }
 
   if (!args[0].isObject()) {
     args.rval().set(args[0]);
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -630,17 +630,17 @@ public:
 private:
     XPCJSRuntime(); // no implementation
     explicit XPCJSRuntime(nsXPConnect* aXPConnect);
 
     void ReleaseIncrementally(nsTArray<nsISupports*>& array);
 
     static const char* const mStrings[IDX_TOTAL_COUNT];
     jsid mStrIDs[IDX_TOTAL_COUNT];
-    jsval mStrJSVals[IDX_TOTAL_COUNT];
+    JS::Value mStrJSVals[IDX_TOTAL_COUNT];
 
     XPCJSContextStack*       mJSContextStack;
     XPCCallContext*          mCallContext;
     AutoMarkingPtr*          mAutoRoots;
     jsid                     mResolveName;
     XPCWrappedNative*        mResolvingWrapper;
     JSObject2WrappedJSMap*   mWrappedJSMap;
     IID2WrappedJSClassMap*   mWrappedJSClassMap;
@@ -793,34 +793,34 @@ private:
 
 class MOZ_STACK_CLASS XPCCallContext : public nsAXPCNativeCallContext
 {
 public:
     NS_IMETHOD GetCallee(nsISupports** aResult);
     NS_IMETHOD GetCalleeMethodIndex(uint16_t* aResult);
     NS_IMETHOD GetJSContext(JSContext** aResult);
     NS_IMETHOD GetArgc(uint32_t* aResult);
-    NS_IMETHOD GetArgvPtr(jsval** aResult);
+    NS_IMETHOD GetArgvPtr(JS::Value** aResult);
     NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo** aResult);
     NS_IMETHOD GetCalleeClassInfo(nsIClassInfo** aResult);
     NS_IMETHOD GetPreviousCallContext(nsAXPCNativeCallContext** aResult);
     NS_IMETHOD GetLanguage(uint16_t* aResult);
 
     enum {NO_ARGS = (unsigned) -1};
 
     static JSContext* GetDefaultJSContext();
 
     XPCCallContext(XPCContext::LangType callerLanguage,
                    JSContext* cx,
                    JS::HandleObject obj    = nullptr,
                    JS::HandleObject funobj = nullptr,
                    JS::HandleId id         = JSID_VOIDHANDLE,
                    unsigned argc           = NO_ARGS,
-                   jsval* argv             = nullptr,
-                   jsval* rval             = nullptr);
+                   JS::Value* argv         = nullptr,
+                   JS::Value* rval         = nullptr);
 
     virtual ~XPCCallContext();
 
     inline bool                         IsValid() const ;
 
     inline XPCJSRuntime*                GetRuntime() const ;
     inline XPCContext*                  GetXPCContext() const ;
     inline JSContext*                   GetJSContext() const ;
@@ -842,32 +842,32 @@ public:
     inline XPCNativeSet*                GetSet() const ;
     inline bool                         CanGetInterface() const ;
     inline XPCNativeInterface*          GetInterface() const ;
     inline XPCNativeMember*             GetMember() const ;
     inline bool                         HasInterfaceAndMember() const ;
     inline jsid                         GetName() const ;
     inline bool                         GetStaticMemberIsLocal() const ;
     inline unsigned                     GetArgc() const ;
-    inline jsval*                       GetArgv() const ;
-    inline jsval*                       GetRetVal() const ;
+    inline JS::Value*                   GetArgv() const ;
+    inline JS::Value*                   GetRetVal() const ;
 
     inline uint16_t                     GetMethodIndex() const ;
     inline void                         SetMethodIndex(uint16_t index) ;
 
     inline jsid GetResolveName() const;
     inline jsid SetResolveName(JS::HandleId name);
 
     inline XPCWrappedNative* GetResolvingWrapper() const;
     inline XPCWrappedNative* SetResolvingWrapper(XPCWrappedNative* w);
 
-    inline void SetRetVal(jsval val);
+    inline void SetRetVal(JS::Value val);
 
     void SetName(jsid name);
-    void SetArgsAndResultPtr(unsigned argc, jsval* argv, jsval* rval);
+    void SetArgsAndResultPtr(unsigned argc, JS::Value* argv, JS::Value* rval);
     void SetCallInfo(XPCNativeInterface* iface, XPCNativeMember* member,
                      bool isSetter);
 
     nsresult  CanCallNow();
 
     void SystemIsBeingShutDown();
 
     operator JSContext*() const {return GetJSContext();}
@@ -922,18 +922,18 @@ private:
     XPCNativeSet*                   mSet;
     XPCNativeInterface*             mInterface;
     XPCNativeMember*                mMember;
 
     JS::RootedId                    mName;
     bool                            mStaticMemberIsLocal;
 
     unsigned                        mArgc;
-    jsval*                          mArgv;
-    jsval*                          mRetVal;
+    JS::Value*                      mArgv;
+    JS::Value*                      mRetVal;
 
     uint16_t                        mMethodIndex;
 };
 
 /***************************************************************************
 ****************************************************************************
 *
 * Core classes for wrapped native objects for use from JavaScript...
@@ -951,20 +951,20 @@ extern const js::Class XPC_WN_NoMods_NoC
 extern const js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass;
 extern const js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass;
 extern const js::Class XPC_WN_Tearoff_JSClass;
 #define XPC_WN_TEAROFF_RESERVED_SLOTS 1
 #define XPC_WN_TEAROFF_FLAT_OBJECT_SLOT 0
 extern const js::Class XPC_WN_NoHelper_Proto_JSClass;
 
 extern bool
-XPC_WN_CallMethod(JSContext* cx, unsigned argc, jsval* vp);
+XPC_WN_CallMethod(JSContext* cx, unsigned argc, JS::Value* vp);
 
 extern bool
-XPC_WN_GetterSetter(JSContext* cx, unsigned argc, jsval* vp);
+XPC_WN_GetterSetter(JSContext* cx, unsigned argc, JS::Value* vp);
 
 extern JSObject*
 XPC_WN_JSOp_ThisObject(JSContext* cx, JS::HandleObject obj);
 
 // Macros to initialize Object or Function like XPC_WN classes
 #define XPC_WN_WithCall_ObjectOps                                             \
     {                                                                         \
         nullptr, /* lookupProperty */                                         \
@@ -1285,23 +1285,23 @@ public:
                             XPCNativeInterface** pInterface,
                             XPCNativeMember**    pMember);
 
     jsid   GetName() const {return mName;}
 
     uint16_t GetIndex() const {return mIndex;}
 
     bool GetConstantValue(XPCCallContext& ccx, XPCNativeInterface* iface,
-                          jsval* pval)
+                          JS::Value* pval)
         {MOZ_ASSERT(IsConstant(),
                     "Only call this if you're sure this is a constant!");
          return Resolve(ccx, iface, nullptr, pval);}
 
     bool NewFunctionObject(XPCCallContext& ccx, XPCNativeInterface* iface,
-                           JS::HandleObject parent, jsval* pval);
+                           JS::HandleObject parent, JS::Value* pval);
 
     bool IsMethod() const
         {return 0 != (mFlags & METHOD);}
 
     bool IsConstant() const
         {return 0 != (mFlags & CONSTANT);}
 
     bool IsAttribute() const
@@ -1337,17 +1337,17 @@ public:
         {mIndexInInterface = index;}
 
     /* 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);
+                 JS::HandleObject parent, JS::Value* vp);
 
     enum {
         METHOD      = 0x01,
         CONSTANT    = 0x02,
         GETTER      = 0x04,
         SETTER_TOO  = 0x08
         // If you add a flag here, you may need to make mFlags wider and either
         // make mIndexInInterface narrower (and adjust
@@ -2578,19 +2578,19 @@ private:
 /***************************************************************************/
 // class here just for static methods
 class XPCConvert
 {
 public:
     static bool IsMethodReflectable(const XPTMethodDescriptor& info);
 
     /**
-     * Convert a native object into a jsval.
+     * Convert a native object into a JS::Value.
      *
-     * @param d [out] the resulting jsval
+     * @param d [out] the resulting JS::Value
      * @param s the native object we're working with
      * @param type the type of object that s is
      * @param iid the interface of s that we want
      * @param scope the default scope to put on the new JSObject's parent
      *        chain
      * @param pErr [out] relevant error code, if any.
      */
 
@@ -2634,19 +2634,19 @@ public:
                                          nsISupports* aOuter,
                                          nsresult* pErr);
 
     // Note - This return the XPCWrappedNative, rather than the native itself,
     // for the WN case. You probably want UnwrapReflectorToISupports.
     static bool GetISupportsFromJSObject(JSObject* obj, nsISupports** iface);
 
     /**
-     * Convert a native array into a jsval.
+     * Convert a native array into a JS::Value.
      *
-     * @param d [out] the resulting jsval
+     * @param d [out] the resulting JS::Value
      * @param s the native array we're working with
      * @param type the type of objects in the array
      * @param iid the interface of each object in the array that we want
      * @param count the number of items in the array
      * @param scope the default scope to put on the new JSObjects' parent chain
      * @param pErr [out] relevant error code, if any.
      */
     static bool NativeArray2JS(JS::MutableHandleValue d, const void** s,
@@ -2684,17 +2684,17 @@ public:
                                           nsIException** exception);
 
     static nsresult ConstructException(nsresult rv, const char* message,
                                        const char* ifaceName,
                                        const char* methodName,
                                        nsISupports* data,
                                        nsIException** exception,
                                        JSContext* cx,
-                                       jsval* jsExceptionPtr);
+                                       JS::Value* jsExceptionPtr);
 
 private:
     XPCConvert(); // not implemented
 
 };
 
 /***************************************************************************/
 // code for throwing exceptions into JS
@@ -3280,44 +3280,44 @@ public:
     // If this class ever implements nsIWritableVariant, take special care with
     // the case when mJSVal is JSVAL_STRING, since we don't own the data in
     // that case.
 
     // We #define and iid so that out module local code can use QI to detect
     // if a given nsIVariant is in fact an XPCVariant.
     NS_DECLARE_STATIC_IID_ACCESSOR(XPCVARIANT_IID)
 
-    static already_AddRefed<XPCVariant> newVariant(JSContext* cx, jsval aJSVal);
+    static already_AddRefed<XPCVariant> newVariant(JSContext* cx, JS::Value aJSVal);
 
     /**
-     * This getter clears the gray bit before handing out the jsval if the jsval
+     * This getter clears the gray bit before handing out the Value if the Value
      * represents a JSObject. That means that the object is guaranteed to be
      * kept alive past the next CC.
      */
-    jsval GetJSVal() const {
+    JS::Value GetJSVal() const {
         if (!mJSVal.isPrimitive())
             JS::ExposeObjectToActiveJS(&mJSVal.toObject());
         return mJSVal;
     }
 
     /**
-     * This getter does not change the color of the jsval (if it represents a
+     * This getter does not change the color of the Value (if it represents a
      * JSObject) meaning that the value returned is not guaranteed to be kept
      * alive past the next CC.
      *
      * This should only be called if you are certain that the return value won't
      * be passed into a JS API function and that it won't be stored without
      * being rooted (or otherwise signaling the stored value to the CC).
      */
-    jsval GetJSValPreserveColor() const {return mJSVal;}
-
-    XPCVariant(JSContext* cx, jsval aJSVal);
+    JS::Value GetJSValPreserveColor() const {return mJSVal;}
+
+    XPCVariant(JSContext* cx, JS::Value aJSVal);
 
     /**
-     * Convert a variant into a jsval.
+     * Convert a variant into a JS::Value.
      *
      * @param ccx the context for the whole procedure
      * @param variant the variant to convert
      * @param scope the default scope to put on the new JSObject's parent chain
      * @param pErr [out] relevant error code, if any.
      * @param pJSVal [out] the resulting jsval.
      */
     static bool VariantDataToJS(nsIVariant* variant,
@@ -3352,17 +3352,17 @@ protected:
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(XPCVariant, XPCVARIANT_IID)
 
 class XPCTraceableVariant: public XPCVariant,
                            public XPCRootSetElem
 {
 public:
-    XPCTraceableVariant(JSContext* cx, jsval aJSVal)
+    XPCTraceableVariant(JSContext* cx, JS::Value aJSVal)
         : XPCVariant(cx, aJSVal)
     {
          nsXPConnect::GetRuntimeInstance()->AddVariantRoot(this);
     }
 
     virtual ~XPCTraceableVariant();
 
     void TraceJS(JSTracer* trc);
@@ -3385,20 +3385,20 @@ xpc_GetSafeJSContext()
 
 namespace xpc {
 
 JSAddonId*
 NewAddonId(JSContext* cx, const nsACString& id);
 
 // JSNatives to expose atob and btoa in various non-DOM XPConnect scopes.
 bool
-Atob(JSContext* cx, unsigned argc, jsval* vp);
+Atob(JSContext* cx, unsigned argc, JS::Value* vp);
 
 bool
-Btoa(JSContext* cx, unsigned argc, jsval* vp);
+Btoa(JSContext* cx, unsigned argc, JS::Value* vp);
 
 // Helper function that creates a JSFunction that wraps a native function that
 // forwards the call to the original 'callable'.
 class FunctionForwarderOptions;
 bool
 NewFunctionForwarder(JSContext* cx, JS::HandleId id, JS::HandleObject callable,
                      FunctionForwarderOptions& options, JS::MutableHandleValue vp);