test/script/basic/JDK-8176511.js

Fri, 10 Mar 2017 18:30:39 +0100

author
hannesw
date
Fri, 10 Mar 2017 18:30:39 +0100
changeset 2023
1786ff57788b
permissions
-rw-r--r--

8176511: JSObject property access is broken for numeric keys outside the int range
Reviewed-by: sundar

hannesw@2023 1 /*
hannesw@2023 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
hannesw@2023 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@2023 4 *
hannesw@2023 5 * This code is free software; you can redistribute it and/or modify it
hannesw@2023 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@2023 7 * published by the Free Software Foundation.
hannesw@2023 8 *
hannesw@2023 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@2023 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@2023 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@2023 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@2023 13 * accompanied this code).
hannesw@2023 14 *
hannesw@2023 15 * You should have received a copy of the GNU General Public License version
hannesw@2023 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@2023 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@2023 18 *
hannesw@2023 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@2023 20 * or visit www.oracle.com if you need additional information or have any
hannesw@2023 21 * questions.
hannesw@2023 22 */
hannesw@2023 23
hannesw@2023 24 /**
hannesw@2023 25 * JDK-8176511: JSObject property access is broken for numeric keys outside the int range
hannesw@2023 26 *
hannesw@2023 27 * @test
hannesw@2023 28 * @run
hannesw@2023 29 */
hannesw@2023 30
hannesw@2023 31
hannesw@2023 32 var reassignWithNewGlobal = loadWithNewGlobal({
hannesw@2023 33 script: '(function (o, i) { o[i] = o[i]; })', name: 'internal.js'
hannesw@2023 34
hannesw@2023 35 });
hannesw@2023 36
hannesw@2023 37 function test(i) {
hannesw@2023 38 var o = {};
hannesw@2023 39 o[i] = true;
hannesw@2023 40 var before = JSON.stringify(o);
hannesw@2023 41 reassignWithNewGlobal(o, i);
hannesw@2023 42 var after = JSON.stringify(o);
hannesw@2023 43 Assert.assertEquals(before, after);
hannesw@2023 44 }
hannesw@2023 45
hannesw@2023 46 test(-2147483649);
hannesw@2023 47 test(-2147483648);
hannesw@2023 48 test(2147483647);
hannesw@2023 49 test(2147483648);
hannesw@2023 50

mercurial