Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | // http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 3 | |
michael@0 | 4 | var gTestfile = 'object-literal-accessor-arguments.js'; |
michael@0 | 5 | //----------------------------------------------------------------------------- |
michael@0 | 6 | var BUGNUMBER = 536472; |
michael@0 | 7 | var summary = |
michael@0 | 8 | 'ES5: { get x(v) { } } and { set x(v, v2) { } } should be syntax errors'; |
michael@0 | 9 | |
michael@0 | 10 | print(BUGNUMBER + ": " + summary); |
michael@0 | 11 | |
michael@0 | 12 | //----------------------------------------------------------------------------- |
michael@0 | 13 | |
michael@0 | 14 | function expectSyntaxError(s) |
michael@0 | 15 | { |
michael@0 | 16 | try |
michael@0 | 17 | { |
michael@0 | 18 | eval(s); |
michael@0 | 19 | throw new Error("no error thrown"); |
michael@0 | 20 | } |
michael@0 | 21 | catch (e) |
michael@0 | 22 | { |
michael@0 | 23 | assertEq(e instanceof SyntaxError, true, |
michael@0 | 24 | "expected syntax error parsing '" + s + "', got: " + e); |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | expectSyntaxError("({ get x(a) { } })"); |
michael@0 | 29 | expectSyntaxError("({ get x(a, a) { } })"); |
michael@0 | 30 | expectSyntaxError("({ get x(a, b) { } })"); |
michael@0 | 31 | expectSyntaxError("({ get x(a, a, b) { } })"); |
michael@0 | 32 | expectSyntaxError("({ get x(a, b, c) { } })"); |
michael@0 | 33 | |
michael@0 | 34 | expectSyntaxError("({ set x() { } })"); |
michael@0 | 35 | expectSyntaxError("({ set x(a, a) { } })"); |
michael@0 | 36 | expectSyntaxError("({ set x(a, b) { } })"); |
michael@0 | 37 | expectSyntaxError("({ set x(a, a, b) { } })"); |
michael@0 | 38 | expectSyntaxError("({ set x(a, b, c) { } })"); |
michael@0 | 39 | |
michael@0 | 40 | //----------------------------------------------------------------------------- |
michael@0 | 41 | |
michael@0 | 42 | reportCompare(true, true); |