diff --git a/caps/src/nsSecurityManagerFactory.cpp b/caps/src/nsSecurityManagerFactory.cpp index 07333299fee..b775fa88de3 100644 --- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -85,7 +85,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) JSClass *objectClass = JS_GetClass(obj); JS::Rooted v(cx); - if (!JS_GetProperty(cx, global, "netscape", &v)) + if (!JS_GetProperty(cx, global, "netscape", v.address())) return NS_ERROR_FAILURE; JS::Rooted securityObj(cx); @@ -95,7 +95,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) * "security" property. */ obj = &v.toObject(); - if (!JS_GetProperty(cx, obj, "security", &v) || !v.isObject()) + if (!JS_GetProperty(cx, obj, "security", v.address()) || !v.isObject()) return NS_ERROR_FAILURE; securityObj = &v.toObject(); } else { diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 004ed6c8f78..0ec31525f34 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -748,7 +748,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, thisValue.address(), nullptr, true); } else { // If the listener is a JS object which has receiveMessage function: - if (!JS_GetProperty(ctx, object, "receiveMessage", &funval) || + if (!JS_GetProperty(ctx, object, "receiveMessage", + funval.address()) || !funval.isObject()) return NS_ERROR_UNEXPECTED; diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index ffecdb09b8b..956207157f8 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1163,7 +1163,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName, // Find our class object. It's in a protected scope and permanent just in case, // so should be there no matter what. JS::RootedValue classObject(aCx); - if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) { + if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, classObject.address())) { return false; } diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 290555f5e70..10745d4bf3f 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -244,7 +244,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args) } JS::Rooted v(cx); - if (!JS_GetPropertyById(cx, thisObj, id, &v)) { + if (!JS_GetPropertyById(cx, thisObj, id, v.address())) { return false; } args.rval().set(v); diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 4b959315915..9bbfd81d70a 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -541,7 +541,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return NS_OK; } @@ -556,7 +556,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { return NS_OK; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index c283702dfce..b9ca18c0614 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2721,7 +2721,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner, JSAutoCompartment ac(cx, thisObject); JS::Rooted funval(cx); - if (!JS_GetProperty(cx, thisObject, "constructor", &funval) || + if (!JS_GetProperty(cx, thisObject, "constructor", funval.address()) || !funval.isObject()) { return NS_ERROR_UNEXPECTED; } @@ -3226,7 +3226,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, // This isn't a normal DOM object, see if this constructor lives on its // prototype chain. JS::Rooted val(cx); - if (!JS_GetProperty(cx, obj, "prototype", &val)) { + if (!JS_GetProperty(cx, obj, "prototype", val.address())) { return NS_ERROR_UNEXPECTED; } @@ -3967,10 +3967,7 @@ ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp) if (!obj) return JS_FALSE; - JS::Rooted value(cx); - bool result = ::JS_GetProperty(cx, obj, "content", &value); - *vp = value; - return result; + return ::JS_GetProperty(cx, obj, "content", vp); } template @@ -4117,7 +4114,7 @@ DefineComponentsShim(JSContext *cx, JS::HandleObject global) // Look up the appopriate interface object on the global. JS::Rooted v(cx, JS::UndefinedValue()); - ok = JS_GetProperty(cx, global, domName, &v); + ok = JS_GetProperty(cx, global, domName, v.address()); NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY); if (!v.isObject()) { NS_WARNING("Unable to find interface object on global"); @@ -4648,7 +4645,7 @@ nsGenericArraySH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx, *length = 0; JS::Rooted lenval(cx); - if (!JS_GetProperty(cx, obj, "length", &lenval)) { + if (!JS_GetProperty(cx, obj, "length", lenval.address())) { return NS_ERROR_UNEXPECTED; } @@ -4687,7 +4684,7 @@ nsGenericArraySH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, sCurrentlyEnumerating = true; JS::Rooted len_val(cx); - JSBool ok = ::JS_GetProperty(cx, obj, "length", &len_val); + JSBool ok = ::JS_GetProperty(cx, obj, "length", len_val.address()); if (ok && JSVAL_IS_INT(len_val)) { int32_t length = JSVAL_TO_INT(len_val); @@ -5035,13 +5032,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) return JS_FALSE; } - JS::Rooted value(cx); - if (!::JS_GetUCProperty(cx, self, chars, length, &value)) { - return false; - } - - *vp = value; - return true; + return ::JS_GetUCProperty(cx, self, chars, length, vp); } // StringArray helper diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 9647410a586..2f3ca6f1589 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1322,13 +1322,7 @@ GetPropertyOnPrototype(JSContext* cx, JS::Handle proxy, return true; } - JS::Rooted value(cx); - if (!JS_ForwardGetPropertyTo(cx, proto, id, proxy, &value)) { - return false; - } - - *vp = value; - return true; + return JS_ForwardGetPropertyTo(cx, proto, id, proxy, vp); } bool @@ -1747,7 +1741,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle obj, } JS::Rooted protov(cx); - DebugOnly ok = JS_GetProperty(cx, obj, "prototype", &protov); + DebugOnly ok = JS_GetProperty(cx, obj, "prototype", protov.address()); MOZ_ASSERT(ok, "Someone messed with our prototype property?"); JS::Rooted interfacePrototype(cx, &protov.toObject()); @@ -1851,7 +1845,7 @@ GetWindowForJSImplementedObject(JSContext* cx, JS::Handle obj, // Look up the content-side object. JS::Rooted domImplVal(cx); - if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", &domImplVal)) { + if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", domImplVal.address())) { return false; } diff --git a/dom/bindings/CallbackInterface.cpp b/dom/bindings/CallbackInterface.cpp index b07689ccc4d..46d92ceb234 100644 --- a/dom/bindings/CallbackInterface.cpp +++ b/dom/bindings/CallbackInterface.cpp @@ -16,7 +16,7 @@ bool CallbackInterface::GetCallableProperty(JSContext* cx, const char* aPropName, JS::MutableHandle aCallable) { - if (!JS_GetProperty(cx, mCallback, aPropName, aCallable)) { + if (!JS_GetProperty(cx, mCallback, aPropName, aCallable.address())) { return false; } if (!aCallable.isObject() || diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index e173422bf23..5bd898a8ae7 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -5478,7 +5478,7 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter): assert all(ord(c) < 128 for c in attrName) assert all(ord(c) < 128 for c in forwardToAttrName) return CGIndenter(CGGeneric("""JS::RootedValue v(cx); -if (!JS_GetProperty(cx, obj, "%s", &v)) { +if (!JS_GetProperty(cx, obj, "%s", v.address())) { return false; } @@ -7338,7 +7338,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): " return false;\n" "}\n" "if (hasUnforgeable) {\n" - " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp);\n" + " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp.address());\n" "}") getUnforgeableOrExpando = CallOnUnforgeableHolder(self.descriptor, hasUnforgeable) @@ -7352,7 +7352,7 @@ if (expando) { } if (hasProp) { - return JS_GetPropertyById(cx, expando, id, vp); + return JS_GetPropertyById(cx, expando, id, vp.address()); } }""" @@ -8006,11 +8006,11 @@ class CGDictionary(CGThing): # NOTE: jsids are per-runtime, so don't use them in workers if self.workers: propName = member.identifier.name - propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", &temp.ref())' % + propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.ref().address())' % propName) else: propId = self.makeIdName(member.identifier.name); - propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, &temp.ref())" % + propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.ref().address())" % propId) conversionReplacements = { @@ -9907,7 +9907,7 @@ class CallbackGetter(CallbackMember): "attrName": self.attrName } return string.Template( - 'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n' + 'if (!JS_GetProperty(cx, mCallback, "${attrName}", rval.address())) {\n' ' aRv.Throw(NS_ERROR_UNEXPECTED);\n' ' return${errorReturn};\n' '}\n').substitute(replacements); diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index 22b78a582fe..c30ab62663b 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -537,7 +537,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return; } @@ -548,7 +548,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value)|| + if (!JS_GetProperty(cx, obj, "value", value.address())|| !value.isNumber()) { return; } diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index aa8d75825c8..5045df1f5ff 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -566,7 +566,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) JSObject& obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; @@ -584,7 +584,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) } if (match) { - JS::Rooted value; + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index ea8f48c6eda..bc039397f00 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -117,7 +117,8 @@ GetJSValFromKeyPathString(JSContext* aCx, if (hasProp) { // Get if the property exists... JS::Rooted intermediate(aCx); - JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate); + JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, + intermediate.address()); NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); // Treat explicitly undefined as an error. diff --git a/dom/network/src/TCPSocketParent.cpp b/dom/network/src/TCPSocketParent.cpp index 65aa5c63af4..1283e1147a8 100644 --- a/dom/network/src/TCPSocketParent.cpp +++ b/dom/network/src/TCPSocketParent.cpp @@ -171,7 +171,7 @@ TCPSocketParent::SendCallback(const nsAString& aType, const JS::Value& aDataVal, nsDependentJSString name; JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, obj, "name", &val)) { + if (!JS_GetProperty(aCx, obj, "name", val.address())) { NS_ERROR("No name property on supposed error object"); } else if (JSVAL_IS_STRING(val)) { if (!name.init(aCx, JSVAL_TO_STRING(val))) { diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index a7d85dea0e4..9087c987b4a 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -540,7 +540,7 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj) } static JSBool -GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle rval) +GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::Value *rval) { NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); @@ -574,7 +574,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id) AutoJSExceptionReporter reporter(cx); JS::Rooted v(cx); - JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, &v); + JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, v.address()); return ok && !JSVAL_IS_PRIMITIVE(v) && ::JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(v)); @@ -610,7 +610,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, AutoJSExceptionReporter reporter(cx); if (method != NPIdentifier_VOID) { - if (!GetProperty(cx, npjsobj->mJSObj, method, &fv) || + if (!GetProperty(cx, npjsobj->mJSObj, method, fv.address()) || ::JS_TypeOfValue(cx, fv) != JSTYPE_FUNCTION) { return false; } @@ -752,7 +752,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id, JSAutoCompartment ac(cx, npjsobj->mJSObj); JS::Rooted v(cx); - return (GetProperty(cx, npjsobj->mJSObj, id, &v) && + return (GetProperty(cx, npjsobj->mJSObj, id, v.address()) && JSValToNPVariant(npp, cx, v, result)); } @@ -1621,7 +1621,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle obj, JSType hint, JS:: // giving plugins a [[DefaultValue]] which uses only toString and not valueOf. JS::Rooted v(cx, JSVAL_VOID); - if (!JS_GetProperty(cx, obj, "toString", &v)) + if (!JS_GetProperty(cx, obj, "toString", v.address())) return false; if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) { if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp.address())) diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index a7def0c15d2..9bb067ea0a1 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -718,7 +718,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return; } @@ -728,7 +728,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isBoolean()) { return; } diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 438451bf94c..8f749eed046 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -211,7 +211,7 @@ nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue, */ JS::Rooted val(cx, aValue); JS::Rooted toJSON(cx); - if (JS_GetProperty(cx, obj, "toJSON", &toJSON) && + if (JS_GetProperty(cx, obj, "toJSON", toJSON.address()) && toJSON.isObject() && JS_ObjectIsCallable(cx, &toJSON.toObject())) { // If toJSON is implemented, it must not throw diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index 0c5a92d8e9e..00e27e28b88 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -605,7 +605,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle aObject const char *aProperty) { JS::Rooted val(cx); - if (!JS_GetProperty(cx, aObject, aProperty, &val)) { + if (!JS_GetProperty(cx, aObject, aProperty, val.address())) { return NULL; } if (!val.isUndefined()) { diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index 5f85182e271..a2e8013ea30 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -219,7 +219,7 @@ AudioManager::Observe(nsISupports* aSubject, AudioSystem::setParameters(0, cmd); } } - } + } // To process the volume control on each audio channel according to // change of settings else if (!strcmp(aTopic, "mozsettings-changed")) { @@ -233,7 +233,7 @@ AudioManager::Observe(nsISupports* aSubject, JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return NS_OK; } @@ -248,7 +248,7 @@ AudioManager::Observe(nsISupports* aSubject, } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { return NS_OK; } diff --git a/dom/system/gonk/AutoMounterSetting.cpp b/dom/system/gonk/AutoMounterSetting.cpp index 97aa72bd7d7..4ffa9595a37 100644 --- a/dom/system/gonk/AutoMounterSetting.cpp +++ b/dom/system/gonk/AutoMounterSetting.cpp @@ -186,7 +186,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } JSObject& obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -198,7 +198,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } - JS::Rooted value(cx); + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value)) { return NS_OK; } diff --git a/dom/system/gonk/TimeZoneSettingObserver.cpp b/dom/system/gonk/TimeZoneSettingObserver.cpp index eec9f9431e8..006e8976b17 100644 --- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -180,7 +180,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, // Get the key, which should be the JS string "time.timezone". JSObject &obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -192,7 +192,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, } // Get the value, which should be a JS string like "America/Chicago". - JS::Rooted value(cx); + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value) || !value.isString()) { return NS_OK; diff --git a/dom/workers/ChromeWorkerScope.cpp b/dom/workers/ChromeWorkerScope.cpp index 432d0ce0882..de2b6421842 100644 --- a/dom/workers/ChromeWorkerScope.cpp +++ b/dom/workers/ChromeWorkerScope.cpp @@ -55,7 +55,7 @@ DefineChromeWorkerFunctions(JSContext* aCx, JS::Handle aGlobal) { JS::Rooted ctypes(aCx); if (!JS_InitCTypesClass(aCx, aGlobal) || - !JS_GetProperty(aCx, aGlobal, "ctypes", &ctypes)) { + !JS_GetProperty(aCx, aGlobal, "ctypes", ctypes.address())) { return false; } diff --git a/dom/workers/EventListenerManager.cpp b/dom/workers/EventListenerManager.cpp index 4403fdd055b..08934d62790 100644 --- a/dom/workers/EventListenerManager.cpp +++ b/dom/workers/EventListenerManager.cpp @@ -298,7 +298,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, aEvent, "target", &val)) { + if (!JS_GetProperty(aCx, aEvent, "target", val.address())) { aRv.Throw(NS_ERROR_FAILURE); return false; } @@ -316,7 +316,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, JS::Rooted eventType(aCx); JSBool eventIsTrusted; - if (!JS_GetProperty(aCx, aEvent, "type", &val) || + if (!JS_GetProperty(aCx, aEvent, "type", val.address()) || !(eventType = JS_ValueToString(aCx, val)) || !(eventType = JS_InternJSString(aCx, eventType))) { aRv.Throw(NS_ERROR_FAILURE); @@ -325,7 +325,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, // We have already ensure that the event is one of our types of events so // there is no need to worry about this property being faked. - if (!JS_GetProperty(aCx, aEvent, "isTrusted", &val) || + if (!JS_GetProperty(aCx, aEvent, "isTrusted", val.address()) || !JS_ValueToBoolean(aCx, val, &eventIsTrusted)) { aRv.Throw(NS_ERROR_FAILURE); return false; @@ -408,7 +408,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } if (hasHandleEvent) { - if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, &listenerVal)) { + if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, listenerVal.address())) { if (!JS_ReportPendingException(aCx)) { aRv.Throw(NS_ERROR_FAILURE); return false; diff --git a/dom/workers/Events.cpp b/dom/workers/Events.cpp index e382e4eb535..8ac4f8d9568 100644 --- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -57,14 +57,14 @@ public: if (aMainRuntime) { JS::Rooted windowPropVal(aCx); - if (!JS_GetProperty(aCx, aObj, sClass.name, &windowPropVal)) { + if (!JS_GetProperty(aCx, aObj, sClass.name, windowPropVal.address())) { return NULL; } if (!JSVAL_IS_PRIMITIVE(windowPropVal)) { JS::Rooted protoVal(aCx); if (!JS_GetProperty(aCx, JSVAL_TO_OBJECT(windowPropVal), "prototype", - &protoVal)) { + protoVal.address())) { return NULL; } diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index f876c16932f..98687ba1d89 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -266,10 +266,9 @@ private: JS::Rooted event(aCx, &JS_ARGV(aCx, aVp)[0].toObject()); jsval argv[3] = { JSVAL_VOID, JSVAL_VOID, JSVAL_VOID }; - JS::AutoArrayRooter rootedArgv(aCx, ArrayLength(argv), argv); - if (!JS_GetProperty(aCx, event, "message", rootedArgv.handleAt(0)) || - !JS_GetProperty(aCx, event, "filename", rootedArgv.handleAt(1)) || - !JS_GetProperty(aCx, event, "lineno", rootedArgv.handleAt(2))) { + if (!JS_GetProperty(aCx, event, "message", &argv[0]) || + !JS_GetProperty(aCx, event, "filename", &argv[1]) || + !JS_GetProperty(aCx, event, "lineno", &argv[2])) { return false; } diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 275e26a2079..a3fc2c42100 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -78,7 +78,7 @@ Environment(JSObject* global) AutoSafeJSContext cx; JSAutoCompartment ac(cx, global); Rooted v(cx); - if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", &v) || + if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", v.address()) || !v.get().isDouble()) { return nullptr; diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 89feb408aec..2932571d581 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -372,7 +372,7 @@ JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, co if (!convertGeckoStringToId(cx, id, &internedId)) return fail(cx, rs); - JS::Rooted val(cx); + JS::Value val; if (!JS_ForwardGetPropertyTo(cx, obj, internedId, receiver, &val)) return fail(cx, rs); @@ -516,7 +516,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv for (size_t i = 0; i < outobjects.length(); i++) { RootedObject obj(cx, &outobjects[i].toObject()); - RootedValue v(cx); + jsval v; JSBool found; if (JS_HasProperty(cx, obj, "value", &found)) { if (!JS_GetProperty(cx, obj, "value", &v)) diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index ad55c4b2f8b..43376963f02 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -457,7 +457,7 @@ JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray(cx, name, AUTO_NAMELEN(name, namelen)); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 27eab08da4d..8c26fd74b20 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3474,22 +3474,19 @@ extern JS_PUBLIC_API(JSBool) JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp); +JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, - JS::MutableHandle vp); +JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle vp); +JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, - JS::MutableHandle vp); +JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, - JS::MutableHandle vp); +JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, jsval *vp); extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v); @@ -3575,7 +3572,7 @@ JS_LookupUCProperty(JSContext *cx, JSObject *obj, extern JS_PUBLIC_API(JSBool) JS_GetUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, - JS::MutableHandle vp); + jsval *vp); extern JS_PUBLIC_API(JSBool) JS_SetUCProperty(JSContext *cx, JSObject *obj, diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 82c36419bfc..5ed0c84d11e 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1105,10 +1105,10 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int // print any unnamed trailing args (found in 'arguments' object) RootedValue val(cx); - if (JS_GetProperty(cx, callObj, "arguments", &val) && val.isObject()) { + if (JS_GetProperty(cx, callObj, "arguments", val.address()) && val.isObject()) { uint32_t argCount; RootedObject argsObj(cx, &val.toObject()); - if (JS_GetProperty(cx, argsObj, "length", &val) && + if (JS_GetProperty(cx, argsObj, "length", val.address()) && ToUint32(cx, val, &argCount) && argCount > namedArgCount) { @@ -1116,7 +1116,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int char number[8]; JS_snprintf(number, 8, "%d", (int) k); - if (JS_GetProperty(cx, argsObj, number, &val)) { + if (JS_GetProperty(cx, argsObj, number, val.address())) { JSAutoByteString valueBytes; const char *value = FormatValue(cx, val, valueBytes); buf = JS_sprintf_append(buf, "%s%s%s%s", diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 66e9f8cb482..e4eb4e8fccb 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -1048,14 +1048,14 @@ js_ReportUncaughtException(JSContext *cx) (exnObject->is() || IsDuckTypedErrorObject(cx, exnObject, &filename_str))) { RootedString name(cx); - if (JS_GetProperty(cx, exnObject, js_name_str, tvr.handleAt(2)) && + if (JS_GetProperty(cx, exnObject, js_name_str, &roots[2]) && JSVAL_IS_STRING(roots[2])) { name = JSVAL_TO_STRING(roots[2]); } RootedString msg(cx); - if (JS_GetProperty(cx, exnObject, js_message_str, tvr.handleAt(3)) && + if (JS_GetProperty(cx, exnObject, js_message_str, &roots[3]) && JSVAL_IS_STRING(roots[3])) { msg = JSVAL_TO_STRING(roots[3]); @@ -1077,21 +1077,21 @@ js_ReportUncaughtException(JSContext *cx) str = msg; } - if (JS_GetProperty(cx, exnObject, filename_str, tvr.handleAt(4))) { + if (JS_GetProperty(cx, exnObject, filename_str, &roots[4])) { JSString *tmp = ToString(cx, HandleValue::fromMarkedLocation(&roots[4])); if (tmp) filename.encodeLatin1(cx, tmp); } uint32_t lineno; - if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, tvr.handleAt(5)) || + if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, &roots[5]) || !ToUint32(cx, roots[5], &lineno)) { lineno = 0; } uint32_t column; - if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, tvr.handleAt(5)) || + if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, &roots[5]) || !ToUint32(cx, roots[5], &column)) { column = 0; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 7c45dcbfee8..657f9981924 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -934,7 +934,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) RootedObject opts(cx, &args[1].toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "newContext", &v)) + if (!JS_GetProperty(cx, opts, "newContext", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -943,7 +943,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) newContext = b; } - if (!JS_GetProperty(cx, opts, "compileAndGo", &v)) + if (!JS_GetProperty(cx, opts, "compileAndGo", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -952,7 +952,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) compileAndGo = b; } - if (!JS_GetProperty(cx, opts, "noScriptRval", &v)) + if (!JS_GetProperty(cx, opts, "noScriptRval", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -961,7 +961,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) noScriptRval = b; } - if (!JS_GetProperty(cx, opts, "fileName", &v)) + if (!JS_GetProperty(cx, opts, "fileName", v.address())) return false; if (JSVAL_IS_NULL(v)) { fileName = NULL; @@ -974,12 +974,12 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "element", &v)) + if (!JS_GetProperty(cx, opts, "element", v.address())) return false; if (!JSVAL_IS_PRIMITIVE(v)) element = JSVAL_TO_OBJECT(v); - if (!JS_GetProperty(cx, opts, "sourceMapURL", &v)) + if (!JS_GetProperty(cx, opts, "sourceMapURL", v.address())) return false; if (!JSVAL_IS_VOID(v)) { sourceMapURL = JS_ValueToString(cx, v); @@ -987,7 +987,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "lineNumber", &v)) + if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) return false; if (!JSVAL_IS_VOID(v)) { uint32_t u; @@ -996,7 +996,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) lineNumber = u; } - if (!JS_GetProperty(cx, opts, "global", &v)) + if (!JS_GetProperty(cx, opts, "global", v.address())) return false; if (!JSVAL_IS_VOID(v)) { global = JSVAL_IS_PRIMITIVE(v) ? NULL : JSVAL_TO_OBJECT(v); @@ -1012,7 +1012,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) } } - if (!JS_GetProperty(cx, opts, "catchTermination", &v)) + if (!JS_GetProperty(cx, opts, "catchTermination", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -1021,7 +1021,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) catchTermination = b; } - if (!JS_GetProperty(cx, opts, "saveFrameChain", &v)) + if (!JS_GetProperty(cx, opts, "saveFrameChain", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -2465,7 +2465,7 @@ sandbox_enumerate(JSContext *cx, HandleObject obj) RootedValue v(cx); JSBool b; - if (!JS_GetProperty(cx, obj, "lazy", &v)) + if (!JS_GetProperty(cx, obj, "lazy", v.address())) return false; JS_ValueToBoolean(cx, v, &b); @@ -2479,7 +2479,7 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, RootedValue v(cx); JSBool b, resolved; - if (!JS_GetProperty(cx, obj, "lazy", &v)) + if (!JS_GetProperty(cx, obj, "lazy", v.address())) return false; JS_ValueToBoolean(cx, v, &b); diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index 44c86cd42a0..e8b29c7dedf 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -506,7 +506,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path) /* Find the property of the results object named |pathName|. */ RootedValue v(context); - if (!JS_GetProperty(context, result, pathName, &v)) + if (!JS_GetProperty(context, result, pathName, v.address())) return false; if (v.isUndefined()) { /* Create an array to accumulate referents under this path. */ diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 49df6a8fd9f..16725792934 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -4194,7 +4194,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code RootedObject opts(cx, &options.toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "url", &v)) + if (!JS_GetProperty(cx, opts, "url", v.address())) return false; if (!v.isUndefined()) { RootedString url_str(cx, JS_ValueToString(cx, v)); @@ -4203,7 +4203,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code url = JS_EncodeString(cx, url_str); } - if (!JS_GetProperty(cx, opts, "lineNumber", &v)) + if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) return false; if (!v.isUndefined()) { uint32_t lineno; diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index de20e78f2dc..459a02311bd 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -518,7 +518,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile) JSCLAutoErrorReporterSetter aers(cx, xpc::SystemErrorReporter); RootedValue NSGetFactory_val(cx); - if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", &NSGetFactory_val) || + if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", NSGetFactory_val.address()) || JSVAL_IS_VOID(NSGetFactory_val)) { return NULL; } @@ -1281,7 +1281,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, RootedValue symbols(mContext); if (!JS_GetProperty(mContext, mod->obj, - "EXPORTED_SYMBOLS", &symbols)) { + "EXPORTED_SYMBOLS", symbols.address())) { return ReportOnCaller(cxhelper, ERROR_NOT_PRESENT, PromiseFlatCString(aLocation).get()); } @@ -1316,7 +1316,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, PromiseFlatCString(aLocation).get(), i); } - if (!JS_GetPropertyById(mContext, mod->obj, symbolId, &value)) { + if (!JS_GetPropertyById(mContext, mod->obj, symbolId, value.address())) { JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId)); if (!bytes) return NS_ERROR_FAILURE; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 60a237ceb80..4975453318b 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -1916,7 +1916,7 @@ struct MOZ_STACK_CLASS ExceptionArgParser } // Get the property. - return JS_GetProperty(cx, obj, name, rv); + return JS_GetProperty(cx, obj, name, rv.address()); } /* @@ -2243,7 +2243,7 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,JSContext * RootedObject newObj(cx, &rval.toObject()); // first check existence of function property for better error reporting RootedValue fun(cx); - if (!JS_GetProperty(cx, newObj, mInitializer, &fun) || + if (!JS_GetProperty(cx, newObj, mInitializer, fun.address()) || fun.isPrimitive()) { return ThrowAndFail(NS_ERROR_XPC_BAD_INITIALIZER_NAME, cx, _retval); } @@ -2492,7 +2492,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, ifacesObj, id, &val) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, ifacesObj, id, val.address()) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_IID, cx, _retval); nsCOMPtr wn; @@ -2541,7 +2541,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, classesObj, id, &val) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, classesObj, id, val.address()) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_CID, cx, _retval); nsCOMPtr wn; @@ -3526,7 +3526,7 @@ GetPropFromOptions(JSContext *cx, HandleObject from, const char *name, MutableHa if (!JS_HasProperty(cx, from, name, found)) return NS_ERROR_INVALID_ARG; - if (found && !JS_GetProperty(cx, from, name, prop)) + if (found && !JS_GetProperty(cx, from, name, prop.address())) return NS_ERROR_INVALID_ARG; return NS_OK; @@ -4275,7 +4275,7 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx) for (size_t i = 0; i < ida.length(); ++i) { id = ida[i]; - if (!JS_GetPropertyById(cx, obj, id, &v)) + if (!JS_GetPropertyById(cx, obj, id, v.address())) return NS_ERROR_FAILURE; if (v.isPrimitive()) diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 8daab8aabad..6ccf8be6745 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -230,7 +230,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx, // check upfront for the existence of the function property funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE); - if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun)) + if (!JS_GetPropertyById(cx, jsobj, funid, fun.address()) || JSVAL_IS_PRIMITIVE(fun)) return nullptr; // Ensure that we are asking for a scriptable interface. @@ -330,7 +330,7 @@ GetNamedPropertyAsVariantRaw(XPCCallContext& ccx, nsXPTType type = nsXPTType((uint8_t)TD_INTERFACE_TYPE); RootedValue val(ccx); - return JS_GetPropertyById(ccx, aJSObj, aName, &val) && + return JS_GetPropertyById(ccx, aJSObj, aName, val.address()) && // Note that this always takes the T_INTERFACE path through // JSData2Native, so the value passed for useAllocator // doesn't really matter. We pass true for consistency. @@ -1264,7 +1264,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex, } } } else { - if (!JS_GetProperty(cx, obj, name, &fval)) + if (!JS_GetProperty(cx, obj, name, fval.address())) goto pre_call_clean_up; // XXX We really want to factor out the error reporting better and // specifically report the failure to find a function with this name. @@ -1431,7 +1431,7 @@ pre_call_clean_up: RootedValue rval(cx); if (XPT_MD_IS_GETTER(info->flags)) { - success = JS_GetProperty(cx, obj, name, &rval); + success = JS_GetProperty(cx, obj, name, rval.address()); } else if (XPT_MD_IS_SETTER(info->flags)) { rval = *argv; success = JS_SetProperty(cx, obj, name, rval); @@ -1514,7 +1514,7 @@ pre_call_clean_up: else if (JSVAL_IS_PRIMITIVE(argv[i]) || !JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) + val.address())) break; // setup allocator and/or iid @@ -1558,7 +1558,7 @@ pre_call_clean_up: val = rval; else if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) + val.address())) break; // setup allocator and/or iid diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 4120c1d57fb..7b61dda7431 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1993,7 +1993,7 @@ class CallMethodHelper nsID* result) const; JS_ALWAYS_INLINE JSBool - GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const; + GetOutParamSource(uint8_t paramIndex, jsval* srcp) const; JS_ALWAYS_INLINE JSBool GatherAndConvertResults(); @@ -2249,7 +2249,7 @@ CallMethodHelper::GetInterfaceTypeFromParam(uint8_t paramIndex, } JSBool -CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const +CallMethodHelper::GetOutParamSource(uint8_t paramIndex, jsval* srcp) const { const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(paramIndex); @@ -2529,7 +2529,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, &src)) + if (!GetOutParamSource(i, src.address())) return false; // All that's left to do is value conversion. Bail early if we don't need @@ -2634,7 +2634,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, &src)) + if (!GetOutParamSource(i, src.address())) return false; // All that's left to do is value conversion. Bail early if we don't need diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index 1b4a5ba4691..a6866a10077 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -121,7 +121,7 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper) JSAutoCompartment ac(ccx, mainObj); RootedValue val(ccx); - if (JS_GetPropertyById(ccx, mainObj, id, &val) && + if (JS_GetPropertyById(ccx, mainObj, id, val.address()) && !JSVAL_IS_PRIMITIVE(val)) { obj = JSVAL_TO_OBJECT(val); } diff --git a/js/xpconnect/src/dictionary_helper_gen.py b/js/xpconnect/src/dictionary_helper_gen.py index 5db3d401855..7f95405d9bb 100644 --- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -279,11 +279,13 @@ def write_header(iface, fd): def write_getter(a, iface, fd): realtype = a.realtype.nativeType('in') - fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &v));\n" - % get_jsid(a.name)) if realtype.count("JS::Value"): - fd.write(" aDict.%s = v;\n" % a.name) - elif realtype.count("bool"): + fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &aDict.%s));\n" + % (get_jsid(a.name), a.name)) + else: + fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, v.address()));\n" + % get_jsid(a.name)) + if realtype.count("bool"): fd.write(" JSBool b;\n") fd.write(" MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));\n") fd.write(" aDict.%s = b;\n" % a.name) @@ -371,11 +373,15 @@ def write_cpp(iface, fd): fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n") fd.write(" JSBool found = JS_FALSE;\n") + needjsval = False needccx = False for a in attributes: + if not a.realtype.nativeType('in').count("JS::Value"): + needjsval = True if a.realtype.nativeType('in').count("nsIVariant"): needccx = True - fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") + if needjsval: + fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") if needccx: fd.write(" XPCCallContext ccx(NATIVE_CALLER, aCx);\n") fd.write(" NS_ENSURE_STATE(ccx.IsValid());\n") diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 75da01bbc70..51f299f1f07 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -905,7 +905,7 @@ PeerConnectionImpl::ConvertConstraints( JS::Rooted constraints(aCx, &aConstraints.toObject()); // Mandatory constraints. Note that we only care if the constraint array exists - if (!JS_GetProperty(aCx, constraints, "mandatory", &mandatory)) { + if (!JS_GetProperty(aCx, constraints, "mandatory", mandatory.address())) { return NS_ERROR_FAILURE; } if (!mandatory.isNullOrUndefined()) { @@ -919,7 +919,7 @@ PeerConnectionImpl::ConvertConstraints( // Iterate over each property. for (size_t i = 0; i < mandatoryOpts.length(); i++) { JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], &option) || + if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], option.address()) || !JS_IdToValue(aCx, mandatoryOpts[i], optionName.address()) || // We only support boolean constraints for now. !option.isBoolean()) { @@ -935,7 +935,7 @@ PeerConnectionImpl::ConvertConstraints( } // Optional constraints. - if (!JS_GetProperty(aCx, constraints, "optional", &optional)) { + if (!JS_GetProperty(aCx, constraints, "optional", optional.address())) { return NS_ERROR_FAILURE; } if (!optional.isNullOrUndefined()) { @@ -961,7 +961,7 @@ PeerConnectionImpl::ConvertConstraints( return NS_ERROR_FAILURE; } JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], &option) || + if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], option.address()) || !JS_IdToValue(aCx, optionalOpts[0], optionName.address())) { return NS_ERROR_FAILURE; } diff --git a/startupcache/test/TestStartupCache.cpp b/startupcache/test/TestStartupCache.cpp index 417ccce9cdb..5ea45947d69 100644 --- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -416,11 +416,11 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id, JSFunction *snapshot_fn = NULL; Rooted ss(cx); return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot", - &snapshot_val) + snapshot_val.address()) && (snapshot_fn = JS_ValueToFunction(cx, snapshot_val)) && JS::Call(cx, JSVAL_TO_OBJECT(h), snapshot_fn, 0, NULL, &ss) - && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts)); + && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts.address())); } nsresult diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index e56a38e2c4c..927c4b54f4b 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -67,7 +67,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, &prop)) + if (!JS_GetProperty(cx, parent, name, prop.address())) return false; if (prop.isUndefined()) { @@ -76,7 +76,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", &prop)) + if (!JS_GetProperty(cx, obj, "prototype", prop.address())) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); @@ -92,7 +92,7 @@ InitAndSealCTypesClass(JSContext* cx, JS::Handle global) // Set callbacks for charset conversion and such. JS::Rooted ctypes(cx); - if (!JS_GetProperty(cx, global, "ctypes", &ctypes)) + if (!JS_GetProperty(cx, global, "ctypes", ctypes.address())) return false; JS_SetCTypesCallbacks(JSVAL_TO_OBJECT(ctypes), &sCallbacks); diff --git a/toolkit/components/perf/PerfMeasurement.cpp b/toolkit/components/perf/PerfMeasurement.cpp index 09df1d90f9b..1f959273535 100644 --- a/toolkit/components/perf/PerfMeasurement.cpp +++ b/toolkit/components/perf/PerfMeasurement.cpp @@ -42,7 +42,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, &prop)) + if (!JS_GetProperty(cx, parent, name, prop.address())) return false; if (prop.isUndefined()) { @@ -51,7 +51,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", &prop)) + if (!JS_GetProperty(cx, obj, "prototype", prop.address())) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 1d3c96ba0ec..07744a875e0 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -297,7 +297,7 @@ GetURIFromJSObject(JSContext* aCtx, const char* aProperty) { JS::Rooted uriVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, uriVal.address()); NS_ENSURE_TRUE(rc, nullptr); return GetJSValueAsURI(aCtx, uriVal); } @@ -355,7 +355,7 @@ GetStringFromJSObject(JSContext* aCtx, nsString& _string) { JS::Rooted val(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, val.address()); if (!rc) { _string.SetIsVoid(true); return; @@ -385,7 +385,7 @@ GetIntFromJSObject(JSContext* aCtx, IntType* _int) { JS::Rooted value(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, value.address()); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (JSVAL_IS_VOID(value)) { return NS_ERROR_INVALID_ARG; @@ -2808,7 +2808,7 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos, JS::Rooted visits(aCtx, nullptr); { JS::Rooted visitsVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal); + JSBool rc = JS_GetProperty(aCtx, info, "visits", visitsVal.address()); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (!JSVAL_IS_PRIMITIVE(visitsVal)) { visits = JSVAL_TO_OBJECT(visitsVal);