michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: "use strict"; michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 657713; michael@0: var summary = michael@0: "eval JSON parser hack misfires in strict mode, for objects with duplicate " + michael@0: "property names"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: try michael@0: { michael@0: var r = eval('({"a": 2, "a": 3})'); michael@0: throw new Error("didn't throw, returned " + r); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "strict mode forbids objects with duplicated property names: " + e); michael@0: } michael@0: michael@0: try michael@0: { michael@0: var r = Function("'use strict'; return eval('({\"a\": 2, \"a\": 3})');")(); michael@0: throw new Error("didn't throw, returned " + r); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "strict mode forbids objects with duplicated property names: " + e); michael@0: } michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete!");