mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
Only change the property's attributes when it's still on our object. bug 369227, r=brendan
This commit is contained in:
parent
db46a231f9
commit
81c29c7664
@ -335,6 +335,9 @@ static JSBool
|
||||
DropWatchPointAndUnlock(JSContext *cx, JSWatchPoint *wp, uintN flag)
|
||||
{
|
||||
JSScopeProperty *sprop;
|
||||
JSBool ok;
|
||||
JSObject *pobj;
|
||||
JSProperty *prop;
|
||||
JSPropertyOp setter;
|
||||
|
||||
wp->flags &= ~flag;
|
||||
@ -360,14 +363,31 @@ DropWatchPointAndUnlock(JSContext *cx, JSWatchPoint *wp, uintN flag)
|
||||
setter = js_GetWatchedSetter(cx->runtime, NULL, sprop);
|
||||
DBG_UNLOCK(cx->runtime);
|
||||
if (!setter) {
|
||||
sprop = js_ChangeNativePropertyAttrs(cx, wp->object, sprop,
|
||||
0, sprop->attrs,
|
||||
sprop->getter, wp->setter);
|
||||
ok = js_LookupProperty(cx, wp->object, sprop->id, &pobj, &prop);
|
||||
|
||||
/*
|
||||
* If the property wasn't found on wp->object or didn't exist, then
|
||||
* someone else has dealt with this sprop, and we don't need to change
|
||||
* the property attributes.
|
||||
*/
|
||||
if (ok && prop) {
|
||||
if (pobj == wp->object) {
|
||||
JS_ASSERT(OBJ_SCOPE(pobj)->object == pobj);
|
||||
|
||||
sprop = js_ChangeScopePropertyAttrs(cx, OBJ_SCOPE(pobj), sprop,
|
||||
0, sprop->attrs,
|
||||
sprop->getter,
|
||||
wp->setter);
|
||||
if (!sprop)
|
||||
ok = JS_FALSE;
|
||||
}
|
||||
OBJ_DROP_PROPERTY(cx, pobj, prop);
|
||||
}
|
||||
}
|
||||
|
||||
js_RemoveRoot(cx->runtime, &wp->closure);
|
||||
JS_free(cx, wp);
|
||||
return sprop != NULL;
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user