Bug 896949 - JS_SetProperty APIs should take an immutable parameter r=waldo r=bz

This commit is contained in:
Jon Coppeard 2013-07-26 10:00:38 +01:00
parent 9590164ca2
commit ebf3afbab4
25 changed files with 81 additions and 83 deletions

View File

@ -280,9 +280,7 @@ FieldSetterImpl(JSContext *cx, JS::CallArgs args)
}
if (installed) {
JS::Rooted<JS::Value> v(cx,
args.length() > 0 ? args[0] : JS::UndefinedValue());
if (!::JS_SetPropertyById(cx, thisObj, id, &v)) {
if (!::JS_SetPropertyById(cx, thisObj, id, args.get(0))) {
return false;
}
}

View File

@ -1404,7 +1404,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
NS_ENSURE_SUCCESS(rv, rv);
bool ok;
ok = JS_SetProperty(jscontext, jselement, "database", &jsdatabase);
ok = JS_SetProperty(jscontext, jselement, "database", jsdatabase);
NS_ASSERTION(ok, "unable to set database property");
if (! ok)
return NS_ERROR_FAILURE;
@ -1421,7 +1421,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
NS_ENSURE_SUCCESS(rv, rv);
bool ok;
ok = JS_SetProperty(jscontext, jselement, "builder", &jsbuilder);
ok = JS_SetProperty(jscontext, jselement, "builder", jsbuilder);
if (! ok)
return NS_ERROR_FAILURE;
}

View File

@ -61,7 +61,7 @@ SetJsObject(JSContext* aContext,
if (!JS_SetProperty(aContext, aObj,
NS_ConvertUTF16toUTF8(arr[i].name()).get(),
&val)) {
val)) {
NS_WARNING("Failed to set property");
return false;
}

View File

@ -161,27 +161,27 @@ CameraControlImpl::Get(JSContext* aCx, uint32_t aKey, JS::Value* aValue)
DOM_CAMERA_LOGI("top=%d\n", r->top);
v = INT_TO_JSVAL(r->top);
if (!JS_SetProperty(aCx, o, "top", &v)) {
if (!JS_SetProperty(aCx, o, "top", v)) {
return NS_ERROR_FAILURE;
}
DOM_CAMERA_LOGI("left=%d\n", r->left);
v = INT_TO_JSVAL(r->left);
if (!JS_SetProperty(aCx, o, "left", &v)) {
if (!JS_SetProperty(aCx, o, "left", v)) {
return NS_ERROR_FAILURE;
}
DOM_CAMERA_LOGI("bottom=%d\n", r->bottom);
v = INT_TO_JSVAL(r->bottom);
if (!JS_SetProperty(aCx, o, "bottom", &v)) {
if (!JS_SetProperty(aCx, o, "bottom", v)) {
return NS_ERROR_FAILURE;
}
DOM_CAMERA_LOGI("right=%d\n", r->right);
v = INT_TO_JSVAL(r->right);
if (!JS_SetProperty(aCx, o, "right", &v)) {
if (!JS_SetProperty(aCx, o, "right", v)) {
return NS_ERROR_FAILURE;
}
DOM_CAMERA_LOGI("weight=%d\n", r->weight);
v = INT_TO_JSVAL(r->weight);
if (!JS_SetProperty(aCx, o, "weight", &v)) {
if (!JS_SetProperty(aCx, o, "weight", v)) {
return NS_ERROR_FAILURE;
}

View File

@ -36,31 +36,31 @@ RecorderVideoProfile::GetJsObject(JSContext* aCx, JSObject** aObject)
JS::Rooted<JSString*> s(aCx, JS_NewStringCopyZ(aCx, codec));
JS::Rooted<JS::Value> v(aCx, STRING_TO_JSVAL(s));
if (!JS_SetProperty(aCx, o, "codec", &v)) {
if (!JS_SetProperty(aCx, o, "codec", v)) {
return NS_ERROR_FAILURE;
}
if (mBitrate != -1) {
v = INT_TO_JSVAL(mBitrate);
if (!JS_SetProperty(aCx, o, "bitrate", &v)) {
if (!JS_SetProperty(aCx, o, "bitrate", v)) {
return NS_ERROR_FAILURE;
}
}
if (mFramerate != -1) {
v = INT_TO_JSVAL(mFramerate);
if (!JS_SetProperty(aCx, o, "framerate", &v)) {
if (!JS_SetProperty(aCx, o, "framerate", v)) {
return NS_ERROR_FAILURE;
}
}
if (mWidth != -1) {
v = INT_TO_JSVAL(mWidth);
if (!JS_SetProperty(aCx, o, "width", &v)) {
if (!JS_SetProperty(aCx, o, "width", v)) {
return NS_ERROR_FAILURE;
}
}
if (mHeight != -1) {
v = INT_TO_JSVAL(mHeight);
if (!JS_SetProperty(aCx, o, "height", &v)) {
if (!JS_SetProperty(aCx, o, "height", v)) {
return NS_ERROR_FAILURE;
}
}
@ -97,25 +97,25 @@ RecorderAudioProfile::GetJsObject(JSContext* aCx, JSObject** aObject)
JS::Rooted<JSString*> s(aCx, JS_NewStringCopyZ(aCx, codec));
JS::Rooted<JS::Value> v(aCx, STRING_TO_JSVAL(s));
if (!JS_SetProperty(aCx, o, "codec", &v)) {
if (!JS_SetProperty(aCx, o, "codec", v)) {
return NS_ERROR_FAILURE;
}
if (mBitrate != -1) {
v = INT_TO_JSVAL(mBitrate);
if (!JS_SetProperty(aCx, o, "bitrate", &v)) {
if (!JS_SetProperty(aCx, o, "bitrate", v)) {
return NS_ERROR_FAILURE;
}
}
if (mSamplerate != -1) {
v = INT_TO_JSVAL(mSamplerate);
if (!JS_SetProperty(aCx, o, "samplerate", &v)) {
if (!JS_SetProperty(aCx, o, "samplerate", v)) {
return NS_ERROR_FAILURE;
}
}
if (mChannels != -1) {
v = INT_TO_JSVAL(mChannels);
if (!JS_SetProperty(aCx, o, "channels", &v)) {
if (!JS_SetProperty(aCx, o, "channels", v)) {
return NS_ERROR_FAILURE;
}
}
@ -185,7 +185,7 @@ RecorderProfileManager::GetJsObject(JSContext* aCx, JSObject** aObject) const
NS_ENSURE_SUCCESS(rv, rv);
JS::Rooted<JS::Value> v(aCx, OBJECT_TO_JSVAL(p));
if (!JS_SetProperty(aCx, o, profileName, &v)) {
if (!JS_SetProperty(aCx, o, profileName, v)) {
return NS_ERROR_FAILURE;
}
}

View File

@ -180,7 +180,7 @@ public:
JS::Rooted<JSString*> s(aCx, JS_NewStringCopyZ(aCx, format));
JS::Rooted<JS::Value> v(aCx, STRING_TO_JSVAL(s));
if (!JS_SetProperty(aCx, o, "format", &v)) {
if (!JS_SetProperty(aCx, o, "format", v)) {
return NS_ERROR_FAILURE;
}
@ -188,7 +188,7 @@ public:
nsresult rv = mVideo.GetJsObject(aCx, video.address());
NS_ENSURE_SUCCESS(rv, rv);
v = OBJECT_TO_JSVAL(video);
if (!JS_SetProperty(aCx, o, "video", &v)) {
if (!JS_SetProperty(aCx, o, "video", v)) {
return NS_ERROR_FAILURE;
}
@ -196,7 +196,7 @@ public:
rv = mAudio.GetJsObject(aCx, audio.address());
NS_ENSURE_SUCCESS(rv, rv);
v = OBJECT_TO_JSVAL(audio);
if (!JS_SetProperty(aCx, o, "audio", &v)) {
if (!JS_SetProperty(aCx, o, "audio", v)) {
return NS_ERROR_FAILURE;
}

View File

@ -95,10 +95,10 @@ ParseDimensionItemAndAdd(JSContext* aCx, JS::Handle<JSObject*> aArray,
return NS_ERROR_OUT_OF_MEMORY;
}
if (!JS_SetProperty(aCx, o, "width", &w)) {
if (!JS_SetProperty(aCx, o, "width", w)) {
return NS_ERROR_FAILURE;
}
if (!JS_SetProperty(aCx, o, "height", &h)) {
if (!JS_SetProperty(aCx, o, "height", h)) {
return NS_ERROR_FAILURE;
}
@ -371,11 +371,11 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::Value* aVideoSizes)
for (uint32_t i = 0; i < sizes.Length(); ++i) {
JS::Rooted<JSObject*> o(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
JS::Rooted<JS::Value> v(cx, INT_TO_JSVAL(sizes[i].width));
if (!JS_SetProperty(cx, o, "width", &v)) {
if (!JS_SetProperty(cx, o, "width", v)) {
return NS_ERROR_FAILURE;
}
v = INT_TO_JSVAL(sizes[i].height);
if (!JS_SetProperty(cx, o, "height", &v)) {
if (!JS_SetProperty(cx, o, "height", v)) {
return NS_ERROR_FAILURE;
}

View File

@ -787,8 +787,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier id,
NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id),
"id must be either string or int!\n");
ok = ::JS_SetPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id),
&v);
ok = ::JS_SetPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), v);
// return ok == JS_TRUE to quiet down compiler warning, even if
// return ok is what we really want.

View File

@ -634,7 +634,7 @@ bool SetStringProperty(JSContext *cx, JS::Handle<JSObject*> aObject, const char
JSString* strValue = JS_NewUCStringCopyZ(cx, aValue.get());
NS_ENSURE_TRUE(strValue, false);
JS::Rooted<JS::Value> valValue(cx, STRING_TO_JSVAL(strValue));
return JS_SetProperty(cx, aObject, aProperty, &valValue);
return JS_SetProperty(cx, aObject, aProperty, valValue);
}
/**
@ -707,14 +707,14 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
}
JS::Rooted<JS::Value> valVersion(cx, STRING_TO_JSVAL(strVersion));
if (!JS_SetProperty(cx, objSys, "Name", &valVersion)) {
if (!JS_SetProperty(cx, objSys, "Name", valVersion)) {
return false;
}
}
#if defined(DEBUG)
JS::Rooted<JS::Value> valDebug(cx, JSVAL_TRUE);
if (!JS_SetProperty(cx, objSys, "DEBUG", &valDebug)) {
if (!JS_SetProperty(cx, objSys, "DEBUG", valDebug)) {
return false;
}
#endif

View File

@ -414,7 +414,7 @@ JavaScriptChild::AnswerSet(const ObjectId &objId, const ObjectId &receiverId, co
if (!toValue(cx, value, &val))
return fail(cx, rs);
if (!JS_SetPropertyById(cx, obj, internedId, &val))
if (!JS_SetPropertyById(cx, obj, internedId, val))
return fail(cx, rs);
if (!toVariant(cx, val, result))

View File

@ -436,7 +436,7 @@ JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
return false;
JSObject *obj = &outobjects[i].toObject();
if (!JS_SetProperty(cx, obj, "value", &v))
if (!JS_SetProperty(cx, obj, "value", v))
return false;
}

View File

@ -38,7 +38,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "rooting-analysis", &value))
if (!JS_SetProperty(cx, info, "rooting-analysis", value))
return false;
#ifdef JSGC_USE_EXACT_ROOTING
@ -46,7 +46,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "exact-rooting", &value))
if (!JS_SetProperty(cx, info, "exact-rooting", value))
return false;
#ifdef DEBUG
@ -54,7 +54,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "debug", &value))
if (!JS_SetProperty(cx, info, "debug", value))
return false;
#ifdef JS_HAS_CTYPES
@ -62,7 +62,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "has-ctypes", &value))
if (!JS_SetProperty(cx, info, "has-ctypes", value))
return false;
#ifdef JS_CPU_X86
@ -70,7 +70,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "x86", &value))
if (!JS_SetProperty(cx, info, "x86", value))
return false;
#ifdef JS_CPU_X64
@ -78,7 +78,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "x64", &value))
if (!JS_SetProperty(cx, info, "x64", value))
return false;
#ifdef MOZ_ASAN
@ -86,7 +86,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "asan", &value))
if (!JS_SetProperty(cx, info, "asan", value))
return false;
#ifdef JS_GC_ZEAL
@ -94,7 +94,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "has-gczeal", &value))
if (!JS_SetProperty(cx, info, "has-gczeal", value))
return false;
#ifdef JS_THREADSAFE
@ -102,7 +102,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "threadsafe", &value))
if (!JS_SetProperty(cx, info, "threadsafe", value))
return false;
#ifdef JS_MORE_DETERMINISTIC
@ -110,7 +110,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "more-deterministic", &value))
if (!JS_SetProperty(cx, info, "more-deterministic", value))
return false;
#ifdef MOZ_PROFILING
@ -118,7 +118,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "profiling", &value))
if (!JS_SetProperty(cx, info, "profiling", value))
return false;
#ifdef INCLUDE_MOZILLA_DTRACE
@ -126,7 +126,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "dtrace", &value))
if (!JS_SetProperty(cx, info, "dtrace", value))
return false;
#ifdef MOZ_TRACE_JSCALLS
@ -134,7 +134,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "trace-jscalls-api", &value))
if (!JS_SetProperty(cx, info, "trace-jscalls-api", value))
return false;
#ifdef JSGC_INCREMENTAL
@ -142,7 +142,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "incremental-gc", &value))
if (!JS_SetProperty(cx, info, "incremental-gc", value))
return false;
#ifdef JSGC_GENERATIONAL
@ -150,7 +150,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "generational-gc", &value))
if (!JS_SetProperty(cx, info, "generational-gc", value))
return false;
#ifdef MOZ_VALGRIND
@ -158,7 +158,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "valgrind", &value))
if (!JS_SetProperty(cx, info, "valgrind", value))
return false;
#ifdef JS_OOM_DO_BACKTRACES
@ -166,7 +166,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "oom-backtraces", &value))
if (!JS_SetProperty(cx, info, "oom-backtraces", value))
return false;
#ifdef ENABLE_PARALLEL_JS
@ -174,7 +174,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "parallelJS", &value))
if (!JS_SetProperty(cx, info, "parallelJS", value))
return false;
#ifdef ENABLE_BINARYDATA
@ -182,7 +182,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "binary-data", &value))
if (!JS_SetProperty(cx, info, "binary-data", value))
return false;
*vp = ObjectValue(*info);

View File

@ -41,7 +41,7 @@ BEGIN_TEST(testContexts_bug563735)
JSAutoRequest req(cx2);
JSAutoCompartment ac(cx2, global);
JS::RootedValue v(cx2);
ok = JS_SetProperty(cx2, global, "x", &v);
ok = JS_SetProperty(cx2, global, "x", v);
}
CHECK(ok);

View File

@ -161,7 +161,7 @@ BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
JS::RootedObject debuggeeWrapper(cx, debuggee);
CHECK(JS_WrapObject(cx, debuggeeWrapper.address()));
JS::RootedValue v(cx, JS::ObjectValue(*debuggeeWrapper));
CHECK(JS_SetProperty(cx, global, "debuggee", &v));
CHECK(JS_SetProperty(cx, global, "debuggee", v));
EVAL("var dbg = new Debugger(debuggee);\n"
"var hits = 0;\n"
@ -199,7 +199,7 @@ BEGIN_TEST(testDebugger_newScriptHook)
JS::RootedObject gWrapper(cx, g);
CHECK(JS_WrapObject(cx, gWrapper.address()));
JS::RootedValue v(cx, JS::ObjectValue(*gWrapper));
CHECK(JS_SetProperty(cx, global, "g", &v));
CHECK(JS_SetProperty(cx, global, "g", v));
EXEC("var dbg = Debugger(g);\n"
"var hits = 0;\n"

View File

@ -29,7 +29,7 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
CHECK(obj);
JS::RootedValue v0(cx, JSVAL_TRUE);
CHECK(JS_SetProperty(cx, obj, "here", &v0));
CHECK(JS_SetProperty(cx, obj, "here", v0));
JS::RootedValue v1(cx);
CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, v1.address()));
@ -53,7 +53,7 @@ BEGIN_TEST(testGetPropertyDefault_bug594060)
CHECK(stringToId(cx, "nothere", nothereid.address()));
JS::RootedValue v0(cx, JSVAL_TRUE);
CHECK(JS_SetPropertyById(cx, obj, hereid, &v0));
CHECK(JS_SetPropertyById(cx, obj, hereid, v0));
JS::RootedValue v1(cx);
CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, v1.address()));

View File

@ -55,10 +55,10 @@ JS_NEVER_INLINE bool helper(JSObject *regexpProto)
CHECK(!r.empty());
}
jsval v = INT_TO_JSVAL(17);
CHECK(JS_SetProperty(cx, regexpProto, "foopy", &v));
JS::RootedValue v(cx, INT_TO_JSVAL(17));
CHECK(JS_SetProperty(cx, regexpProto, "foopy", v));
v = INT_TO_JSVAL(42);
CHECK(JS_SetProperty(cx, regexpProto, "bunky", &v));
CHECK(JS_SetProperty(cx, regexpProto, "bunky", v));
CHECK(JS_DeleteProperty(cx, regexpProto, "foopy"));
CHECK(regexpProto->inDictionaryMode());

View File

@ -4308,16 +4308,17 @@ JS_GetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t nam
}
JS_PUBLIC_API(JSBool)
JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp)
JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, HandleValue v)
{
RootedObject obj(cx, objArg);
RootedId id(cx, idArg);
RootedValue value(cx, v);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
return JSObject::setGeneric(cx, obj, obj, id, vp, false);
return JSObject::setGeneric(cx, obj, obj, id, &value, false);
}
JS_PUBLIC_API(JSBool)
@ -4338,20 +4339,20 @@ JS_SetElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
}
JS_PUBLIC_API(JSBool)
JS_SetProperty(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue vp)
JS_SetProperty(JSContext *cx, JSObject *objArg, const char *name, HandleValue v)
{
RootedObject obj(cx, objArg);
JSAtom *atom = Atomize(cx, name, strlen(name));
return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), vp);
return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), v);
}
JS_PUBLIC_API(JSBool)
JS_SetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
MutableHandleValue vp)
HandleValue v)
{
RootedObject obj(cx, objArg);
JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen));
return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), vp);
return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), v);
}
JS_PUBLIC_API(JSBool)

View File

@ -3489,10 +3489,10 @@ extern JS_PUBLIC_API(JSBool)
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::MutableHandle<JS::Value> vp);
JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle<JS::Value> v);
extern JS_PUBLIC_API(JSBool)
JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::Handle<JS::Value> v);
extern JS_PUBLIC_API(JSBool)
JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name);
@ -3577,7 +3577,7 @@ JS_GetUCProperty(JSContext *cx, JSObject *obj,
extern JS_PUBLIC_API(JSBool)
JS_SetUCProperty(JSContext *cx, JSObject *obj,
const jschar *name, size_t namelen,
JS::MutableHandle<JS::Value> vp);
JS::Handle<JS::Value> v);
extern JS_PUBLIC_API(JSBool)
JS_DeleteUCProperty2(JSContext *cx, JSObject *obj,

View File

@ -2408,10 +2408,10 @@ GetPDA(JSContext *cx, unsigned argc, jsval *vp)
value = pd->value;
flags.setInt32(pd->flags);
alias = pd->alias;
ok = JS_SetProperty(cx, pdobj, "id", &id) &&
JS_SetProperty(cx, pdobj, "value", &value) &&
JS_SetProperty(cx, pdobj, "flags", &flags) &&
JS_SetProperty(cx, pdobj, "alias", &alias);
ok = JS_SetProperty(cx, pdobj, "id", id) &&
JS_SetProperty(cx, pdobj, "value", value) &&
JS_SetProperty(cx, pdobj, "flags", flags) &&
JS_SetProperty(cx, pdobj, "alias", alias);
if (!ok)
break;
}
@ -2517,7 +2517,7 @@ NewSandbox(JSContext *cx, bool lazy)
return NULL;
RootedValue value(cx, BooleanValue(lazy));
if (!JS_SetProperty(cx, obj, "lazy", &value))
if (!JS_SetProperty(cx, obj, "lazy", value))
return NULL;
}

View File

@ -514,7 +514,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path)
if (!array)
return false;
v.setObject(*array);
return !!JS_SetProperty(context, result, pathName, &v);
return !!JS_SetProperty(context, result, pathName, v);
}
/* The property's value had better be an array. */

View File

@ -1328,7 +1328,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
JSAutoCompartment target_ac(mContext, targetObj);
if (!JS_WrapValue(mContext, value.address()) ||
!JS_SetPropertyById(mContext, targetObj, symbolId, &value)) {
!JS_SetPropertyById(mContext, targetObj, symbolId, value)) {
JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId));
if (!bytes)
return NS_ERROR_FAILURE;

View File

@ -4287,7 +4287,7 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx)
continue;
if (!WrapCallable(cx, obj, id, propobj, &v) ||
!JS_SetPropertyById(cx, obj, id, &v))
!JS_SetPropertyById(cx, obj, id, v))
return NS_ERROR_FAILURE;
}

View File

@ -1366,7 +1366,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
if (param.IsIn()) {
if (!JS_SetPropertyById(cx, out_obj,
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val)) {
val)) {
goto pre_call_clean_up;
}
}
@ -1434,7 +1434,7 @@ pre_call_clean_up:
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);
success = JS_SetProperty(cx, obj, name, rval);
} else {
if (!JSVAL_IS_PRIMITIVE(fval)) {
uint32_t oldOpts = JS_GetOptions(cx);

View File

@ -2348,7 +2348,7 @@ CallMethodHelper::GatherAndConvertResults()
NS_ASSERTION(mArgv[i].isObject(), "out var is not object");
if (!JS_SetPropertyById(mCallContext,
&mArgv[i].toObject(),
mIdxValueId, &v)) {
mIdxValueId, v)) {
ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, i, mCallContext);
return false;
}

View File

@ -261,7 +261,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext)
JS::Rooted<JS::Value> jslistener(cx, OBJECT_TO_JSVAL(jsobj));
// ...and stuff it into the global context
bool ok = JS_SetProperty(cx, global, "HTTPIndex", &jslistener);
bool ok = JS_SetProperty(cx, global, "HTTPIndex", jslistener);
NS_ASSERTION(ok, "unable to set Listener property");
if (!ok)
return NS_ERROR_FAILURE;