test/script/basic/JDK-8024120.js

Tue, 06 May 2014 17:54:15 +0530

author
sundar
date
Tue, 06 May 2014 17:54:15 +0530
changeset 847
ef8fa378d444
parent 537
b5ff11e00050
child 952
6d5471a497fb
child 962
ac62e33a99b0
permissions
-rw-r--r--

8042364: Make __proto__ ES6 draft compliant
Reviewed-by: jlaskey, lagergren, attila

sundar@537 1 /*
sundar@537 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
sundar@537 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@537 4 *
sundar@537 5 * This code is free software; you can redistribute it and/or modify it
sundar@537 6 * under the terms of the GNU General Public License version 2 only, as
sundar@537 7 * published by the Free Software Foundation.
sundar@537 8 *
sundar@537 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@537 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@537 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@537 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@537 13 * accompanied this code).
sundar@537 14 *
sundar@537 15 * You should have received a copy of the GNU General Public License version
sundar@537 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@537 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@537 18 *
sundar@537 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@537 20 * or visit www.oracle.com if you need additional information or have any
sundar@537 21 * questions.
sundar@537 22 */
sundar@537 23
sundar@537 24 /**
sundar@537 25 * JDK-8024120: Setting __proto__ to null removes the __proto__ property
sundar@537 26 *
sundar@537 27 * @test
sundar@537 28 * @run
sundar@537 29 */
sundar@537 30
sundar@537 31 var obj = {};
sundar@537 32
sundar@537 33 obj.__proto__ = null;
sundar@537 34
sundar@537 35 var p = Object.getPrototypeOf(obj);
sundar@537 36 if (p !== null || typeof(p) != 'object') {
sundar@537 37 fail("Object.getPrototypeOf(obj) is expected to be null");
sundar@537 38 }

mercurial