Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
3 "use strict";
5 //-----------------------------------------------------------------------------
6 var BUGNUMBER = 657713;
7 var summary =
8 "eval JSON parser hack misfires in strict mode, for objects with duplicate " +
9 "property names";
11 print(BUGNUMBER + ": " + summary);
13 /**************
14 * BEGIN TEST *
15 **************/
17 try
18 {
19 var r = eval('({"a": 2, "a": 3})');
20 throw new Error("didn't throw, returned " + r);
21 }
22 catch (e)
23 {
24 assertEq(e instanceof SyntaxError, true,
25 "strict mode forbids objects with duplicated property names: " + e);
26 }
28 try
29 {
30 var r = Function("'use strict'; return eval('({\"a\": 2, \"a\": 3})');")();
31 throw new Error("didn't throw, returned " + r);
32 }
33 catch (e)
34 {
35 assertEq(e instanceof SyntaxError, true,
36 "strict mode forbids objects with duplicated property names: " + e);
37 }
39 /******************************************************************************/
41 if (typeof reportCompare === "function")
42 reportCompare(true, true);
44 print("Tests complete!");