() {
+ @Override
+ public Void run() {
+ sm.checkPackageAccess(pkgName);
+ return null;
+ }
+ }, NO_PERMISSIONS_ACC_CTXT);
+ }
+ }
+
+ /**
+ * Checks that the given Class can be accessed from no permissions context.
+ *
+ * @param clazz Class object
* @return true if package is accessible, false otherwise
*/
- public static boolean isAccessiblePackage(final String fullName) {
+ private static boolean isAccessiblePackage(final Class clazz) {
try {
- checkPackageAccess(fullName);
+ checkPackageAccess(clazz);
return true;
} catch (final SecurityException se) {
return false;
@@ -653,7 +680,7 @@
* @return true if Class is accessible, false otherwise
*/
public static boolean isAccessibleClass(final Class> clazz) {
- return Modifier.isPublic(clazz.getModifiers()) && Context.isAccessiblePackage(clazz.getName());
+ return Modifier.isPublic(clazz.getModifiers()) && Context.isAccessiblePackage(clazz);
}
/**
@@ -667,8 +694,16 @@
* @throws ClassNotFoundException if class cannot be resolved
*/
public Class> findClass(final String fullName) throws ClassNotFoundException {
+ if (fullName.indexOf('[') != -1 || fullName.indexOf('/') != -1) {
+ // don't allow array class names or internal names.
+ throw new ClassNotFoundException(fullName);
+ }
+
// check package access as soon as possible!
- checkPackageAccess(fullName);
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ checkPackageAccess(sm, fullName);
+ }
// try the script -classpath loader, if that is set
if (classPathLoader != null) {
@@ -803,6 +838,18 @@
return Context.getContextTrusted();
}
+ private URL getResourceURL(final String resName) throws IOException {
+ // try the classPathLoader if we have and then
+ // try the appLoader if non-null.
+ if (classPathLoader != null) {
+ return classPathLoader.getResource(resName);
+ } else if (appLoader != null) {
+ return appLoader.getResource(resName);
+ }
+
+ return null;
+ }
+
private Object evaluateSource(final Source source, final ScriptObject scope, final ScriptObject thiz) {
ScriptFunction script = null;
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Tue Oct 08 15:00:12 2013 -0700
@@ -132,7 +132,7 @@
if (source != null) {
sb.append(source.getName())
.append(':')
- .append(source.getLine(Token.descPosition(token)))
+ .append(functionNode.getLineNumber())
.append(' ');
}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/src/jdk/nashorn/internal/runtime/Source.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java Tue Oct 08 15:00:12 2013 -0700
@@ -272,6 +272,10 @@
/**
* Return line number of character position.
+ *
+ * This method can be expensive for large sources as it iterates through
+ * all characters up to {@code position}.
+ *
* @param position Position of character in source content.
* @return Line number.
*/
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java Tue Oct 08 15:00:12 2013 -0700
@@ -109,7 +109,7 @@
if (sm != null) {
for (Class> type : types) {
// check for restricted package access
- Context.checkPackageAccess(type.getName());
+ Context.checkPackageAccess(type);
}
}
return getAdapterInfo(types).getAdapterClassFor(classOverrides);
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java Tue Oct 08 15:00:12 2013 -0700
@@ -70,7 +70,7 @@
// We intercept "new" on StaticClass instances to provide additional capabilities
if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) {
// make sure new is on accessible Class
- Context.checkPackageAccess(receiverClass.getName());
+ Context.checkPackageAccess(receiverClass);
// Is the class abstract? (This includes interfaces.)
if (NashornLinker.isAbstractClass(receiverClass)) {
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js Tue Oct 08 15:00:12 2013 -0700
@@ -33,7 +33,6 @@
var JFX_SWT_CLASSES = [];
function LOAD_FX_CLASSES(clsList) {
-
for each (var cls in clsList) {
// Ex. Stage = Java.type("javafx.stage.Stage");
this[cls[cls.length - 1]] = Java.type(cls.join("."));
@@ -146,3 +145,5 @@
}
}
})();
+
+LOAD_FX_CLASSES(JFX_BASE_CLASSES);
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8023026.js
--- a/nashorn/test/script/basic/JDK-8023026.js Wed Jul 05 19:15:04 2017 +0200
+++ b/nashorn/test/script/basic/JDK-8023026.js Tue Oct 08 15:00:12 2013 -0700
@@ -48,7 +48,7 @@
function(x) x*x));
}
-var array = new (Java.type("[I"))(4);
+var array = new (Java.type("int[]"))(4);
for (var i in array) {
array[i] = i;
}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025213.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025213.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025213: Assignment marks variable as defined too early
+ *
+ * @test
+ * @run
+ */
+
+function test() {
+ if (String("")) {
+ var foo = 42;
+ }
+ foo = foo + 1;
+ print(foo);
+}
+
+test();
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025213.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025213.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,1 @@
+NaN
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025488.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025488.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025488: Error.captureStackTrace should not format error stack
+ *
+ * @test
+ * @run
+ */
+
+
+function MyError () {
+ Error.call(this);
+ Error.captureStackTrace(this);
+ this.arr = {};
+};
+
+MyError.prototype.toString = function() {
+ return this.arr.toString();
+}
+
+var e = new MyError();
+print(e.stack);
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025488.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025488.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,3 @@
+[object Object]
+ at MyError (test/script/basic/JDK-8025488.js:34)
+ at (test/script/basic/JDK-8025488.js:42)
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025515.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025515.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025515: Performance issues with Source.getLine()
+ *
+ * @test
+ * @run
+ */
+
+// Make sure synthetic names of anonymous functions have correct line numbers
+
+function testMethodName(f, expected) {
+ try {
+ f();
+ fail("expected error");
+ } catch (e) {
+ var stack = e.getStackTrace();
+ if (stack[0].methodName !== expected) {
+ fail("got " + stack[0].methodName + ", expected " + expected);
+ }
+ }
+}
+
+testMethodName(function() {
+ return a.b.c;
+}, "_L45");
+
+testMethodName(function() { throw new Error() }, "_L49");
+
+var f = (function() {
+ return function() { a.b.c; };
+})();
+testMethodName(f, "_L51$_L52");
+
+testMethodName((function() {
+ return function() { return a.b.c; };
+})(), "_L56$_L57");
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025520.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025520.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025520: Array.prototype.slice should only copy defined elements
+ *
+ * @test
+ * @run
+ */
+
+var s = Array.prototype.slice.call({length: 6, 3: 1}, 2, 5);
+
+if (s.length != 3) {
+ fail("s.length != 3");
+}
+if (0 in s) {
+ fail("0 in s");
+}
+if (s.hasOwnProperty(0)) {
+ fail("s.hasOwnProperty(0)");
+}
+if (s[1] !== 1) {
+ fail("s[1] !== 1");
+}
+if (2 in s) {
+ fail("2 in s");
+}
+if (s.hasOwnProperty(2)) {
+ fail("s.hasOwnProperty(2)");
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8025589.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025589.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025589: Array.prototype.shift should only copy defined elements in generic mode
+ *
+ * @test
+ * @run
+ */
+
+var s = {length: 4, 2: 1};
+Array.prototype.shift.call(s);
+
+if (s.length != 3) {
+ fail("s.length != 3");
+}
+if (0 in s) {
+ fail("0 in s");
+}
+if (s.hasOwnProperty(0)) {
+ fail("s.hasOwnProperty(0)");
+}
+if (s[1] !== 1) {
+ fail("s[1] !== 1");
+}
+if (2 in s) {
+ fail("2 in s");
+}
+if (s.hasOwnProperty(2)) {
+ fail("s.hasOwnProperty(2)");
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8026033.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026033.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8026033: Switch should load expression even when there are no cases in it
+ *
+ * @test
+ * @run
+ */
+
+try {
+ (function() { switch(x) {} })();
+ fail("Should have thrown ReferenceError");
+} catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ fail("ReferenceError expected, got " + e);
+ }
+ print(e);
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8026033.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026033.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,1 @@
+ReferenceError: "x" is not defined
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8026042.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026042.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8026042: FoldConstants need to guard against ArrayLiteralNode
+ *
+ * @test
+ * @run
+ */
+
+try {
+ if ([a]) {
+ print("fail");
+ }
+} catch (e) {
+ print(e);
+}
+
+try {
+ [a] ? print(1) : print(2);
+} catch (e) {
+ print(e);
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8026042.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026042.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,2 @@
+ReferenceError: "a" is not defined
+ReferenceError: "a" is not defined
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/basic/JDK-8026048.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026048.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8026048: Function constructor should convert arguments to String before performing any syntax checks
+ *
+ * @test
+ * @run
+ */
+
+try {
+ Function("-", {toString:function(){throw "err"}})
+} catch (e) {
+ if (e !== "err") {
+ fail("err xpected, got " + e);
+ }
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/error/JDK-8026039.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8026039.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8026039: future strict names are allowed as function name and argument name of a strict function
+ *
+ * @test/compile-error
+ */
+
+function public() {"use strict"}
+
+function f(public) {"use strict"}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/error/JDK-8026039.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8026039.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,9 @@
+test/script/error/JDK-8026039.js:30:9 "public" cannot be used as function name in strict mode
+function public() {"use strict"}
+ ^
+test/script/error/JDK-8026039.js:32:11 Expected ident but found public
+function f(public) {"use strict"}
+ ^
+test/script/error/JDK-8026039.js:33:0 Expected } but found eof
+
+^
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/sandbox/arrayclass.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/sandbox/arrayclass.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * Try to access array class of a sensitive class like Unsafe.
+ *
+ * @test
+ * @security
+ * @run
+ */
+
+try {
+ var unsafeArr = Java.type("[Lsun.misc.Unsafe;");
+ fail("No Exception for [Lsun.misc.Unsafe;");
+} catch (e) {
+ print(e);
+}
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/sandbox/arrayclass.js.EXPECTED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/sandbox/arrayclass.js.EXPECTED Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,1 @@
+java.lang.ClassNotFoundException: [Lsun.misc.Unsafe;
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/script/trusted/JDK-8025629.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8025629.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/**
+ * JDK-8025629: load function should support a way to load scripts from classpath
+ *
+ * @test
+ * @run
+ */
+
+load("classpath:jdk/nashorn/internal/runtime/resources/load_test.js")
+
+Assert.assertEquals(loadedFunc("hello"), "HELLO");
diff -r b9a0f6c693f3 -r 2b9685a87b37 nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js Tue Oct 08 15:00:12 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, 2013, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+function loadedFunc(arg) {
+ return arg.toUpperCase();
+}