mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Don't do things to the object before we're sure it's the right type of object. bug 443569, r=brendan
This commit is contained in:
parent
8ee8338835
commit
ec01159cac
@ -3622,12 +3622,17 @@ regexp_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
}
|
||||
slot = JSVAL_TO_INT(id);
|
||||
if (slot == REGEXP_LAST_INDEX)
|
||||
return JS_GetReservedSlot(cx, obj, 0, vp);
|
||||
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
re = (JSRegExp *) JS_GetInstancePrivate(cx, obj, &js_RegExpClass, NULL);
|
||||
re = (JSRegExp *) JS_GetPrivate(cx, obj);
|
||||
if (re) {
|
||||
switch (slot) {
|
||||
case REGEXP_SOURCE:
|
||||
@ -3661,6 +3666,11 @@ regexp_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
ok = JS_TRUE;
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return ok;
|
||||
while (OBJ_GET_CLASS(cx, obj) != &js_RegExpClass) {
|
||||
obj = OBJ_GET_PROTO(cx, obj);
|
||||
if (!obj)
|
||||
return JS_TRUE;
|
||||
}
|
||||
slot = JSVAL_TO_INT(id);
|
||||
if (slot == REGEXP_LAST_INDEX) {
|
||||
if (!JS_ValueToNumber(cx, *vp, &lastIndex))
|
||||
|
Loading…
Reference in New Issue
Block a user