Bug 899973 - GC: Convert the rest of the JS property API to use MutableHandleValue for out params - browser changes r=bz

This commit is contained in:
Jon Coppeard 2013-08-02 13:15:39 +01:00
parent f15701296b
commit ef396b7874
10 changed files with 15 additions and 15 deletions

View File

@ -943,7 +943,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx, JS::Handle<JSObject*> global,
JS::Rooted<JSObject*> proto(cx); JS::Rooted<JSObject*> proto(cx);
JS::Rooted<JS::Value> val(cx); JS::Rooted<JS::Value> val(cx);
if (!::JS_LookupPropertyWithFlags(cx, global, className.get(), 0, val.address())) if (!::JS_LookupPropertyWithFlags(cx, global, className.get(), 0, &val))
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
if (val.isObject()) { if (val.isObject()) {

View File

@ -284,7 +284,7 @@ nsXBLProtoImpl::ResolveAllFields(JSContext *cx, JS::Handle<JSObject*> obj) const
JS::Rooted<JS::Value> dummy(cx); JS::Rooted<JS::Value> dummy(cx);
if (!::JS_LookupUCProperty(cx, obj, if (!::JS_LookupUCProperty(cx, obj,
reinterpret_cast<const jschar*>(name.get()), reinterpret_cast<const jschar*>(name.get()),
name.Length(), dummy.address())) { name.Length(), &dummy)) {
return false; return false;
} }
} }
@ -304,7 +304,7 @@ nsXBLProtoImpl::UndefineFields(JSContext *cx, JS::Handle<JSObject*> obj) const
if (::JS_AlreadyHasOwnUCProperty(cx, obj, s, name.Length(), &hasProp) && if (::JS_AlreadyHasOwnUCProperty(cx, obj, s, name.Length(), &hasProp) &&
hasProp) { hasProp) {
JS::Rooted<JS::Value> dummy(cx); JS::Rooted<JS::Value> dummy(cx);
::JS_DeleteUCProperty2(cx, obj, s, name.Length(), dummy.address()); ::JS_DeleteUCProperty2(cx, obj, s, name.Length(), &dummy);
} }
} }
} }

View File

@ -1932,7 +1932,7 @@ nsDOMClassInfo::ResolveConstructor(JSContext *cx, JSObject *aObj,
JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, obj)); JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, obj));
JS::Rooted<JS::Value> val(cx); JS::Rooted<JS::Value> val(cx);
if (!::JS_LookupProperty(cx, global, mData->mName, val.address())) { if (!::JS_LookupProperty(cx, global, mData->mName, &val)) {
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
@ -2601,7 +2601,7 @@ ResolveGlobalName(const nsAString& aName, void* aClosure)
JS::Rooted<JS::Value> dummy(closure->cx); JS::Rooted<JS::Value> dummy(closure->cx);
bool ok = JS_LookupUCProperty(closure->cx, closure->obj, bool ok = JS_LookupUCProperty(closure->cx, closure->obj,
aName.BeginReading(), aName.Length(), aName.BeginReading(), aName.Length(),
dummy.address()); &dummy);
if (!ok) { if (!ok) {
*closure->retval = false; *closure->retval = false;
return PL_DHASH_STOP; return PL_DHASH_STOP;
@ -3411,12 +3411,12 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
JSAutoCompartment ac(cx, winobj); JSAutoCompartment ac(cx, winobj);
JS::Rooted<JS::Value> val(cx); JS::Rooted<JS::Value> val(cx);
if (!JS_LookupProperty(cx, winobj, CutPrefix(class_parent_name), val.address())) { if (!JS_LookupProperty(cx, winobj, CutPrefix(class_parent_name), &val)) {
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
if (val.isObject()) { if (val.isObject()) {
if (!JS_LookupProperty(cx, &val.toObject(), "prototype", val.address())) { if (!JS_LookupProperty(cx, &val.toObject(), "prototype", &val)) {
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
@ -4233,7 +4233,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JS::Rooted<JS::Value> val(cx); JS::Rooted<JS::Value> val(cx);
if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags, if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags,
pobj.address(), val.address())) { pobj.address(), &val)) {
*_retval = JS_FALSE; *_retval = JS_FALSE;
return NS_OK; return NS_OK;

View File

@ -216,7 +216,7 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::Rooted<JSObject*> expando(cx); JS::Rooted<JSObject*> expando(cx);
if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) { if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
JS::Rooted<Value> v(cx); JS::Rooted<Value> v(cx);
if (!JS_DeletePropertyById2(cx, expando, id, v.address()) || if (!JS_DeletePropertyById2(cx, expando, id, &v) ||
!JS_ValueToBoolean(cx, v, &b)) { !JS_ValueToBoolean(cx, v, &b)) {
return false; return false;
} }

View File

@ -208,7 +208,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
if (!JS_DeleteUCProperty2(aCx, targetObject, if (!JS_DeleteUCProperty2(aCx, targetObject,
targetObjectPropName.get(), targetObjectPropName.get(),
targetObjectPropName.Length(), targetObjectPropName.Length(),
succeeded.address())) { &succeeded)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
} }
NS_ASSERTION(JSVAL_IS_BOOLEAN(succeeded), "Wtf?"); NS_ASSERTION(JSVAL_IS_BOOLEAN(succeeded), "Wtf?");

View File

@ -823,7 +823,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier id)
NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id),
"id must be either string or int!\n"); "id must be either string or int!\n");
ok = ::JS_DeletePropertyById2(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), deleted.address()); ok = ::JS_DeletePropertyById2(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), &deleted);
if (ok && deleted == JSVAL_TRUE) { if (ok && deleted == JSVAL_TRUE) {
// FIXME: See bug 425823, we shouldn't need to do this, and once // FIXME: See bug 425823, we shouldn't need to do this, and once
// that bug is fixed we can remove this code. // that bug is fixed we can remove this code.

View File

@ -284,7 +284,7 @@ JavaScriptChild::AnswerDelete(const ObjectId &objId, const nsString &id, ReturnS
return fail(cx, rs); return fail(cx, rs);
RootedValue v(cx); RootedValue v(cx);
if (!JS_DeletePropertyById2(cx, obj, internedId, v.address())) if (!JS_DeletePropertyById2(cx, obj, internedId, &v))
return fail(cx, rs); return fail(cx, rs);
JSBool b; JSBool b;

View File

@ -545,7 +545,7 @@ XPCWrappedNative::SweepTearOffs()
inline JSBool inline JSBool
xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id) xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id)
{ {
jsval prop; JS::RootedValue prop(cx);
if (!JS_LookupPropertyById(cx, obj, id, &prop)) if (!JS_LookupPropertyById(cx, obj, id, &prop))
return false; return false;

View File

@ -327,7 +327,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapperArg, jsid idArg, Wr
return true; return true;
RootedValue exposedProps(cx); RootedValue exposedProps(cx);
if (!JS_LookupPropertyById(cx, wrappedObject, exposedPropsId, exposedProps.address())) if (!JS_LookupPropertyById(cx, wrappedObject, exposedPropsId, &exposedProps))
return false; return false;
if (exposedProps.isNullOrUndefined()) if (exposedProps.isNullOrUndefined())

View File

@ -1629,7 +1629,7 @@ XrayWrapper<Base, Traits>::delete_(JSContext *cx, HandleObject wrapper,
if (expando) { if (expando) {
JSAutoCompartment ac(cx, expando); JSAutoCompartment ac(cx, expando);
RootedValue v(cx); RootedValue v(cx);
if (!JS_DeletePropertyById2(cx, expando, id, v.address()) || if (!JS_DeletePropertyById2(cx, expando, id, &v) ||
!JS_ValueToBoolean(cx, v, &b)) !JS_ValueToBoolean(cx, v, &b))
{ {
return false; return false;