NASHORN-488.js revision 6:5a1b0714df0e
144301Swollman/*
244301Swollman * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
344301Swollman * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
444301Swollman *
544301Swollman * This code is free software; you can redistribute it and/or modify it
644301Swollman * under the terms of the GNU General Public License version 2 only, as
744301Swollman * published by the Free Software Foundation.
844301Swollman *
944301Swollman * This code is distributed in the hope that it will be useful, but WITHOUT
1044301Swollman * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1144301Swollman * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1244301Swollman * version 2 for more details (a copy is included in the LICENSE file that
1344301Swollman * accompanied this code).
1444301Swollman *
1544301Swollman * You should have received a copy of the GNU General Public License version
1644301Swollman * 2 along with this work; if not, write to the Free Software Foundation,
1744301Swollman * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1844301Swollman *
1944301Swollman * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2044301Swollman * or visit www.oracle.com if you need additional information or have any
2144301Swollman * questions.
2244301Swollman */
2344301Swollman
2444301Swollman/**
2544301Swollman * NASHORN-488 : Function.prototype does not have 'prototype' property
2644301Swollman *
2744301Swollman * @test
2844301Swollman * @run
2944301Swollman */
3044301Swollman
3144301Swollmanvar desc = Object.getOwnPropertyDescriptor(Function.prototype, "prototype");
3244301Swollmanif (desc !== undefined) {
3344301Swollman    fail("Function.prototype has 'prototype'");
3444301Swollman}
3544301Swollman
3644301SwollmanObject.defineProperty(Function.prototype, "prototype", {
3744301Swollman    set: undefined, get: function() { return 32; },
3844301Swollman    configurable: true
3944301Swollman});
4044301Swollman
4144301Swollmanif (Function.prototype.prototype != 32) {
4244301Swollman    fail("Function.prototype.prototype != 32");
4344301Swollman}
4444301Swollman
4544301Swollmanif (! (delete Function.prototype.prototype)) {
4644301Swollman    fail("can't delete Function.prototype.prototype");
4744301Swollman}
4844301Swollman
4944301Swollman