Use handles in API object hooks where possible, bug 750733. r=billm

This commit is contained in:
Brian Hackett
2012-05-19 09:48:09 -07:00
parent 694730ebfa
commit b7d2500332
102 changed files with 1681 additions and 1656 deletions

View File

@@ -499,13 +499,12 @@ msFromTime(double t)
*/
static JSBool
date_convert(JSContext *cx, JSObject *obj, JSType hint, Value *vp)
date_convert(JSContext *cx, HandleObject obj, JSType hint, Value *vp)
{
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
JS_ASSERT(obj->isDate());
return DefaultValue(cx, RootedVarObject(cx, obj),
(hint == JSTYPE_VOID) ? JSTYPE_STRING : hint, vp);
return DefaultValue(cx, obj, (hint == JSTYPE_VOID) ? JSTYPE_STRING : hint, vp);
}
/*
@@ -2693,11 +2692,11 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
if (!JS_DefineFunctions(cx, dateProto, date_methods))
return NULL;
Value toUTCStringFun;
jsid toUTCStringId = NameToId(cx->runtime->atomState.toUTCStringAtom);
jsid toGMTStringId = NameToId(cx->runtime->atomState.toGMTStringAtom);
if (!js_GetProperty(cx, dateProto, toUTCStringId, &toUTCStringFun) ||
!js_DefineProperty(cx, dateProto, toGMTStringId, &toUTCStringFun,
JS_PropertyStub, JS_StrictPropertyStub, 0))
RootedVarId toUTCStringId(cx, NameToId(cx->runtime->atomState.toUTCStringAtom));
RootedVarId toGMTStringId(cx, NameToId(cx->runtime->atomState.toGMTStringAtom));
if (!baseops::GetProperty(cx, dateProto, toUTCStringId, &toUTCStringFun) ||
!baseops::DefineProperty(cx, dateProto, toGMTStringId, &toUTCStringFun,
JS_PropertyStub, JS_StrictPropertyStub, 0))
{
return NULL;
}