test/script/sandbox/loadcompat.js

Thu, 26 Sep 2013 10:43:59 -0700

author
cl
date
Thu, 26 Sep 2013 10:43:59 -0700
changeset 558
d1e2050e575e
parent 77
d7e83be6e7aa
child 623
aa452eb4a5d0
permissions
-rw-r--r--

Added tag jdk8-b109 for changeset 6ec2f9e5ed5b

sundar@77 1 /*
sundar@77 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
sundar@77 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@77 4 *
sundar@77 5 * This code is free software; you can redistribute it and/or modify it
sundar@77 6 * under the terms of the GNU General Public License version 2 only, as
sundar@77 7 * published by the Free Software Foundation.
sundar@77 8 *
sundar@77 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@77 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@77 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@77 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@77 13 * accompanied this code).
sundar@77 14 *
sundar@77 15 * You should have received a copy of the GNU General Public License version
sundar@77 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@77 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@77 18 *
sundar@77 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@77 20 * or visit www.oracle.com if you need additional information or have any
sundar@77 21 * questions.
sundar@77 22 */
sundar@77 23
sundar@77 24 /**
sundar@77 25 * Check that nashorn mozilla compatibility script can be loaded in sandbox.
sundar@77 26 *
sundar@77 27 * @test
sundar@77 28 * @run
sundar@77 29 * @security
sundar@77 30 */
sundar@77 31
sundar@77 32 load("nashorn:mozilla_compat.js");
sundar@77 33
sundar@77 34 var obj = {};
sundar@77 35 if (obj.__proto__ !== Object.prototype) {
sundar@77 36 fail("__proto__ does not work as expected");
sundar@77 37 }
sundar@77 38
sundar@77 39 var array = [];
sundar@77 40 if (array.__proto__ !== Array.prototype) {
sundar@77 41 fail("__proto__ does not work as expected");
sundar@77 42 }
sundar@77 43
sundar@77 44 if (typeof JavaAdapter != 'function') {
sundar@77 45 fail("JavaAdapter constructor is missing in compatibility script");
sundar@77 46 }
sundar@77 47
sundar@77 48 if (typeof importPackage != 'function') {
sundar@77 49 fail("importPackage function is missing in compatibility script");
sundar@77 50 }

mercurial