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

Jacek Caban jacek at codeweavers.com
Thu Sep 30 05:25:54 CDT 2010

  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);
-        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.

  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).


More information about the wine-devel mailing list