Disallow non-canonical jsids, bug 751331. r=luke

This commit is contained in:
Brian Hackett
2012-05-06 13:45:19 -07:00
parent a8d6820bef
commit 33a75298e8
58 changed files with 511 additions and 655 deletions

View File

@@ -2675,7 +2675,7 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
SetDateToNaN(cx, dateProto);
RootedVarFunction ctor(cx);
ctor = global->createConstructor(cx, js_Date, CLASS_ATOM(cx, Date), MAXARGS);
ctor = global->createConstructor(cx, js_Date, CLASS_NAME(cx, Date), MAXARGS);
if (!ctor)
return NULL;
@@ -2693,8 +2693,8 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
if (!JS_DefineFunctions(cx, dateProto, date_methods))
return NULL;
Value toUTCStringFun;
jsid toUTCStringId = ATOM_TO_JSID(cx->runtime->atomState.toUTCStringAtom);
jsid toGMTStringId = ATOM_TO_JSID(cx->runtime->atomState.toGMTStringAtom);
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))