js/src/tests/ecma_6/Proxy/proxy-constructNonObject.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 function bogusConstruct(target) { return 4; }
     2 function bogusConstructUndefined(target) { }
     4 var handler = { construct: bogusConstruct }
     6 function callable() {}
     8 var p = new Proxy(callable, handler);
    10 assertThrowsInstanceOf(function () { new p(); }, TypeError,
    11                        "[[Construct must throw if an object is not returned.");
    13 handler.construct = bogusConstructUndefined;
    14 assertThrowsInstanceOf(function () { new p(); }, TypeError,
    15                        "[[Construct must throw if an object is not returned.");
    17 if (typeof reportCompare === "function")
    18     reportCompare(0,0, "OK");

mercurial