Commit 8dd1d9b9 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Throw TypeErrors when _value functions are used as a function.

parent 412e0af2
......@@ -770,6 +770,8 @@ static HRESULT Array_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
case INVOKE_PROPERTYGET:
return array_join(dispex, lcid, ((ArrayInstance*)dispex)->length, default_separatorW, retv, ei, sp);
default:
......
......@@ -116,8 +116,18 @@ static HRESULT Bool_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, DIS
static HRESULT Bool_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static const builtin_prop_t Bool_props[] = {
......
......@@ -2040,8 +2040,17 @@ static HRESULT Date_getYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
static HRESULT Date_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static const builtin_prop_t Date_props[] = {
......
......@@ -141,8 +141,17 @@ static HRESULT Error_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags,
static HRESULT Error_value(DispatchEx *dispex, LCID lcid, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static void Error_destructor(DispatchEx *dispex)
......
......@@ -241,6 +241,8 @@ static HRESULT Number_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
NumberInstance *number = (NumberInstance*)dispex;
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET:
*retv = number->num;
break;
......
......@@ -120,6 +120,8 @@ static HRESULT Object_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET:
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(default_valueW);
......
......@@ -3516,8 +3516,17 @@ static HRESULT RegExp_test(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
static HRESULT RegExp_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static void RegExp_destructor(DispatchEx *dispex)
......
......@@ -1485,6 +1485,8 @@ static HRESULT String_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET: {
BSTR str = SysAllocString(This->str);
if(!str)
......
......@@ -1315,5 +1315,7 @@ exception_test(function() {arr.toString = Number.prototype.toString; arr.toStrin
exception_test(function() {(new Number(3)).toString(1);}, "TypeError", -2146828283);
exception_test(function() {not_existing_variable.something();}, "TypeError", -2146823279);
exception_test(function() {arr.toString = Function.prototype.toString; arr.toString();}, "TypeError", -2146823286);
exception_test(function() {date();}, "TypeError", -2146823286);
exception_test(function() {arr();}, "TypeError", -2146823286);
reportSuccess();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment