bug 580128 - Pass the right resolve flags to ResolveNativeHandler. r=peterv/jst

This commit is contained in:
Blake Kaplan 2010-09-24 15:30:00 -07:00
Родитель ce180ccef3
Коммит 64aaf55c41
2 изменённых файлов: 5 добавлений и 4 удалений

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

@ -6812,7 +6812,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// Unless our object is a native wrapper, in which case we have to
// define it ourselves.
*_retval = JS_DefineProperty(cx, obj, "document", v, NULL, NULL,
*_retval = JS_WrapValue(cx, &v) &&
JS_DefineProperty(cx, obj, "document", v, NULL, NULL,
JSPROP_READONLY | JSPROP_ENUMERATE);
if (!*_retval) {
return NS_ERROR_UNEXPECTED;

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

@ -209,7 +209,7 @@ ResolveNativeProperty(JSContext *cx, JSObject *wrapper, JSObject *holder, jsid i
JSBool retval = true;
JSObject *pobj = NULL;
uintN flags = cx->resolveFlags | (set ? JSRESOLVE_ASSIGNING : 0);
uintN flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
nsresult rv = wn->GetScriptableInfo()->GetCallback()->NewResolve(wn, cx, wrapper, id,
flags, &pobj, &retval);
if (NS_FAILED(rv)) {
@ -220,7 +220,7 @@ ResolveNativeProperty(JSContext *cx, JSObject *wrapper, JSObject *holder, jsid i
}
if (pobj)
return JS_GetPropertyDescriptorById(cx, pobj, id, cx->resolveFlags, desc);
return JS_GetPropertyDescriptorById(cx, pobj, id, flags, desc);
}
// There are no native numeric properties, so we can shortcut here. We will not
@ -411,7 +411,7 @@ XrayWrapper<Base, Policy>::defineProperty(JSContext *cx, JSObject *wrapper, jsid
if (!getOwnPropertyDescriptor(cx, wrapper, id, true, &existing_desc))
return false;
if (existing_desc.attrs & JSPROP_PERMANENT)
if (existing_desc.obj && (existing_desc.attrs & JSPROP_PERMANENT))
return true; // XXX throw?
JSPropertyDescriptor *jsdesc = Jsvalify(desc);