зеркало из https://github.com/mozilla/pjs.git
Propagate getters, setters and attributes when forwarding addproperty to the inner window. bug 369259, r=jst sr=brendan
This commit is contained in:
Родитель
2defeba10e
Коммит
493f35946a
|
@ -4662,11 +4662,29 @@ nsWindowSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
printf(" --- Forwarding add to inner window %p\n", (void *)innerWin);
|
printf(" --- Forwarding add to inner window %p\n", (void *)innerWin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Forward the add to the inner object
|
|
||||||
jsid interned_id;
|
jsid interned_id;
|
||||||
*_retval = (::JS_ValueToId(cx, id, &interned_id) &&
|
if (!::JS_ValueToId(cx, id, &interned_id)) {
|
||||||
OBJ_DEFINE_PROPERTY(cx, innerObj, interned_id, *vp, nsnull,
|
*_retval = JS_FALSE;
|
||||||
nsnull, JSPROP_ENUMERATE, nsnull));
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSProperty *prop = nsnull;
|
||||||
|
JSObject *pobj;
|
||||||
|
if (!OBJ_LOOKUP_PROPERTY(cx, obj, interned_id, &pobj, &prop)) {
|
||||||
|
*_retval = JS_FALSE;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(prop && obj == pobj, "The JS engine lies");
|
||||||
|
JSScopeProperty *sprop = reinterpret_cast<JSScopeProperty *>(prop);
|
||||||
|
JSPropertyOp getter = sprop->getter;
|
||||||
|
JSPropertyOp setter = sprop->setter;
|
||||||
|
uintN attrs = sprop->attrs;
|
||||||
|
OBJ_DROP_PROPERTY(cx, pobj, prop);
|
||||||
|
|
||||||
|
// Forward the add to the inner object
|
||||||
|
*_retval = OBJ_DEFINE_PROPERTY(cx, innerObj, interned_id, *vp, getter,
|
||||||
|
setter, attrs | JSPROP_ENUMERATE, nsnull);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче