8145750: jjs fails to run simple scripts with security manager turned on
Reviewed-by: hannesw, alanb
--- a/jdk/src/java.base/share/conf/security/java.policy Sat Dec 19 02:24:27 2015 +0100
+++ b/jdk/src/java.base/share/conf/security/java.policy Mon Dec 21 09:40:00 2015 +0530
@@ -19,6 +19,10 @@
permission java.security.AllPermission;
};
+grant codeBase "jrt:/jdk.dynalink" {
+ permission java.security.AllPermission;
+};
+
grant codeBase "jrt:/jdk.scripting.nashorn" {
permission java.security.AllPermission;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/Hello.java Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This is a test program used in the test jjs-cpTest.sh.
+ */
+public class Hello {
+ public Hello() {}
+ public String getString() {
+ return "hello";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/args.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,21 @@
+/*
+ * This is the test JavaScript program used in jjs-argsTest.sh
+ */
+
+if (typeof(arguments) == 'undefined') {
+ throw new Error("arguments expected");
+}
+
+if (arguments.length != 2) {
+ throw new Error("2 arguments are expected here");
+}
+
+if (arguments[0] != 'hello') {
+ throw new Error("First arg should be 'hello'");
+}
+
+if (arguments[1] != 'world') {
+ throw new Error("Second arg should be 'world'");
+}
+
+print("Passed");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/classpath.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,8 @@
+/*
+ * This is the test JavaScript program used in jjs-cpTest.sh
+ */
+
+var v = new Packages.Hello();
+if (v.string != 'hello') {
+ throw new Error("Unexpected property value");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/common.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+
+setup() {
+ # Verify directory context variables are set
+ if [ "${TESTJAVA}" = "" ] ; then
+ echo "TESTJAVA not set. Test cannot execute. Failed."
+ exit 1
+ fi
+
+ if [ "${TESTCLASSES}" = "" ] ; then
+ TESTCLASSES="."
+ fi
+
+ if [ "${TESTSRC}" = "" ] ; then
+ TESTSRC="."
+ fi
+
+ OS=`uname -s`
+ case ${OS} in
+ Windows_*)
+ PS=";"
+ FS="\\"
+ # MKS diff deals with trailing CRs automatically
+ golden_diff="diff"
+ ;;
+ CYGWIN*)
+ PS=":"
+ FS="/"
+ # Cygwin diff needs to be told to ignore trailing CRs
+ golden_diff="diff --strip-trailing-cr"
+ ;;
+ *)
+ PS=":"
+ FS="/"
+ # Assume any other platform doesn't have the trailing CR stuff
+ golden_diff="diff"
+ ;;
+ esac
+
+ JJS="${TESTJAVA}/bin/jjs"
+ JAVAC="${TESTJAVA}/bin/javac"
+ JAVA="${TESTJAVA}/bin/java"
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/es6.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,13 @@
+/*
+ * This is the test JavaScript program used in jjs-es6Test.sh
+ */
+
+const X = 4;
+try {
+ X = 55;
+ throw new Error("should have thrown TypeError");
+} catch (e) {
+ if (! (e instanceof TypeError)) {
+ throw new Error("TypeError expected, got " + e);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/file.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,47 @@
+/*
+ * This is the test JavaScript program used in jjs-fileTest.sh
+ */
+
+// good old 'hello world'!
+print('hello');
+
+// basic number manipulation
+var v = 2 + 5;
+v *= 5;
+v.doubleValue();
+v = v + " is the value";
+if (v != 0) {
+ print('yes v != 0');
+}
+
+// basic java access
+java.lang.System.out.println('hello world from script');
+
+// basic stream manipulation
+var al = new java.util.ArrayList();
+al.add("hello");
+al.add("world");
+// script functions for lambas
+al.stream().map(function(s) s.toUpperCase()).forEach(print);
+
+// interface implementation
+new java.lang.Runnable() {
+ run: function() {
+ print('I am runnable');
+ }
+}.run();
+
+// java class extension
+var MyList = Java.extend(java.util.ArrayList);
+var m = new MyList() {
+ size: function() {
+ print("size called");
+ // call super.size()
+ return Java.super(m).size();
+ }
+};
+
+print("is m an ArrayList? " + (m instanceof java.util.ArrayList));
+m.add("hello");
+m.add("world");
+print(m.size());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/file.out Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,9 @@
+hello
+yes v != 0
+hello world from script
+HELLO
+WORLD
+I am runnable
+is m an ArrayList? true
+size called
+2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-DTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-DTest.sh
+# Tests passing of Java system property by -D option
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+# test whether value specified by -D option is passed
+# to script as java.lang.System property.
+
+${JJS} -J-Djava.security.manager -J-Djava.security.policy=${TESTSRC}/sysprops.policy -Djjs.foo=bar ${TESTSRC}/sysprops.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-argsTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-argsTest.sh
+# Tests passing of script arguments from the command line
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+# we check whether args after "--" are passed as script arguments
+
+${JJS} -J-Djava.security.manager ${TESTSRC}/args.js -- hello world
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-cpTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-cpTest.sh
+# Tests -cp/-classpath option to set the classpath for jjs
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+rm -f Hello.class
+${JAVAC} ${TESTSRC}/Hello.java -d .
+
+# we check whether classpath setting for app classes
+# work with jjs. Script should be able to
+# access Java class "Hello".
+
+${JJS} -J-Djava.security.manager -cp . ${TESTSRC}/classpath.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+
+# -classpath and -cp are synonyms
+
+${JJS} -J-Djava.security.manager -classpath . ${TESTSRC}/classpath.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+
+rm -f Hello.class
+echo "Passed"
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-es6Test.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-es6Test.sh
+# Tests ES6 language setting option '--language=es6'
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+${JJS} -J-Djava.security.manager --language=es6 ${TESTSRC}/es6.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-fileTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-fileTest.sh
+# Tests basic script file execution. Execute file.js and check output
+# against file.out file
+
+. ${TESTSRC-.}/common.sh
+
+setup
+rm -f jjs-fileTest.out 2>/dev/null
+${JJS} -J-Djava.security.manager ${TESTSRC}/file.js > jjs-fileTest.out 2>&1
+
+$golden_diff jjs-fileTest.out ${TESTSRC}/file.out
+if [ $? != 0 ]
+then
+ echo "Output of jjs file.js differ from expected output. Failed."
+ rm -f jjs-fileTest.out 2>/dev/null
+ exit 1
+fi
+
+rm -f jjs-fTest.out
+echo "Passed"
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-helpTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-helpTest.sh
+# Tests that the output of 'jjs -help' is not empty
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+rm -f jjs-helpTest.out 2>/dev/null
+${JJS} -J-Djava.security.manager -help > jjs-helpTest.out 2>&1
+
+if [ ! -s jjs-helpTest.out ]
+then
+ echo "Output of jjs -help is empty. Failed."
+ rm -f jjs-helpTest.out 2>/dev/null
+ exit 1
+fi
+
+rm -f jjs-helpTest.out 2>/dev/null
+
+echo "Passed"
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-scriptingTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-scriptingTest.sh
+# Tests setting scripting mode via -scripting option
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+${JJS} -J-Djava.security.manager -scripting ${TESTSRC}/scripting.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-strictTest.sh Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 8145750
+# @summary jjs fails to run simple scripts with security manager turned on
+# @run shell jjs-strictTest.sh
+# Tests basic ECMAScript strict mode setting via -strict option
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+${JJS} -J-Djava.security.manager -strict ${TESTSRC}/strict.js
+
+if [ $? -ne 0 ]; then
+ exit 1
+fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/scripting.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,18 @@
+/*
+ * This is the test JavaScript program used in jjs-scriptingTest.sh
+ */
+
+var str = <<END
+Multi line string
+works in scripting
+END
+
+var n = "Nashorn";
+var hello = "Hello, ${n}";
+if (hello != "Hello, Nashorn") {
+ throw new Error("string interpolation didn't work");
+}
+
+if (typeof readFully != "function") {
+ throw new Error("readFully is defined in -scripting");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/strict.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,12 @@
+/*
+ * This is the test JavaScript program used in jjs-strictTest.sh
+ */
+
+try {
+ v = "hello";
+ throw new Error("should have thrown ReferenceError");
+} catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ throw new Error("ReferenceError expected, got " + e);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/sysprops.js Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,11 @@
+/*
+ * This is the test JavaScript program used in jjs-DTest.sh
+ */
+
+var Sys = java.lang.System;
+if (Sys.getProperty("jjs.foo") == "bar") {
+ print("Passed");
+} else {
+ // unexpected value
+ throw new Error("Unexpected System property value");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/sysprops.policy Mon Dec 21 09:40:00 2015 +0530
@@ -0,0 +1,3 @@
+grant {
+ permission java.util.PropertyPermission "*", "read";
+};