summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Proxy/proxy-constructNonObject.js
blob: 04cee11e963a25ef2b564df738fa365583fad57e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function bogusConstruct(target) { return 4; }
function bogusConstructUndefined(target) { }

var handler = { construct: bogusConstruct }

function callable() {}

var p = new Proxy(callable, handler);

assertThrowsInstanceOf(function () { new p(); }, TypeError,
                       "[[Construct must throw if an object is not returned.");

handler.construct = bogusConstructUndefined;
assertThrowsInstanceOf(function () { new p(); }, TypeError,
                       "[[Construct must throw if an object is not returned.");

if (typeof reportCompare === "function")
    reportCompare(0,0, "OK");