mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 897484 - GC: Convert JS_GetProperty APIs to take MutableHandleValue r=terrence r=bholley r=smaug
This commit is contained in:
parent
7cd7b13768
commit
20fb51afdd
@ -85,7 +85,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
||||
JSClass *objectClass = JS_GetClass(obj);
|
||||
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!JS_GetProperty(cx, global, "netscape", v.address()))
|
||||
if (!JS_GetProperty(cx, global, "netscape", &v))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JS::Rooted<JSObject*> securityObj(cx);
|
||||
@ -95,7 +95,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
||||
* "security" property.
|
||||
*/
|
||||
obj = &v.toObject();
|
||||
if (!JS_GetProperty(cx, obj, "security", v.address()) || !v.isObject())
|
||||
if (!JS_GetProperty(cx, obj, "security", &v) || !v.isObject())
|
||||
return NS_ERROR_FAILURE;
|
||||
securityObj = &v.toObject();
|
||||
} else {
|
||||
|
@ -748,8 +748,7 @@ 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.address()) ||
|
||||
if (!JS_GetProperty(ctx, object, "receiveMessage", &funval) ||
|
||||
!funval.isObject())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
@ -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.address())) {
|
||||
if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
|
||||
if (!JS_GetPropertyById(cx, thisObj, id, &v)) {
|
||||
return false;
|
||||
}
|
||||
args.rval().set(v);
|
||||
|
@ -541,7 +541,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", key.address()) ||
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -556,7 +556,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) {
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2713,7 +2713,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
||||
JSAutoCompartment ac(cx, thisObject);
|
||||
|
||||
JS::Rooted<JS::Value> funval(cx);
|
||||
if (!JS_GetProperty(cx, thisObject, "constructor", funval.address()) ||
|
||||
if (!JS_GetProperty(cx, thisObject, "constructor", &funval) ||
|
||||
!funval.isObject()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
@ -3218,7 +3218,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
||||
// This isn't a normal DOM object, see if this constructor lives on its
|
||||
// prototype chain.
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_GetProperty(cx, obj, "prototype", val.address())) {
|
||||
if (!JS_GetProperty(cx, obj, "prototype", &val)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -3959,7 +3959,10 @@ ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
|
||||
return ::JS_GetProperty(cx, obj, "content", vp);
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
bool result = ::JS_GetProperty(cx, obj, "content", &value);
|
||||
*vp = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class Interface>
|
||||
@ -4106,7 +4109,7 @@ DefineComponentsShim(JSContext *cx, JS::HandleObject global)
|
||||
|
||||
// Look up the appopriate interface object on the global.
|
||||
JS::Rooted<JS::Value> v(cx, JS::UndefinedValue());
|
||||
ok = JS_GetProperty(cx, global, domName, v.address());
|
||||
ok = JS_GetProperty(cx, global, domName, &v);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!v.isObject()) {
|
||||
NS_WARNING("Unable to find interface object on global");
|
||||
@ -4637,7 +4640,7 @@ nsGenericArraySH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
*length = 0;
|
||||
|
||||
JS::Rooted<JS::Value> lenval(cx);
|
||||
if (!JS_GetProperty(cx, obj, "length", lenval.address())) {
|
||||
if (!JS_GetProperty(cx, obj, "length", &lenval)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -4676,7 +4679,7 @@ nsGenericArraySH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
sCurrentlyEnumerating = true;
|
||||
|
||||
JS::Rooted<JS::Value> len_val(cx);
|
||||
JSBool ok = ::JS_GetProperty(cx, obj, "length", len_val.address());
|
||||
JSBool ok = ::JS_GetProperty(cx, obj, "length", &len_val);
|
||||
|
||||
if (ok && JSVAL_IS_INT(len_val)) {
|
||||
int32_t length = JSVAL_TO_INT(len_val);
|
||||
@ -5024,7 +5027,13 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return ::JS_GetUCProperty(cx, self, chars, length, vp);
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!::JS_GetUCProperty(cx, self, chars, length, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// StringArray helper
|
||||
|
@ -1322,7 +1322,13 @@ GetPropertyOnPrototype(JSContext* cx, JS::Handle<JSObject*> proxy,
|
||||
return true;
|
||||
}
|
||||
|
||||
return JS_ForwardGetPropertyTo(cx, proto, id, proxy, vp);
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_ForwardGetPropertyTo(cx, proto, id, proxy, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1741,7 +1747,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> protov(cx);
|
||||
DebugOnly<bool> ok = JS_GetProperty(cx, obj, "prototype", protov.address());
|
||||
DebugOnly<bool> ok = JS_GetProperty(cx, obj, "prototype", &protov);
|
||||
MOZ_ASSERT(ok, "Someone messed with our prototype property?");
|
||||
|
||||
JS::Rooted<JSObject*> interfacePrototype(cx, &protov.toObject());
|
||||
@ -1845,7 +1851,7 @@ GetWindowForJSImplementedObject(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
|
||||
// Look up the content-side object.
|
||||
JS::Rooted<JS::Value> domImplVal(cx);
|
||||
if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", domImplVal.address())) {
|
||||
if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", &domImplVal)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ bool
|
||||
CallbackInterface::GetCallableProperty(JSContext* cx, const char* aPropName,
|
||||
JS::MutableHandle<JS::Value> aCallable)
|
||||
{
|
||||
if (!JS_GetProperty(cx, mCallback, aPropName, aCallable.address())) {
|
||||
if (!JS_GetProperty(cx, mCallback, aPropName, aCallable)) {
|
||||
return false;
|
||||
}
|
||||
if (!aCallable.isObject() ||
|
||||
|
@ -5527,7 +5527,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.address())) {
|
||||
if (!JS_GetProperty(cx, obj, "%s", &v)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -7541,7 +7541,7 @@ class CGDOMJSProxyHandler_get(ClassMethod):
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
"if (hasUnforgeable) {\n"
|
||||
" return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp.address());\n"
|
||||
" return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp);\n"
|
||||
"}")
|
||||
getUnforgeableOrExpando = CallOnUnforgeableHolder(self.descriptor,
|
||||
hasUnforgeable)
|
||||
@ -7555,7 +7555,7 @@ if (expando) {
|
||||
}
|
||||
|
||||
if (hasProp) {
|
||||
return JS_GetPropertyById(cx, expando, id, vp.address());
|
||||
return JS_GetPropertyById(cx, expando, id, vp);
|
||||
}
|
||||
}"""
|
||||
|
||||
@ -8216,11 +8216,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().address())' %
|
||||
propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", &temp.ref())' %
|
||||
propName)
|
||||
else:
|
||||
propId = self.makeIdName(member.identifier.name);
|
||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.ref().address())" %
|
||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, &temp.ref())" %
|
||||
propId)
|
||||
|
||||
conversionReplacements = {
|
||||
@ -10120,7 +10120,7 @@ class CallbackGetter(CallbackMember):
|
||||
"attrName": self.attrName
|
||||
}
|
||||
return string.Template(
|
||||
'if (!JS_GetProperty(cx, mCallback, "${attrName}", rval.address())) {\n'
|
||||
'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n'
|
||||
' aRv.Throw(NS_ERROR_UNEXPECTED);\n'
|
||||
' return${errorReturn};\n'
|
||||
'}\n').substitute(replacements);
|
||||
|
@ -537,7 +537,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) {
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", value.address())||
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)||
|
||||
!value.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData)
|
||||
|
||||
JSObject& obj(val.toObject());
|
||||
|
||||
JS::Value key;
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
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::Value value;
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, &obj, "value", &value)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -607,7 +607,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData)
|
||||
}
|
||||
|
||||
if (match) {
|
||||
JS::Value value;
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, &obj, "value", &value)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -117,8 +117,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
||||
if (hasProp) {
|
||||
// Get if the property exists...
|
||||
JS::Rooted<JS::Value> intermediate(aCx);
|
||||
JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen,
|
||||
intermediate.address());
|
||||
JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Treat explicitly undefined as an error.
|
||||
|
@ -171,7 +171,7 @@ TCPSocketParent::SendCallback(const nsAString& aType, const JS::Value& aDataVal,
|
||||
nsDependentJSString name;
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_GetProperty(aCx, obj, "name", val.address())) {
|
||||
if (!JS_GetProperty(aCx, obj, "name", &val)) {
|
||||
NS_ERROR("No name property on supposed error object");
|
||||
} else if (JSVAL_IS_STRING(val)) {
|
||||
if (!name.init(aCx, JSVAL_TO_STRING(val))) {
|
||||
|
@ -540,7 +540,7 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::Value *rval)
|
||||
GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle<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<JS::Value> v(cx);
|
||||
JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, v.address());
|
||||
JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, &v);
|
||||
|
||||
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.address()) ||
|
||||
if (!GetProperty(cx, npjsobj->mJSObj, method, &fv) ||
|
||||
::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<JS::Value> v(cx);
|
||||
return (GetProperty(cx, npjsobj->mJSObj, id, v.address()) &&
|
||||
return (GetProperty(cx, npjsobj->mJSObj, id, &v) &&
|
||||
JSValToNPVariant(npp, cx, v, result));
|
||||
}
|
||||
|
||||
@ -1621,7 +1621,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
|
||||
// giving plugins a [[DefaultValue]] which uses only toString and not valueOf.
|
||||
|
||||
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
|
||||
if (!JS_GetProperty(cx, obj, "toString", v.address()))
|
||||
if (!JS_GetProperty(cx, obj, "toString", &v))
|
||||
return false;
|
||||
if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) {
|
||||
if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp.address()))
|
||||
|
@ -718,7 +718,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData)
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) {
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData)
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isBoolean()) {
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue,
|
||||
*/
|
||||
JS::Rooted<JS::Value> val(cx, aValue);
|
||||
JS::Rooted<JS::Value> toJSON(cx);
|
||||
if (JS_GetProperty(cx, obj, "toJSON", toJSON.address()) &&
|
||||
if (JS_GetProperty(cx, obj, "toJSON", &toJSON) &&
|
||||
toJSON.isObject() &&
|
||||
JS_ObjectIsCallable(cx, &toJSON.toObject())) {
|
||||
// If toJSON is implemented, it must not throw
|
||||
|
@ -605,7 +605,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle<JSObject*> aObject
|
||||
const char *aProperty)
|
||||
{
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_GetProperty(cx, aObject, aProperty, val.address())) {
|
||||
if (!JS_GetProperty(cx, aObject, aProperty, &val)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!val.isUndefined()) {
|
||||
|
@ -233,7 +233,7 @@ AudioManager::Observe(nsISupports* aSubject,
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", key.address()) ||
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -248,7 +248,7 @@ AudioManager::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) {
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
JSObject& obj(val.toObject());
|
||||
JS::Value key;
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, &obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
return NS_OK;
|
||||
@ -198,7 +198,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Value value;
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, &obj, "value", &value)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject,
|
||||
|
||||
// Get the key, which should be the JS string "time.timezone".
|
||||
JSObject &obj(val.toObject());
|
||||
JS::Value key;
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
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::Value value;
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, &obj, "value", &value) ||
|
||||
!value.isString()) {
|
||||
return NS_OK;
|
||||
|
@ -55,7 +55,7 @@ DefineChromeWorkerFunctions(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
{
|
||||
JS::Rooted<JS::Value> ctypes(aCx);
|
||||
if (!JS_InitCTypesClass(aCx, aGlobal) ||
|
||||
!JS_GetProperty(aCx, aGlobal, "ctypes", ctypes.address())) {
|
||||
!JS_GetProperty(aCx, aGlobal, "ctypes", &ctypes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget,
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_GetProperty(aCx, aEvent, "target", val.address())) {
|
||||
if (!JS_GetProperty(aCx, aEvent, "target", &val)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return false;
|
||||
}
|
||||
@ -316,7 +316,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget,
|
||||
JS::Rooted<JSString*> eventType(aCx);
|
||||
JSBool eventIsTrusted;
|
||||
|
||||
if (!JS_GetProperty(aCx, aEvent, "type", val.address()) ||
|
||||
if (!JS_GetProperty(aCx, aEvent, "type", &val) ||
|
||||
!(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.address()) ||
|
||||
if (!JS_GetProperty(aCx, aEvent, "isTrusted", &val) ||
|
||||
!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.address())) {
|
||||
if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, &listenerVal)) {
|
||||
if (!JS_ReportPendingException(aCx)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return false;
|
||||
|
@ -57,14 +57,14 @@ public:
|
||||
|
||||
if (aMainRuntime) {
|
||||
JS::Rooted<JS::Value> windowPropVal(aCx);
|
||||
if (!JS_GetProperty(aCx, aObj, sClass.name, windowPropVal.address())) {
|
||||
if (!JS_GetProperty(aCx, aObj, sClass.name, &windowPropVal)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(windowPropVal)) {
|
||||
JS::Rooted<JS::Value> protoVal(aCx);
|
||||
if (!JS_GetProperty(aCx, JSVAL_TO_OBJECT(windowPropVal), "prototype",
|
||||
protoVal.address())) {
|
||||
&protoVal)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -266,9 +266,10 @@ private:
|
||||
JS::Rooted<JSObject*> event(aCx, &JS_ARGV(aCx, aVp)[0].toObject());
|
||||
|
||||
jsval argv[3] = { JSVAL_VOID, JSVAL_VOID, JSVAL_VOID };
|
||||
if (!JS_GetProperty(aCx, event, "message", &argv[0]) ||
|
||||
!JS_GetProperty(aCx, event, "filename", &argv[1]) ||
|
||||
!JS_GetProperty(aCx, event, "lineno", &argv[2])) {
|
||||
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))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ Environment(JSObject* global)
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoCompartment ac(cx, global);
|
||||
Rooted<Value> v(cx);
|
||||
if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", v.address()) ||
|
||||
if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", &v) ||
|
||||
!v.get().isDouble())
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -372,7 +372,7 @@ JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, co
|
||||
if (!convertGeckoStringToId(cx, id, &internedId))
|
||||
return fail(cx, rs);
|
||||
|
||||
JS::Value val;
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ForwardGetPropertyTo(cx, obj, internedId, receiver, &val))
|
||||
return fail(cx, rs);
|
||||
|
||||
@ -516,7 +516,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv
|
||||
for (size_t i = 0; i < outobjects.length(); i++) {
|
||||
RootedObject obj(cx, &outobjects[i].toObject());
|
||||
|
||||
jsval v;
|
||||
RootedValue v(cx);
|
||||
JSBool found;
|
||||
if (JS_HasProperty(cx, obj, "value", &found)) {
|
||||
if (!JS_GetProperty(cx, obj, "value", &v))
|
||||
|
@ -457,7 +457,7 @@ JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray<CpowEn
|
||||
if (!convertIdToGeckoString(cx, id, &str))
|
||||
return false;
|
||||
|
||||
if (!JS_GetPropertyById(cx, aObj, id, v.address()))
|
||||
if (!JS_GetPropertyById(cx, aObj, id, &v))
|
||||
return false;
|
||||
|
||||
JSVariant var;
|
||||
|
@ -509,7 +509,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
if(!JS_GetUCProperty(cx, obj, nameChars, nameLen, val.address()))
|
||||
if(!JS_GetUCProperty(cx, obj, nameChars, nameLen, &val))
|
||||
{
|
||||
if (JS_IsExceptionPending(cx))
|
||||
{
|
||||
|
@ -1257,7 +1257,7 @@ static bool GetObjectProperty(JSContext *cx, HandleObject obj,
|
||||
const char *property, MutableHandleObject result)
|
||||
{
|
||||
RootedValue val(cx);
|
||||
if (!JS_GetProperty(cx, obj, property, val.address())) {
|
||||
if (!JS_GetProperty(cx, obj, property, &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2544,7 +2544,7 @@ ImplicitConvert(JSContext* cx,
|
||||
return false;
|
||||
|
||||
RootedValue prop(cx);
|
||||
if (!JS_GetPropertyById(cx, valObj, id, prop.address()))
|
||||
if (!JS_GetPropertyById(cx, valObj, id, &prop))
|
||||
return false;
|
||||
|
||||
// Convert the field via ImplicitConvert().
|
||||
@ -4292,7 +4292,7 @@ ArrayType::ConstructData(JSContext* cx,
|
||||
// This could be a JS array, or a CData array.
|
||||
RootedObject arg(cx, &args[0].toObject());
|
||||
RootedValue lengthVal(cx);
|
||||
if (!JS_GetProperty(cx, arg, "length", lengthVal.address()) ||
|
||||
if (!JS_GetProperty(cx, arg, "length", &lengthVal) ||
|
||||
!jsvalToSize(cx, lengthVal, false, &length)) {
|
||||
JS_ReportError(cx, "argument must be an array object or length");
|
||||
return JS_FALSE;
|
||||
@ -4644,7 +4644,7 @@ ExtractStructField(JSContext* cx, jsval val, JSObject** typeObj)
|
||||
}
|
||||
|
||||
RootedValue propVal(cx);
|
||||
if (!JS_GetPropertyById(cx, obj, nameid, propVal.address()))
|
||||
if (!JS_GetPropertyById(cx, obj, nameid, &propVal))
|
||||
return NULL;
|
||||
|
||||
if (propVal.isPrimitive() || !CType::IsCType(&propVal.toObject())) {
|
||||
@ -7411,7 +7411,7 @@ Int64::Construct(JSContext* cx,
|
||||
// Get ctypes.Int64.prototype from the 'prototype' property of the ctor.
|
||||
RootedValue slot(cx);
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ASSERT_OK(JS_GetProperty(cx, callee, "prototype", slot.address()));
|
||||
ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot));
|
||||
RootedObject proto(cx, JSVAL_TO_OBJECT(slot));
|
||||
JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass);
|
||||
|
||||
@ -7581,7 +7581,7 @@ UInt64::Construct(JSContext* cx,
|
||||
// Get ctypes.UInt64.prototype from the 'prototype' property of the ctor.
|
||||
RootedValue slot(cx);
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ASSERT_OK(JS_GetProperty(cx, callee, "prototype", slot.address()));
|
||||
ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot));
|
||||
RootedObject proto(cx, &slot.toObject());
|
||||
JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass);
|
||||
|
||||
|
@ -39,9 +39,9 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
// Byte lengths should all agree
|
||||
CHECK(JS_IsArrayBufferObject(obj));
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), size);
|
||||
JS_GetProperty(cx, obj, "byteLength", v.address());
|
||||
JS_GetProperty(cx, obj, "byteLength", &v);
|
||||
CHECK_SAME(v, INT_TO_JSVAL(size));
|
||||
JS_GetProperty(cx, view, "byteLength", v.address());
|
||||
JS_GetProperty(cx, view, "byteLength", &v);
|
||||
CHECK_SAME(v, INT_TO_JSVAL(size));
|
||||
|
||||
// Modifying the underlying data should update the value returned through the view
|
||||
@ -59,13 +59,13 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
|
||||
// Check that the original ArrayBuffer is neutered
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), 0);
|
||||
CHECK(JS_GetProperty(cx, obj, "byteLength", v.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "byteLength", &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(0));
|
||||
CHECK(JS_GetProperty(cx, view, "byteLength", v.address()));
|
||||
CHECK(JS_GetProperty(cx, view, "byteLength", &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(0));
|
||||
CHECK(JS_GetProperty(cx, view, "byteOffset", v.address()));
|
||||
CHECK(JS_GetProperty(cx, view, "byteOffset", &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(0));
|
||||
CHECK(JS_GetProperty(cx, view, "length", v.address()));
|
||||
CHECK(JS_GetProperty(cx, view, "length", &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(0));
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), 0);
|
||||
v = JSVAL_VOID;
|
||||
@ -164,7 +164,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
||||
|
||||
bool isNeutered(JS::HandleObject obj) {
|
||||
JS::RootedValue v(cx);
|
||||
return JS_GetProperty(cx, obj, "byteLength", v.address()) && v.toInt32() == 0;
|
||||
return JS_GetProperty(cx, obj, "byteLength", &v) && v.toInt32() == 0;
|
||||
}
|
||||
|
||||
END_TEST(testArrayBuffer_bug720949_viewList)
|
||||
|
@ -18,7 +18,7 @@ BEGIN_TEST(testException_bug860435)
|
||||
JS_CallFunctionValue(cx, global, fun, 0, v.address(), v.address());
|
||||
CHECK(v.isObject());
|
||||
|
||||
JS_GetProperty(cx, &v.toObject(), "stack", v.address());
|
||||
JS_GetProperty(cx, &v.toObject(), "stack", &v);
|
||||
CHECK(v.isString());
|
||||
return true;
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ BEGIN_TEST(testFunctionProperties)
|
||||
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
|
||||
JS::RootedValue y(cx);
|
||||
CHECK(JS_GetProperty(cx, obj, "arguments", y.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "arguments", &y));
|
||||
CHECK_SAME(y, JSVAL_NULL);
|
||||
|
||||
CHECK(JS_GetProperty(cx, obj, "caller", y.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "caller", &y));
|
||||
CHECK_SAME(y, JSVAL_NULL);
|
||||
|
||||
return true;
|
||||
|
@ -32,11 +32,11 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
|
||||
CHECK(JS_SetProperty(cx, obj, "here", v0));
|
||||
|
||||
JS::RootedValue v1(cx);
|
||||
CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, v1.address()));
|
||||
CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, &v1));
|
||||
CHECK(JSVAL_IS_TRUE(v1));
|
||||
|
||||
JS::RootedValue v2(cx);
|
||||
CHECK(JS_GetPropertyDefault(cx, obj, "nothere", JSVAL_FALSE, v2.address()));
|
||||
CHECK(JS_GetPropertyDefault(cx, obj, "nothere", JSVAL_FALSE, &v2));
|
||||
CHECK(JSVAL_IS_FALSE(v2));
|
||||
}
|
||||
|
||||
@ -56,11 +56,11 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
|
||||
CHECK(JS_SetPropertyById(cx, obj, hereid, v0));
|
||||
|
||||
JS::RootedValue v1(cx);
|
||||
CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, v1.address()));
|
||||
CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, &v1));
|
||||
CHECK(JSVAL_IS_TRUE(v1));
|
||||
|
||||
JS::RootedValue v2(cx);
|
||||
CHECK(JS_GetPropertyByIdDefault(cx, obj, nothereid, JSVAL_FALSE, v2.address()));
|
||||
CHECK(JS_GetPropertyByIdDefault(cx, obj, nothereid, JSVAL_FALSE, &v2));
|
||||
CHECK(JSVAL_IS_FALSE(v2));
|
||||
}
|
||||
|
||||
|
@ -114,16 +114,16 @@ BEGIN_TEST(testParseJSON_success)
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "length", v2.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "length", &v2));
|
||||
CHECK_SAME(v2, JSVAL_ZERO);
|
||||
|
||||
CHECK(Parse(cx, "[1]", &v));
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "0", v2.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "0", &v2));
|
||||
CHECK_SAME(v2, JSVAL_ONE);
|
||||
CHECK(JS_GetProperty(cx, obj, "length", v2.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "length", &v2));
|
||||
CHECK_SAME(v2, JSVAL_ONE);
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ BEGIN_TEST(testParseJSON_success)
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
CHECK(!JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "f", v2.address()));
|
||||
CHECK(JS_GetProperty(cx, obj, "f", &v2));
|
||||
CHECK_SAME(v2, INT_TO_JSVAL(17));
|
||||
|
||||
return true;
|
||||
|
@ -3770,13 +3770,14 @@ JS_SetUCPropertyAttributes(JSContext *cx, JSObject *objArg, const jschar *name,
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, jsval *vp)
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp)
|
||||
{
|
||||
return JS_ForwardGetPropertyTo(cx, objArg, idArg, objArg, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ForwardGetPropertyTo(JSContext *cx, JSObject *objArg, jsid idArg, JSObject *onBehalfOfArg, jsval *vp)
|
||||
JS_ForwardGetPropertyTo(JSContext *cx, JSObject *objArg, jsid idArg, JSObject *onBehalfOfArg,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject onBehalfOf(cx, onBehalfOfArg);
|
||||
@ -3788,27 +3789,18 @@ JS_ForwardGetPropertyTo(JSContext *cx, JSObject *objArg, jsid idArg, JSObject *o
|
||||
assertSameCompartment(cx, onBehalfOf);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!JSObject::getGeneric(cx, obj, onBehalfOf, id, &value))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
return JSObject::getGeneric(cx, obj, onBehalfOf, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyByIdDefault(JSContext *cx, JSObject *objArg, jsid idArg, jsval defArg, jsval *vp)
|
||||
JS_GetPropertyByIdDefault(JSContext *cx, JSObject *objArg, jsid idArg, jsval defArg,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
RootedValue def(cx, defArg);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!baseops::GetPropertyDefault(cx, obj, id, def, &value))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
return baseops::GetPropertyDefault(cx, obj, id, def, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3856,7 +3848,7 @@ JS_GetElementIfPresent(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetProperty(JSContext *cx, JSObject *objArg, const char *name, jsval *vp)
|
||||
JS_GetProperty(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = Atomize(cx, name, strlen(name));
|
||||
@ -3864,7 +3856,8 @@ JS_GetProperty(JSContext *cx, JSObject *objArg, const char *name, jsval *vp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDefault(JSContext *cx, JSObject *objArg, const char *name, jsval defArg, jsval *vp)
|
||||
JS_GetPropertyDefault(JSContext *cx, JSObject *objArg, const char *name, jsval defArg,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedValue def(cx, defArg);
|
||||
@ -3873,7 +3866,8 @@ JS_GetPropertyDefault(JSContext *cx, JSObject *objArg, const char *name, jsval d
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen, jsval *vp)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen));
|
||||
|
@ -3507,19 +3507,22 @@ 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, jsval *vp);
|
||||
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, jsval *vp);
|
||||
JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def,
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, jsval *vp);
|
||||
JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def,
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, jsval *vp);
|
||||
JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf,
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle<JS::Value> v);
|
||||
@ -3605,7 +3608,7 @@ JS_LookupUCProperty(JSContext *cx, JSObject *obj,
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *obj,
|
||||
const jschar *name, size_t namelen,
|
||||
jsval *vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetUCProperty(JSContext *cx, JSObject *obj,
|
||||
|
@ -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.address()) && val.isObject()) {
|
||||
if (JS_GetProperty(cx, callObj, "arguments", &val) && val.isObject()) {
|
||||
uint32_t argCount;
|
||||
RootedObject argsObj(cx, &val.toObject());
|
||||
if (JS_GetProperty(cx, argsObj, "length", val.address()) &&
|
||||
if (JS_GetProperty(cx, argsObj, "length", &val) &&
|
||||
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.address())) {
|
||||
if (JS_GetProperty(cx, argsObj, number, &val)) {
|
||||
JSAutoByteString valueBytes;
|
||||
const char *value = FormatValue(cx, val, valueBytes);
|
||||
buf = JS_sprintf_append(buf, "%s%s%s%s",
|
||||
|
@ -1048,14 +1048,14 @@ js_ReportUncaughtException(JSContext *cx)
|
||||
(exnObject->is<ErrorObject>() || IsDuckTypedErrorObject(cx, exnObject, &filename_str)))
|
||||
{
|
||||
RootedString name(cx);
|
||||
if (JS_GetProperty(cx, exnObject, js_name_str, &roots[2]) &&
|
||||
if (JS_GetProperty(cx, exnObject, js_name_str, tvr.handleAt(2)) &&
|
||||
JSVAL_IS_STRING(roots[2]))
|
||||
{
|
||||
name = JSVAL_TO_STRING(roots[2]);
|
||||
}
|
||||
|
||||
RootedString msg(cx);
|
||||
if (JS_GetProperty(cx, exnObject, js_message_str, &roots[3]) &&
|
||||
if (JS_GetProperty(cx, exnObject, js_message_str, tvr.handleAt(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, &roots[4])) {
|
||||
if (JS_GetProperty(cx, exnObject, filename_str, tvr.handleAt(4))) {
|
||||
JSString *tmp = ToString<CanGC>(cx, HandleValue::fromMarkedLocation(&roots[4]));
|
||||
if (tmp)
|
||||
filename.encodeLatin1(cx, tmp);
|
||||
}
|
||||
|
||||
uint32_t lineno;
|
||||
if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, &roots[5]) ||
|
||||
if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, tvr.handleAt(5)) ||
|
||||
!ToUint32(cx, roots[5], &lineno))
|
||||
{
|
||||
lineno = 0;
|
||||
}
|
||||
|
||||
uint32_t column;
|
||||
if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, &roots[5]) ||
|
||||
if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, tvr.handleAt(5)) ||
|
||||
!ToUint32(cx, roots[5], &column))
|
||||
{
|
||||
column = 0;
|
||||
|
@ -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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "newContext", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "compileAndGo", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "noScriptRval", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "fileName", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "element", &v))
|
||||
return false;
|
||||
if (!JSVAL_IS_PRIMITIVE(v))
|
||||
element = JSVAL_TO_OBJECT(v);
|
||||
|
||||
if (!JS_GetProperty(cx, opts, "sourceMapURL", v.address()))
|
||||
if (!JS_GetProperty(cx, opts, "sourceMapURL", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "lineNumber", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "global", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "catchTermination", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "saveFrameChain", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, obj, "lazy", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, obj, "lazy", &v))
|
||||
return false;
|
||||
|
||||
JS_ValueToBoolean(cx, v, &b);
|
||||
|
@ -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.address()))
|
||||
if (!JS_GetProperty(context, result, pathName, &v))
|
||||
return false;
|
||||
if (v.isUndefined()) {
|
||||
/* Create an array to accumulate referents under this path. */
|
||||
|
@ -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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "url", &v))
|
||||
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.address()))
|
||||
if (!JS_GetProperty(cx, opts, "lineNumber", &v))
|
||||
return false;
|
||||
if (!v.isUndefined()) {
|
||||
uint32_t lineno;
|
||||
|
@ -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.address()) ||
|
||||
if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", &NSGetFactory_val) ||
|
||||
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.address())) {
|
||||
"EXPORTED_SYMBOLS", &symbols)) {
|
||||
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.address())) {
|
||||
if (!JS_GetPropertyById(mContext, mod->obj, symbolId, &value)) {
|
||||
JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId));
|
||||
if (!bytes)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1916,7 +1916,7 @@ struct MOZ_STACK_CLASS ExceptionArgParser
|
||||
}
|
||||
|
||||
// Get the property.
|
||||
return JS_GetProperty(cx, obj, name, rv.address());
|
||||
return JS_GetProperty(cx, obj, name, rv);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -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.address()) ||
|
||||
if (!JS_GetProperty(cx, newObj, mInitializer, &fun) ||
|
||||
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.address()) || val.isPrimitive())
|
||||
if (!JS_GetPropertyById(cx, ifacesObj, id, &val) || val.isPrimitive())
|
||||
return ThrowAndFail(NS_ERROR_XPC_BAD_IID, cx, _retval);
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> 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.address()) || val.isPrimitive())
|
||||
if (!JS_GetPropertyById(cx, classesObj, id, &val) || val.isPrimitive())
|
||||
return ThrowAndFail(NS_ERROR_XPC_BAD_CID, cx, _retval);
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> 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.address()))
|
||||
if (found && !JS_GetProperty(cx, from, name, prop))
|
||||
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.address()))
|
||||
if (!JS_GetPropertyById(cx, obj, id, &v))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (v.isPrimitive())
|
||||
|
@ -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.address()) || JSVAL_IS_PRIMITIVE(fun))
|
||||
if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || 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.address()) &&
|
||||
return JS_GetPropertyById(ccx, aJSObj, aName, &val) &&
|
||||
// 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.address()))
|
||||
if (!JS_GetProperty(cx, obj, name, &fval))
|
||||
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.address());
|
||||
success = JS_GetProperty(cx, obj, name, &rval);
|
||||
} 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.address()))
|
||||
&val))
|
||||
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.address()))
|
||||
&val))
|
||||
break;
|
||||
|
||||
// setup allocator and/or iid
|
||||
|
@ -1993,7 +1993,7 @@ class CallMethodHelper
|
||||
nsID* result) const;
|
||||
|
||||
JS_ALWAYS_INLINE JSBool
|
||||
GetOutParamSource(uint8_t paramIndex, jsval* srcp) const;
|
||||
GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const;
|
||||
|
||||
JS_ALWAYS_INLINE JSBool
|
||||
GatherAndConvertResults();
|
||||
@ -2249,7 +2249,7 @@ CallMethodHelper::GetInterfaceTypeFromParam(uint8_t paramIndex,
|
||||
}
|
||||
|
||||
JSBool
|
||||
CallMethodHelper::GetOutParamSource(uint8_t paramIndex, jsval* srcp) const
|
||||
CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue 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.address()))
|
||||
if (!GetOutParamSource(i, &src))
|
||||
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.address()))
|
||||
if (!GetOutParamSource(i, &src))
|
||||
return false;
|
||||
|
||||
// All that's left to do is value conversion. Bail early if we don't need
|
||||
|
@ -121,7 +121,7 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper)
|
||||
JSAutoCompartment ac(ccx, mainObj);
|
||||
|
||||
RootedValue val(ccx);
|
||||
if (JS_GetPropertyById(ccx, mainObj, id, val.address()) &&
|
||||
if (JS_GetPropertyById(ccx, mainObj, id, &val) &&
|
||||
!JSVAL_IS_PRIMITIVE(val)) {
|
||||
obj = JSVAL_TO_OBJECT(val);
|
||||
}
|
||||
|
@ -279,13 +279,11 @@ def write_header(iface, fd):
|
||||
|
||||
def write_getter(a, iface, fd):
|
||||
realtype = a.realtype.nativeType('in')
|
||||
if realtype.count("JS::Value"):
|
||||
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"
|
||||
fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &v));\n"
|
||||
% get_jsid(a.name))
|
||||
if realtype.count("bool"):
|
||||
if realtype.count("JS::Value"):
|
||||
fd.write(" aDict.%s = v;\n" % a.name)
|
||||
elif 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)
|
||||
@ -373,14 +371,10 @@ 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
|
||||
if needjsval:
|
||||
fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n")
|
||||
if needccx:
|
||||
fd.write(" XPCCallContext ccx(NATIVE_CALLER, aCx);\n")
|
||||
|
@ -905,7 +905,7 @@ PeerConnectionImpl::ConvertConstraints(
|
||||
JS::Rooted<JSObject*> constraints(aCx, &aConstraints.toObject());
|
||||
|
||||
// Mandatory constraints. Note that we only care if the constraint array exists
|
||||
if (!JS_GetProperty(aCx, constraints, "mandatory", mandatory.address())) {
|
||||
if (!JS_GetProperty(aCx, constraints, "mandatory", &mandatory)) {
|
||||
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<JS::Value> option(aCx), optionName(aCx);
|
||||
if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], option.address()) ||
|
||||
if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], &option) ||
|
||||
!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.address())) {
|
||||
if (!JS_GetProperty(aCx, constraints, "optional", &optional)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!optional.isNullOrUndefined()) {
|
||||
@ -961,7 +961,7 @@ PeerConnectionImpl::ConvertConstraints(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS::Rooted<JS::Value> option(aCx), optionName(aCx);
|
||||
if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], option.address()) ||
|
||||
if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], &option) ||
|
||||
!JS_IdToValue(aCx, optionalOpts[0], optionName.address())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -416,11 +416,11 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id,
|
||||
JSFunction *snapshot_fn = NULL;
|
||||
Rooted<Value> ss(cx);
|
||||
return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot",
|
||||
snapshot_val.address())
|
||||
&snapshot_val)
|
||||
&& (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.address()));
|
||||
&& JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -67,7 +67,7 @@ static JSBool
|
||||
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
{
|
||||
JS::Rooted<JS::Value> prop(cx);
|
||||
if (!JS_GetProperty(cx, parent, name, prop.address()))
|
||||
if (!JS_GetProperty(cx, parent, name, &prop))
|
||||
return false;
|
||||
|
||||
if (prop.isUndefined()) {
|
||||
@ -76,7 +76,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, prop.toObjectOrNull());
|
||||
if (!JS_GetProperty(cx, obj, "prototype", prop.address()))
|
||||
if (!JS_GetProperty(cx, obj, "prototype", &prop))
|
||||
return false;
|
||||
|
||||
JS::Rooted<JSObject*> prototype(cx, prop.toObjectOrNull());
|
||||
@ -92,7 +92,7 @@ InitAndSealCTypesClass(JSContext* cx, JS::Handle<JSObject*> global)
|
||||
|
||||
// Set callbacks for charset conversion and such.
|
||||
JS::Rooted<JS::Value> ctypes(cx);
|
||||
if (!JS_GetProperty(cx, global, "ctypes", ctypes.address()))
|
||||
if (!JS_GetProperty(cx, global, "ctypes", &ctypes))
|
||||
return false;
|
||||
|
||||
JS_SetCTypesCallbacks(JSVAL_TO_OBJECT(ctypes), &sCallbacks);
|
||||
|
@ -42,7 +42,7 @@ static JSBool
|
||||
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
{
|
||||
JS::Rooted<JS::Value> prop(cx);
|
||||
if (!JS_GetProperty(cx, parent, name, prop.address()))
|
||||
if (!JS_GetProperty(cx, parent, name, &prop))
|
||||
return false;
|
||||
|
||||
if (prop.isUndefined()) {
|
||||
@ -51,7 +51,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, prop.toObjectOrNull());
|
||||
if (!JS_GetProperty(cx, obj, "prototype", prop.address()))
|
||||
if (!JS_GetProperty(cx, obj, "prototype", &prop))
|
||||
return false;
|
||||
|
||||
JS::Rooted<JSObject*> prototype(cx, prop.toObjectOrNull());
|
||||
|
@ -297,7 +297,7 @@ GetURIFromJSObject(JSContext* aCtx,
|
||||
const char* aProperty)
|
||||
{
|
||||
JS::Rooted<JS::Value> uriVal(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, uriVal.address());
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal);
|
||||
NS_ENSURE_TRUE(rc, nullptr);
|
||||
return GetJSValueAsURI(aCtx, uriVal);
|
||||
}
|
||||
@ -355,7 +355,7 @@ GetStringFromJSObject(JSContext* aCtx,
|
||||
nsString& _string)
|
||||
{
|
||||
JS::Rooted<JS::Value> val(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, val.address());
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val);
|
||||
if (!rc) {
|
||||
_string.SetIsVoid(true);
|
||||
return;
|
||||
@ -385,7 +385,7 @@ GetIntFromJSObject(JSContext* aCtx,
|
||||
IntType* _int)
|
||||
{
|
||||
JS::Rooted<JS::Value> value(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, value.address());
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
if (JSVAL_IS_VOID(value)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@ -2808,7 +2808,7 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
|
||||
JS::Rooted<JSObject*> visits(aCtx, nullptr);
|
||||
{
|
||||
JS::Rooted<JS::Value> visitsVal(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, info, "visits", visitsVal.address());
|
||||
JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
if (!JSVAL_IS_PRIMITIVE(visitsVal)) {
|
||||
visits = JSVAL_TO_OBJECT(visitsVal);
|
||||
|
Loading…
Reference in New Issue
Block a user