Bug 1206168 - Rename JS_DefaultValue to JS::ToPrimitive. r=jandem.

This commit is contained in:
Jason Orendorff 2015-09-18 12:26:48 -05:00
parent 1323fdffb9
commit 25aecec3e7
3 changed files with 7 additions and 8 deletions

View File

@ -2297,14 +2297,14 @@ NPObjectMember_toPrimitive(JSContext *cx, unsigned argc, JS::Value *vp)
if (!memberPrivate)
return false;
JSType type;
if (!JS::GetFirstArgumentAsTypeHint(cx, args, &type))
JSType hint;
if (!JS::GetFirstArgumentAsTypeHint(cx, args, &hint))
return false;
args.rval().set(memberPrivate->fieldValue);
if (args.rval().isObject()) {
JS::Rooted<JSObject*> objVal(cx, &args.rval().toObject());
return JS_DefaultValue(cx, objVal, type, args.rval());
return JS::ToPrimitive(cx, objVal, hint, args.rval());
}
return true;
}

View File

@ -1802,7 +1802,7 @@ JS_IdToValue(JSContext* cx, jsid id, MutableHandleValue vp)
}
JS_PUBLIC_API(bool)
JS_DefaultValue(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp)
JS::ToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);

View File

@ -1898,6 +1898,8 @@ JS_StringToId(JSContext* cx, JS::HandleString s, JS::MutableHandleId idp);
extern JS_PUBLIC_API(bool)
JS_IdToValue(JSContext* cx, jsid id, JS::MutableHandle<JS::Value> vp);
namespace JS {
/**
* Convert obj to a primitive value. On success, store the result in vp and
* return true.
@ -1908,10 +1910,7 @@ JS_IdToValue(JSContext* cx, jsid id, JS::MutableHandle<JS::Value> vp);
* Implements: ES6 7.1.1 ToPrimitive(input, [PreferredType]).
*/
extern JS_PUBLIC_API(bool)
JS_DefaultValue(JSContext* cx, JS::HandleObject obj, JSType hint,
JS::MutableHandleValue vp);
namespace JS {
ToPrimitive(JSContext* cx, JS::HandleObject obj, JSType hint, JS::MutableHandleValue vp);
/**
* If args.get(0) is one of the strings "string", "number", or "default", set