diff options
Diffstat (limited to 'js/src/tests/js1_5/Error/constructor-ordering.js')
-rw-r--r-- | js/src/tests/js1_5/Error/constructor-ordering.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/tests/js1_5/Error/constructor-ordering.js b/js/src/tests/js1_5/Error/constructor-ordering.js new file mode 100644 index 000000000..dbcc2e604 --- /dev/null +++ b/js/src/tests/js1_5/Error/constructor-ordering.js @@ -0,0 +1,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"); |