Set XOWs' prototypes to null to avoid confusion. bug 405726, r+sr=jst a=beltzner

This commit is contained in:
mrbkap%gmail.com 2007-12-04 19:07:08 +00:00
Родитель 4cf89a7e4d
Коммит 1d2b73a2f7
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -493,9 +493,15 @@ XPC_XOW_WrapObject(JSContext *cx, JSObject *parent, jsval *vp)
return JS_FALSE;
}
// Sever the prototype link from Object.prototype so we don't
// accidentally inherit properties like __proto__ and __parent__.
if (!JS_SetPrototype(cx, outerObj, nsnull)) {
return JS_FALSE;
}
if (!JS_SetReservedSlot(cx, outerObj, XPCWrapper::sWrappedObjSlot, *vp) ||
!JS_SetReservedSlot(cx, outerObj, XPCWrapper::sResolvingSlot,
BOOLEAN_TO_JSVAL(JS_FALSE)) ||
JSVAL_FALSE) ||
!JS_SetReservedSlot(cx, outerObj, XPC_XOW_ScopeSlot,
PRIVATE_TO_JSVAL(parentScope))) {
return JS_FALSE;