Support non-flat strings in Any_getelem and Any_setelem.
This commit is contained in:
@@ -302,6 +302,8 @@ jsval FASTCALL
|
||||
js_Any_getelem(JSContext* cx, JSObject* obj, JSString* idstr)
|
||||
{
|
||||
jsval v;
|
||||
if (!JSSTRING_IS_FLAT(idstr) && !js_UndependString(cx, idstr))
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
if (!OBJ_GET_PROPERTY(cx, obj, ATOM_TO_JSID(STRING_TO_JSVAL(idstr)), &v))
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
return v;
|
||||
@@ -310,6 +312,8 @@ js_Any_getelem(JSContext* cx, JSObject* obj, JSString* idstr)
|
||||
bool FASTCALL
|
||||
js_Any_setelem(JSContext* cx, JSObject* obj, JSString* idstr, jsval v)
|
||||
{
|
||||
if (!JSSTRING_IS_FLAT(idstr) && !js_UndependString(cx, idstr))
|
||||
return false;
|
||||
return OBJ_SET_PROPERTY(cx, obj, ATOM_TO_JSID(STRING_TO_JSVAL(idstr)), &v);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user