hannesw@1369: /* hannesw@1369: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. hannesw@1369: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. hannesw@1369: * hannesw@1369: * This code is free software; you can redistribute it and/or modify it hannesw@1369: * under the terms of the GNU General Public License version 2 only, as hannesw@1369: * published by the Free Software Foundation. hannesw@1369: * hannesw@1369: * This code is distributed in the hope that it will be useful, but WITHOUT hannesw@1369: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or hannesw@1369: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License hannesw@1369: * version 2 for more details (a copy is included in the LICENSE file that hannesw@1369: * accompanied this code). hannesw@1369: * hannesw@1369: * You should have received a copy of the GNU General Public License version hannesw@1369: * 2 along with this work; if not, write to the Free Software Foundation, hannesw@1369: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. hannesw@1369: * hannesw@1369: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA hannesw@1369: * or visit www.oracle.com if you need additional information or have any hannesw@1369: * questions. hannesw@1369: */ hannesw@1369: hannesw@1369: /** hannesw@1369: * JDK-8073846: Javascript for-in loop returned extra keys hannesw@1369: * hannesw@1369: * @test hannesw@1369: * @run hannesw@1369: */ hannesw@1369: hannesw@1369: var obj = {}; hannesw@1369: hannesw@1369: var list = [ hannesw@1369: '2100000', hannesw@1369: '420000', hannesw@1369: '430000' hannesw@1369: ]; hannesw@1369: hannesw@1369: for (var i = 0; i < list.length; i++) { hannesw@1369: if (obj[list[i]]) print("duplicate: " + list[i]); hannesw@1369: obj[list[i]] = 'obj' + list[i] hannesw@1369: } hannesw@1369: hannesw@1369: var count = 0; hannesw@1369: for (var a in obj) { hannesw@1369: count++; hannesw@1369: if ('obj' + a !== obj[a]) { hannesw@1369: throw 'wrong key or value: ' + a + ', ' + obj[a]; hannesw@1369: } hannesw@1369: } hannesw@1369: hannesw@1369: if (count !== 3) { hannesw@1369: throw 'wrong entry count: ' + count; hannesw@1369: }