mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 488995 - fixing error reporting for getter-only properties. r=mrbkap sr=jst
This commit is contained in:
parent
b8845d61de
commit
e4bc4e81cb
@ -5987,6 +5987,21 @@ js_IsCallable(JSObject *obj, JSContext *cx)
|
||||
return callable;
|
||||
}
|
||||
|
||||
void
|
||||
js_ReportGetterOnlyAssignment(JSContext *cx)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_GETTER_ONLY, NULL);
|
||||
}
|
||||
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
js_ReportGetterOnlyAssignment(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/*
|
||||
|
@ -854,6 +854,12 @@ js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
|
||||
extern JSBool
|
||||
js_IsCallable(JSObject *obj, JSContext *cx);
|
||||
|
||||
void
|
||||
js_ReportGetterOnlyAssignment(JSContext *cx);
|
||||
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
|
||||
#ifdef DEBUG
|
||||
JS_FRIEND_API(void) js_DumpChars(const jschar *s, size_t n);
|
||||
JS_FRIEND_API(void) js_DumpString(JSString *str);
|
||||
|
@ -375,8 +375,7 @@ js_SetSprop(JSContext* cx, JSScopeProperty* sprop, JSObject* obj, jsval* vp)
|
||||
}
|
||||
|
||||
if (sprop->attrs & JSPROP_GETTER) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_GETTER_ONLY, NULL);
|
||||
js_ReportGetterOnlyAssignment(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -295,18 +295,23 @@ JSBool XPCIDispatchExtension::DefineProperty(XPCCallContext & ccx,
|
||||
// Define the property on the object
|
||||
NS_ASSERTION(member->IsProperty(), "way broken!");
|
||||
propFlags |= JSPROP_GETTER | JSPROP_SHARED;
|
||||
JSPropertyOp getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj);
|
||||
JSPropertyOp setter;
|
||||
if(member->IsSetter())
|
||||
{
|
||||
propFlags |= JSPROP_SETTER;
|
||||
propFlags &= ~JSPROP_READONLY;
|
||||
setter = getter;
|
||||
}
|
||||
else
|
||||
{
|
||||
setter = js_GetterOnlyPropertyStub;
|
||||
}
|
||||
AutoResolveName arn(ccx, idval);
|
||||
if(resolved)
|
||||
*resolved = JS_TRUE;
|
||||
return JS_ValueToId(ccx, idval, &id) &&
|
||||
JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
|
||||
JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter,
|
||||
propFlags);
|
||||
|
||||
}
|
||||
|
@ -469,21 +469,26 @@ DefinePropertyIfFound(XPCCallContext& ccx,
|
||||
NS_ASSERTION(member->IsAttribute(), "way broken!");
|
||||
|
||||
propFlags |= JSPROP_GETTER | JSPROP_SHARED;
|
||||
JSObject* funobj = JSVAL_TO_OBJECT(funval);
|
||||
JSPropertyOp getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj);
|
||||
JSPropertyOp setter;
|
||||
if(member->IsWritableAttribute())
|
||||
{
|
||||
propFlags |= JSPROP_SETTER;
|
||||
propFlags &= ~JSPROP_READONLY;
|
||||
setter = getter;
|
||||
}
|
||||
else
|
||||
{
|
||||
setter = js_GetterOnlyPropertyStub;
|
||||
}
|
||||
|
||||
AutoResolveName arn(ccx, idval);
|
||||
if(resolved)
|
||||
*resolved = JS_TRUE;
|
||||
|
||||
JSObject* funobj = JSVAL_TO_OBJECT(funval);
|
||||
return JS_ValueToId(ccx, idval, &id) &&
|
||||
JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
|
||||
JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter,
|
||||
propFlags);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user