Restore lost API compatibility: copy getter and setter as well as shortid when shadowing a prototype property that has a shortid (203084, r=rogerl, sr=shaver).

This commit is contained in:
brendan%mozilla.org 2003-05-02 17:36:58 +00:00
Родитель 0bd858567e
Коммит d5f651f929
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -2635,15 +2635,17 @@ js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
attrs = JSPROP_ENUMERATE;
/*
* Preserve the shortid when shadowing a property that uses the
* class getter and setter. Those functions must see the shortid
* for id, not id, when they're called on the shadow we are about
* to create in obj's scope.
* Preserve the shortid, getter, and setter when shadowing any
* property that has a shortid. An old API convention requires
* that the property's getter and setter functions receive the
* shortid, not id, when they are called on the shadow we are
* about to create in obj's scope.
*/
if ((sprop->flags & SPROP_HAS_SHORTID) &&
sprop->getter == getter && sprop->setter == setter) {
flags = sprop->flags;
if (sprop->flags & SPROP_HAS_SHORTID) {
flags = SPROP_HAS_SHORTID;
shortid = sprop->shortid;
getter = sprop->getter;
setter = sprop->setter;
}
/*