Reland patch for bug 300562. Patch by brendan. r=jst, sr=shaver, a=brendan

This commit is contained in:
bzbarsky%mit.edu 2005-07-28 16:19:06 +00:00
Родитель 15e0289f25
Коммит a3fe488e21
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -699,17 +699,18 @@ XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
} }
jsval v; jsval v;
uintN attrs = JSPROP_ENUMERATE;
if (member->IsConstant()) { if (member->IsConstant()) {
v = memberval; v = memberval;
} else if (member->IsAttribute()) { } else if (member->IsAttribute()) {
// An attribute is being resolved. Define the property, the value // An attribute is being resolved. Define the property, the value
// will be dealt with in the get/set hooks. // will be dealt with in the get/set hooks. Use JSPROP_SHARED to
// avoid entraining last-got or last-set garbage beyond the life
// XXX: We should really just have getters and setters for // of the value in the getter or setter call site.
// properties and not do it the hard and expensive way.
v = JSVAL_VOID; v = JSVAL_VOID;
attrs |= JSPROP_SHARED;
} else { } else {
// We're dealing with a method member here. Clone a function we can // We're dealing with a method member here. Clone a function we can
// use for this object. NB: cx's newborn roots will protect funobj // use for this object. NB: cx's newborn roots will protect funobj
@ -742,7 +743,7 @@ XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str), if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
::JS_GetStringLength(str), v, nsnull, nsnull, ::JS_GetStringLength(str), v, nsnull, nsnull,
0)) { attrs)) {
return JS_FALSE; return JS_FALSE;
} }