summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_5/Error/constructor-ordering.js
blob: dbcc2e6048acc14e3fb7c3b6cc08de97364d764b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var order = 0;
function assertOrdering(ordering) {
    assertEq(order, ordering);
    order++;
}

// Spec mandates that the prototype is looked up /before/ we toString the
// argument.
var handler = { get() { assertOrdering(0); return Error.prototype } };
var errorProxy = new Proxy(Error, handler);

var toStringable = { toString() { assertOrdering(1); return "Argument"; } };

new errorProxy(toStringable);

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