[PATCH] jscript: throw TypeError if T in 'new T' is not an object.

Reece Dunn msclrhd at googlemail.com
Thu Sep 30 05:44:25 CDT 2010


On 30 September 2010 11:25, Jacek Caban <jacek at codeweavers.com> wrote:
>  Hi Reece,
>
> On 9/30/10 12:20 AM, Reece Dunn wrote:
>>
>> This addresses a fixme in the jscript code that is currently triggered
>> when running the Big Fish Games client, with a test.
>
>     if(V_VT(&constr) != VT_DISPATCH) {
> -        FIXME("throw TypeError\n");
> +        hres = throw_type_error(ctx->parser->script, ei,
> IDS_OBJECT_EXPECTED, NULL);
>         VariantClear(&constr);
> -        return E_FAIL;
> +        return hres;
>
>
> It would be cleaner to clear constr before throw_type_error so that you can
> return its result directly, without storing it in hres.

You are correct. I will do this.

>  exception_test(function() {"test" in null;}, "TypeError", -2146823281);
>  exception_test(function() {"test" in nullDisp;}, "TypeError", -2146823281);
> +exception_test(function() {new null;}, "TypeError", -2146823281);
>
>
> While you're at this, it would be nice to add a test (and fix) for nullDisp
> and test some other types (eg. undefined and number).

I'll add tests for other types -- nullDisp, undefined, number, etc.
with any corresponding fixes.

- Reece



More information about the wine-devel mailing list