jscript: Throw TypeError if T in 'new T' is not an object.
This commit is contained in:
parent
6d5bfce3ee
commit
e368fd545c
|
@ -1562,10 +1562,17 @@ HRESULT new_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, j
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&constr) != VT_DISPATCH) {
|
||||
FIXME("throw TypeError\n");
|
||||
/* NOTE: Should use to_object here */
|
||||
|
||||
if(V_VT(&constr) == VT_NULL) {
|
||||
VariantClear(&constr);
|
||||
return E_FAIL;
|
||||
return throw_type_error(ctx->parser->script, ei, IDS_OBJECT_EXPECTED, NULL);
|
||||
} else if(V_VT(&constr) != VT_DISPATCH) {
|
||||
VariantClear(&constr);
|
||||
return throw_type_error(ctx->parser->script, ei, IDS_UNSUPPORTED_ACTION, NULL);
|
||||
} else if(!V_DISPATCH(&constr)) {
|
||||
VariantClear(&constr);
|
||||
return throw_type_error(ctx->parser->script, ei, IDS_NO_PROPERTY, NULL);
|
||||
}
|
||||
|
||||
hres = disp_call(ctx->parser->script, V_DISPATCH(&constr), DISPID_VALUE,
|
||||
|
|
|
@ -1894,6 +1894,9 @@ exception_test(function() {(new Object()) instanceof nullDisp;}, "TypeError", -2
|
|||
exception_test(function() {"test" in 3;}, "TypeError", -2146823281);
|
||||
exception_test(function() {"test" in null;}, "TypeError", -2146823281);
|
||||
exception_test(function() {"test" in nullDisp;}, "TypeError", -2146823281);
|
||||
exception_test(function() {new 3;}, "TypeError", -2146827843);
|
||||
exception_test(function() {new null;}, "TypeError", -2146823281);
|
||||
exception_test(function() {new nullDisp;}, "TypeError", -2146827850);
|
||||
|
||||
function testThisExcept(func, number) {
|
||||
exception_test(function() {func.call(new Object())}, "TypeError", number);
|
||||
|
|
Loading…
Reference in New Issue