Tue, 03 Jun 2014 08:36:38 -0700
Merge
.hgtags | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Thu May 29 13:47:20 2014 -0700 1.2 +++ b/.hgtags Tue Jun 03 08:36:38 2014 -0700 1.3 @@ -284,4 +284,6 @@ 1.4 c720454d2435be052fd941a789ece9468d1e8f74 jdk8u20-b12 1.5 2ca464cf3093444f73e27ace78993629d2f15cb9 jdk8u20-b13 1.6 2f6add5fefb37cfeeb9a7745e7144f0b6d96bbea jdk8u20-b14 1.7 +bb2d116675479fb2c9deaeeab6d4c41d41060693 jdk8u20-b15 1.8 +c89a4945404ce80e26cb94c90fc13adad6b114bf jdk8u20-b16 1.9 7001e9f95b443a75e432205a29974c05b88e0fdc jdk8u25-b00
2.1 --- a/make/build.xml Thu May 29 13:47:20 2014 -0700 2.2 +++ b/make/build.xml Tue Jun 03 08:36:38 2014 -0700 2.3 @@ -348,6 +348,10 @@ 2.4 <include name="**/framework/*Test.class"/> 2.5 </fileset> 2.6 2.7 + <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}"> 2.8 + <include name="**/framework/ScriptTest.class"/> 2.9 + </fileset> 2.10 + 2.11 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 2.12 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 2.13 <jvmarg line="${ext.class.path}"/> 2.14 @@ -361,6 +365,21 @@ 2.15 <pathelement path="${run.test.classpath}"/> 2.16 </classpath> 2.17 </testng> 2.18 + <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes" 2.19 + verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 2.20 + <jvmarg line="${ext.class.path}"/> 2.21 + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 2.22 + <propertyset> 2.23 + <propertyref prefix="nashorn."/> 2.24 + </propertyset> 2.25 + <propertyset> 2.26 + <propertyref prefix="test-sys-prop-no-security."/> 2.27 + <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/> 2.28 + </propertyset> 2.29 + <classpath> 2.30 + <pathelement path="${run.test.classpath}"/> 2.31 + </classpath> 2.32 + </testng> 2.33 </target> 2.34 2.35 <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
3.1 --- a/make/project.properties Thu May 29 13:47:20 2014 -0700 3.2 +++ b/make/project.properties Tue Jun 03 08:36:38 2014 -0700 3.3 @@ -59,6 +59,7 @@ 3.4 3.5 # test results directory 3.6 build.test.results.dir=${build.dir}/test/reports 3.7 +build.nosecurity.test.results.dir=${build.dir}/test/nosecurity/reports 3.8 3.9 # This directory is removed when the project is cleaned: 3.10 dist.dir=dist 3.11 @@ -110,6 +111,7 @@ 3.12 3.13 # test scripts to run 3.14 test.dir=test 3.15 +test.nosecurity.dir=test/script/nosecurity 3.16 test.script.dir=test/script 3.17 test.basic.dir=test/script/basic 3.18 test.maptests.dir=test/script/maptests 3.19 @@ -127,8 +129,12 @@ 3.20 test-sys-prop.es5conform.testcases.dir=${test.external.dir}/ES5Conform/TestCases 3.21 test-sys-prop.test.basic.dir=${test.basic.dir} 3.22 3.23 +test-sys-prop-no-security.test.dir=${test.dir} 3.24 +test-sys-prop-no-security.test.js.roots=${test.nosecurity.dir} 3.25 + 3.26 # framework root for our script tests 3.27 test-sys-prop.test.js.framework=${test.script.dir}/assert.js 3.28 +test-sys-prop-no-security.test.js.framework=${test.script.dir}/assert.js 3.29 3.30 # Control the verbosity of ParserTest 3.31 test-sys-prop.parsertest.verbose=false
4.1 --- a/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java Thu May 29 13:47:20 2014 -0700 4.2 +++ b/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java Tue Jun 03 08:36:38 2014 -0700 4.3 @@ -61,9 +61,17 @@ 4.4 private static final DynamicLinker dynamicLinker; 4.5 static { 4.6 final DynamicLinkerFactory factory = new DynamicLinkerFactory(); 4.7 - factory.setPrioritizedLinkers(new NashornLinker(), new NashornPrimitiveLinker(), new NashornStaticClassLinker(), 4.8 - new BoundDynamicMethodLinker(), new JavaSuperAdapterLinker(), new JSObjectLinker(), new ReflectionCheckLinker()); 4.9 - factory.setFallbackLinkers(new NashornBeansLinker(), new NashornBottomLinker()); 4.10 + final NashornBeansLinker nashornBeansLinker = new NashornBeansLinker(); 4.11 + final JSObjectLinker jsObjectLinker = new JSObjectLinker(nashornBeansLinker); 4.12 + factory.setPrioritizedLinkers( 4.13 + new NashornLinker(), 4.14 + new NashornPrimitiveLinker(), 4.15 + new NashornStaticClassLinker(), 4.16 + new BoundDynamicMethodLinker(), 4.17 + new JavaSuperAdapterLinker(), 4.18 + jsObjectLinker, 4.19 + new ReflectionCheckLinker()); 4.20 + factory.setFallbackLinkers(nashornBeansLinker, new NashornBottomLinker()); 4.21 factory.setSyncOnRelink(true); 4.22 final int relinkThreshold = Options.getIntProperty("nashorn.unstable.relink.threshold", -1); 4.23 if (relinkThreshold > -1) {
5.1 --- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Thu May 29 13:47:20 2014 -0700 5.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Tue Jun 03 08:36:38 2014 -0700 5.3 @@ -30,6 +30,7 @@ 5.4 import java.lang.invoke.MethodType; 5.5 import java.util.HashMap; 5.6 import java.util.Map; 5.7 +import javax.script.Bindings; 5.8 import jdk.internal.dynalink.CallSiteDescriptor; 5.9 import jdk.internal.dynalink.linker.GuardedInvocation; 5.10 import jdk.internal.dynalink.linker.GuardedTypeConversion; 5.11 @@ -48,14 +49,23 @@ 5.12 * as ScriptObjects from other Nashorn contexts. 5.13 */ 5.14 final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory { 5.15 + private final NashornBeansLinker nashornBeansLinker; 5.16 + 5.17 + JSObjectLinker(final NashornBeansLinker nashornBeansLinker) { 5.18 + this.nashornBeansLinker = nashornBeansLinker; 5.19 + } 5.20 + 5.21 @Override 5.22 public boolean canLinkType(final Class<?> type) { 5.23 return canLinkTypeStatic(type); 5.24 } 5.25 5.26 static boolean canLinkTypeStatic(final Class<?> type) { 5.27 - // can link JSObject 5.28 - return JSObject.class.isAssignableFrom(type); 5.29 + // can link JSObject also handles Map, Bindings to make 5.30 + // sure those are not JSObjects. 5.31 + return Map.class.isAssignableFrom(type) || 5.32 + Bindings.class.isAssignableFrom(type) || 5.33 + JSObject.class.isAssignableFrom(type); 5.34 } 5.35 5.36 @Override 5.37 @@ -72,6 +82,11 @@ 5.38 final GuardedInvocation inv; 5.39 if (self instanceof JSObject) { 5.40 inv = lookup(desc); 5.41 + } else if (self instanceof Map || self instanceof Bindings) { 5.42 + // guard to make sure the Map or Bindings does not turn into JSObject later! 5.43 + final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); 5.44 + inv = new GuardedInvocation(beanInv.getInvocation(), 5.45 + NashornGuards.combineGuards(beanInv.getGuard(), NashornGuards.getNotJSObjectGuard())); 5.46 } else { 5.47 throw new AssertionError(); // Should never reach here. 5.48 }
6.1 --- a/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java Thu May 29 13:47:20 2014 -0700 6.2 +++ b/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java Tue Jun 03 08:36:38 2014 -0700 6.3 @@ -31,6 +31,7 @@ 6.4 import java.lang.invoke.MethodHandles; 6.5 import java.lang.ref.WeakReference; 6.6 import jdk.internal.dynalink.CallSiteDescriptor; 6.7 +import jdk.nashorn.api.scripting.JSObject; 6.8 import jdk.nashorn.internal.codegen.ObjectClassGenerator; 6.9 import jdk.nashorn.internal.objects.Global; 6.10 import jdk.nashorn.internal.runtime.Property; 6.11 @@ -43,6 +44,7 @@ 6.12 */ 6.13 public final class NashornGuards { 6.14 private static final MethodHandle IS_SCRIPTOBJECT = findOwnMH("isScriptObject", boolean.class, Object.class); 6.15 + private static final MethodHandle IS_NOT_JSOBJECT = findOwnMH("isNotJSObject", boolean.class, Object.class); 6.16 private static final MethodHandle IS_SCRIPTFUNCTION = findOwnMH("isScriptFunction", boolean.class, Object.class); 6.17 private static final MethodHandle IS_MAP = findOwnMH("isMap", boolean.class, Object.class, PropertyMap.class); 6.18 private static final MethodHandle SAME_OBJECT = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class); 6.19 @@ -61,6 +63,14 @@ 6.20 } 6.21 6.22 /** 6.23 + * Get the guard that checks if an item is not a {@code JSObject} 6.24 + * @return method handle for guard 6.25 + */ 6.26 + public static MethodHandle getNotJSObjectGuard() { 6.27 + return IS_NOT_JSOBJECT; 6.28 + } 6.29 + 6.30 + /** 6.31 * Get the guard that checks if an item is a {@code ScriptFunction} 6.32 * @return method handle for guard 6.33 */ 6.34 @@ -157,6 +167,11 @@ 6.35 } 6.36 6.37 @SuppressWarnings("unused") 6.38 + private static boolean isNotJSObject(final Object self) { 6.39 + return !(self instanceof JSObject); 6.40 + } 6.41 + 6.42 + @SuppressWarnings("unused") 6.43 private static boolean isScriptFunction(final Object self) { 6.44 return self instanceof ScriptFunction; 6.45 }
7.1 --- a/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java Thu May 29 13:47:20 2014 -0700 7.2 +++ b/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java Tue Jun 03 08:36:38 2014 -0700 7.3 @@ -25,6 +25,7 @@ 7.4 7.5 package jdk.nashorn.internal.runtime.linker; 7.6 7.7 +import java.lang.reflect.Modifier; 7.8 import jdk.internal.dynalink.CallSiteDescriptor; 7.9 import jdk.internal.dynalink.beans.BeansLinker; 7.10 import jdk.internal.dynalink.beans.StaticClass; 7.11 @@ -65,10 +66,15 @@ 7.12 return null; 7.13 } 7.14 final Class<?> receiverClass = ((StaticClass) self).getRepresentedClass(); 7.15 + 7.16 Bootstrap.checkReflectionAccess(receiverClass, true); 7.17 final CallSiteDescriptor desc = request.getCallSiteDescriptor(); 7.18 // We intercept "new" on StaticClass instances to provide additional capabilities 7.19 if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) { 7.20 + if (! Modifier.isPublic(receiverClass.getModifiers())) { 7.21 + throw ECMAErrors.typeError("new.on.nonpublic.javatype", receiverClass.getName()); 7.22 + } 7.23 + 7.24 // make sure new is on accessible Class 7.25 Context.checkPackageAccess(receiverClass); 7.26
8.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Thu May 29 13:47:20 2014 -0700 8.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java Tue Jun 03 08:36:38 2014 -0700 8.3 @@ -771,7 +771,7 @@ 8.4 8.5 while (value < end) { 8.6 int ovalue = value; 8.7 - buf = Character.toLowerCase(chars[value++]); 8.8 + buf = EncodingHelper.toLowerCase(chars[value++]); 8.9 8.10 if (chars[ovalue] != buf) { 8.11 8.12 @@ -779,7 +779,7 @@ 8.13 System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p); 8.14 value = ovalue; 8.15 while (value < end) { 8.16 - buf = Character.toLowerCase(chars[value++]); 8.17 + buf = EncodingHelper.toLowerCase(chars[value++]); 8.18 if (sp >= sbuf.length) { 8.19 char[]tmp = new char[sbuf.length << 1]; 8.20 System.arraycopy(sbuf, 0, tmp, 0, sbuf.length);
9.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Thu May 29 13:47:20 2014 -0700 9.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java Tue Jun 03 08:36:38 2014 -0700 9.3 @@ -20,70 +20,42 @@ 9.4 package jdk.nashorn.internal.runtime.regexp.joni; 9.5 9.6 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode; 9.7 -import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode; 9.8 -import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; 9.9 9.10 final class ApplyCaseFold { 9.11 9.12 // i_apply_case_fold 9.13 - public void apply(int from, int[]to, int length, Object o) { 9.14 + public void apply(int from, int to, Object o) { 9.15 ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o; 9.16 9.17 ScanEnvironment env = arg.env; 9.18 CClassNode cc = arg.cc; 9.19 BitSet bs = cc.bs; 9.20 9.21 - if (length == 1) { 9.22 - boolean inCC = cc.isCodeInCC(from); 9.23 + boolean inCC = cc.isCodeInCC(from); 9.24 9.25 - if (Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS) { 9.26 - if ((inCC && !cc.isNot()) || (!inCC && cc.isNot())) { 9.27 - if (to[0] >= BitSet.SINGLE_BYTE_SIZE) { 9.28 - cc.addCodeRange(env, to[0], to[0]); 9.29 + if (Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS) { 9.30 + if ((inCC && !cc.isNot()) || (!inCC && cc.isNot())) { 9.31 + if (to >= BitSet.SINGLE_BYTE_SIZE) { 9.32 + cc.addCodeRange(env, to, to); 9.33 + } else { 9.34 + /* /(?i:[^A-C])/.match("a") ==> fail. */ 9.35 + bs.set(to); 9.36 + } 9.37 + } 9.38 + } else { 9.39 + if (inCC) { 9.40 + if (to >= BitSet.SINGLE_BYTE_SIZE) { 9.41 + if (cc.isNot()) cc.clearNotFlag(); 9.42 + cc.addCodeRange(env, to, to); 9.43 + } else { 9.44 + if (cc.isNot()) { 9.45 + bs.clear(to); 9.46 } else { 9.47 - /* /(?i:[^A-C])/.match("a") ==> fail. */ 9.48 - bs.set(to[0]); 9.49 + bs.set(to); 9.50 } 9.51 } 9.52 - } else { 9.53 - if (inCC) { 9.54 - if (to[0] >= BitSet.SINGLE_BYTE_SIZE) { 9.55 - if (cc.isNot()) cc.clearNotFlag(); 9.56 - cc.addCodeRange(env, to[0], to[0]); 9.57 - } else { 9.58 - if (cc.isNot()) { 9.59 - bs.clear(to[0]); 9.60 - } else { 9.61 - bs.set(to[0]); 9.62 - } 9.63 - } 9.64 - } 9.65 - } // CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS 9.66 - 9.67 - } else { 9.68 - if (cc.isCodeInCC(from) && (!Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS || !cc.isNot())) { 9.69 - StringNode node = null; 9.70 - for (int i=0; i<length; i++) { 9.71 - if (i == 0) { 9.72 - node = new StringNode(); 9.73 - /* char-class expanded multi-char only 9.74 - compare with string folded at match time. */ 9.75 - node.setAmbig(); 9.76 - } 9.77 - node.catCode(to[i]); 9.78 - } 9.79 - 9.80 - ConsAltNode alt = ConsAltNode.newAltNode(node, null); 9.81 - 9.82 - if (arg.tail == null) { 9.83 - arg.altRoot = alt; 9.84 - } else { 9.85 - arg.tail.setCdr(alt); 9.86 - } 9.87 - arg.tail = alt; 9.88 } 9.89 - 9.90 - } 9.91 + } // CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS 9.92 9.93 } 9.94
10.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Thu May 29 13:47:20 2014 -0700 10.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Tue Jun 03 08:36:38 2014 -0700 10.3 @@ -58,8 +58,8 @@ 10.4 int end1 = s1 + mbLen; 10.5 10.6 while (s1 < end1) { 10.7 - char c1 = Character.toLowerCase(chars[s1++]); 10.8 - char c2 = Character.toLowerCase(chars[s2++]); 10.9 + char c1 = EncodingHelper.toLowerCase(chars[s1++]); 10.10 + char c2 = EncodingHelper.toLowerCase(chars[s2++]); 10.11 10.12 if (c1 != c2) { 10.13 return false; 10.14 @@ -367,7 +367,7 @@ 10.15 } 10.16 10.17 private void opExact1IC() { 10.18 - if (s >= range || code[ip] != Character.toLowerCase(chars[s++])) {opFail(); return;} 10.19 + if (s >= range || code[ip] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 10.20 ip++; 10.21 sprev = sbegin; // break; 10.22 } 10.23 @@ -380,10 +380,10 @@ 10.24 char[] bs = regex.templates[code[ip++]]; 10.25 int ps = code[ip++]; 10.26 10.27 - while (tlen-- > 0) if (bs[ps++] != Character.toLowerCase(chars[s++])) {opFail(); return;} 10.28 + while (tlen-- > 0) if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 10.29 } else { 10.30 10.31 - while (tlen-- > 0) if (code[ip++] != Character.toLowerCase(chars[s++])) {opFail(); return;} 10.32 + while (tlen-- > 0) if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;} 10.33 } 10.34 sprev = s - 1; 10.35 }
11.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java Thu May 29 13:47:20 2014 -0700 11.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java Tue Jun 03 08:36:38 2014 -0700 11.3 @@ -93,41 +93,78 @@ 11.4 return s; 11.5 } 11.6 11.7 - public static int mbcToCode(byte[] bytes, int p, int end) { 11.8 - int code = 0; 11.9 - for (int i = p; i < end; i++) { 11.10 - code = (code << 8) | (bytes[i] & 0xff); 11.11 - } 11.12 - return code; 11.13 - } 11.14 - 11.15 public static int mbcodeStartPosition() { 11.16 return 0x80; 11.17 } 11.18 11.19 public static char[] caseFoldCodesByString(int flag, char c) { 11.20 - if (Character.isUpperCase(c)) { 11.21 - return new char[] {Character.toLowerCase(c)}; 11.22 - } else if (Character.isLowerCase(c)) { 11.23 - return new char[] {Character.toUpperCase(c)}; 11.24 - } else { 11.25 - return EMPTYCHARS; 11.26 + char[] codes = EMPTYCHARS; 11.27 + final char upper = toUpperCase(c); 11.28 + 11.29 + if (upper != toLowerCase(upper)) { 11.30 + int count = 0; 11.31 + char ch = 0; 11.32 + 11.33 + do { 11.34 + final char u = toUpperCase(ch); 11.35 + if (u == upper && ch != c) { 11.36 + // Almost all characters will return array of length 1, very few 2 or 3, so growing by one is fine. 11.37 + codes = count == 0 ? new char[1] : Arrays.copyOf(codes, count + 1); 11.38 + codes[count++] = ch; 11.39 + } 11.40 + } while (ch++ < 0xffff); 11.41 + } 11.42 + return codes; 11.43 + } 11.44 + 11.45 + public static void applyAllCaseFold(int flag, ApplyCaseFold fun, Object arg) { 11.46 + for (int c = 0; c < 0xffff; c++) { 11.47 + if (Character.isLowerCase(c)) { 11.48 + final int upper = toUpperCase(c); 11.49 + 11.50 + if (upper != c) { 11.51 + fun.apply(c, upper, arg); 11.52 + } 11.53 + } 11.54 + } 11.55 + 11.56 + // Some characters have multiple lower case variants, hence we need to do a second run 11.57 + for (int c = 0; c < 0xffff; c++) { 11.58 + if (Character.isLowerCase(c)) { 11.59 + final int upper = toUpperCase(c); 11.60 + 11.61 + if (upper != c) { 11.62 + fun.apply(upper, c, arg); 11.63 + } 11.64 + } 11.65 } 11.66 } 11.67 11.68 - public static void applyAllCaseFold(int flag, ApplyCaseFold fun, Object arg) { 11.69 - int[] code = new int[1]; 11.70 + public static char toLowerCase(char c) { 11.71 + return (char)toLowerCase((int)c); 11.72 + } 11.73 11.74 - for (int c = 0; c < 0xffff; c++) { 11.75 - if (Character.getType(c) == Character.LOWERCASE_LETTER) { 11.76 + public static int toLowerCase(int c) { 11.77 + if (c < 128) { 11.78 + return ('A' <= c && c <= 'Z') ? (c + ('a' - 'A')) : c; 11.79 + } 11.80 + // Do not convert non-ASCII upper case character to ASCII lower case. 11.81 + int lower = Character.toLowerCase(c); 11.82 + return (lower < 128) ? c : lower; 11.83 11.84 - int upper = code[0] = Character.toUpperCase(c); 11.85 - fun.apply(c, code, 1, arg); 11.86 + } 11.87 11.88 - code[0] = c; 11.89 - fun.apply(upper, code, 1, arg); 11.90 - } 11.91 + public static char toUpperCase(char c) { 11.92 + return (char)toUpperCase((int)c); 11.93 + } 11.94 + 11.95 + public static int toUpperCase(int c) { 11.96 + if (c < 128) { 11.97 + return ('a' <= c && c <= 'z') ? c + ('A' - 'a') : c; 11.98 } 11.99 + // Do not convert non-ASCII lower case character to ASCII upper case. 11.100 + int upper = Character.toUpperCase(c); 11.101 + return (upper < 128) ? c : upper; 11.102 } 11.103 11.104 public static int[] ctypeCodeRange(int ctype, IntHolder sbOut) {
12.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java Thu May 29 13:47:20 2014 -0700 12.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java Tue Jun 03 08:36:38 2014 -0700 12.3 @@ -168,7 +168,7 @@ 12.4 char[] chars, int p, int end) { 12.5 12.6 while (tP < tEnd) { 12.7 - if (t[tP++] != Character.toLowerCase(chars[p++])) return false; 12.8 + if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) return false; 12.9 } 12.10 return true; 12.11 }
13.1 --- a/src/jdk/nashorn/internal/runtime/resources/Messages.properties Thu May 29 13:47:20 2014 -0700 13.2 +++ b/src/jdk/nashorn/internal/runtime/resources/Messages.properties Tue Jun 03 08:36:38 2014 -0700 13.3 @@ -138,6 +138,7 @@ 13.4 type.error.method.not.constructor=Java method {0} can't be used as a constructor. 13.5 type.error.env.not.object=$ENV must be an Object. 13.6 type.error.unsupported.java.to.type=Unsupported Java.to target type {0}. 13.7 +type.error.new.on.nonpublic.javatype=new cannot be used with non-public java type {0}. 13.8 13.9 range.error.dataview.constructor.offset=Wrong offset or length in DataView constructor 13.10 range.error.dataview.offset=Offset is outside the bounds of the DataView
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/script/basic/JDK-8030202.js Tue Jun 03 08:36:38 2014 -0700 14.3 @@ -0,0 +1,57 @@ 14.4 +/* 14.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +/** 14.28 + * JDK-8030202: Nashorn: Multiple RegExp#ignoreCase issues 14.29 + * 14.30 + * @test 14.31 + * @run 14.32 + */ 14.33 + 14.34 +print(/\u2160/i.test("\u2170")); 14.35 +print(/[\u2160]/i.test("\u2170")); 14.36 +print(/\u2170/i.test("\u2160")); 14.37 +print(/[\u2170]/i.test("\u2160")); 14.38 + 14.39 +print(/\u0130/i.test("\u0069")); 14.40 +print(/[\u0130]/i.test("\u0069")); 14.41 +print(/\u0069/i.test("\u0130")); 14.42 +print(/[\u0069]/i.test("\u0130")); 14.43 + 14.44 +print(/\u1e9e/i.test("\u00df")); 14.45 +print(/[\u1e9e]/i.test("\u00df")); 14.46 +print(/\u00df/i.test("\u1e9e")); 14.47 +print(/[\u00df]/i.test("\u1e9e")); 14.48 + 14.49 +print(/[^\u1e9e]/i.test("\u00df")); 14.50 +print(/[^\u00df]/i.test("\u1e9e")); 14.51 + 14.52 +print(/\u0345{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.53 +print(/\u0399{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.54 +print(/\u03b9{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.55 +print(/\u1fbe{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.56 + 14.57 +print(/[\u0345]{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.58 +print(/[\u0399]{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.59 +print(/[\u03b9]{4}/i.test("\u0345\u0399\u03b9\u1fbe")); 14.60 +print(/[\u1fbe]{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/script/basic/JDK-8030202.js.EXPECTED Tue Jun 03 08:36:38 2014 -0700 15.3 @@ -0,0 +1,22 @@ 15.4 +true 15.5 +true 15.6 +true 15.7 +true 15.8 +false 15.9 +false 15.10 +false 15.11 +false 15.12 +false 15.13 +false 15.14 +false 15.15 +false 15.16 +true 15.17 +true 15.18 +true 15.19 +true 15.20 +true 15.21 +true 15.22 +true 15.23 +true 15.24 +true 15.25 +true
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/script/basic/JDK-8043930.js Tue Jun 03 08:36:38 2014 -0700 16.3 @@ -0,0 +1,37 @@ 16.4 +/* 16.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.23 + * or visit www.oracle.com if you need additional information or have any 16.24 + * questions. 16.25 + */ 16.26 + 16.27 +/** 16.28 + * JDK-8043930: TypeError when attemping to create an instance of non-public class could be better 16.29 + * 16.30 + * @test 16.31 + * @run 16.32 + */ 16.33 + 16.34 +var NonPublicClass = Java.type("jdk.nashorn.test.models.NonPublicClass"); 16.35 +try { 16.36 + var obj = new NonPublicClass(); 16.37 + fail("Expected TypeError to be thrown!"); 16.38 +} catch (e) { 16.39 + print(e); 16.40 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/script/basic/JDK-8043930.js.EXPECTED Tue Jun 03 08:36:38 2014 -0700 17.3 @@ -0,0 +1,1 @@ 17.4 +TypeError: new cannot be used with non-public java type jdk.nashorn.test.models.NonPublicClass.
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/script/nosecurity/nosecurity.js Tue Jun 03 08:36:38 2014 -0700 18.3 @@ -0,0 +1,34 @@ 18.4 +/* 18.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.23 + * or visit www.oracle.com if you need additional information or have any 18.24 + * questions. 18.25 + */ 18.26 + 18.27 +/** 18.28 + * 8043443: Test framework changes to run script tests without security manager 18.29 + * @test 18.30 + * @run 18.31 + */ 18.32 + 18.33 +var System = Java.type("java.lang.System"); 18.34 + 18.35 +if (System.securityManager != null) { 18.36 + fail("SecurityManager is set!"); 18.37 +}
19.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Thu May 29 13:47:20 2014 -0700 19.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java Tue Jun 03 08:36:38 2014 -0700 19.3 @@ -29,6 +29,8 @@ 19.4 import java.util.HashMap; 19.5 import java.util.List; 19.6 import java.util.Map; 19.7 +import javax.script.Bindings; 19.8 +import javax.script.ScriptContext; 19.9 import javax.script.ScriptEngine; 19.10 import javax.script.ScriptEngineManager; 19.11 import javax.script.ScriptException; 19.12 @@ -276,4 +278,31 @@ 19.13 "({ toString: function() { return 'foo' } })"); 19.14 assertEquals("foo", obj.to(String.class)); 19.15 } 19.16 + 19.17 + // @bug 8044000: Access to undefined property yields "null" instead of "undefined" 19.18 + @Test 19.19 + public void mapScriptObjectMirrorCallsiteTest() throws ScriptException { 19.20 + final ScriptEngineManager m = new ScriptEngineManager(); 19.21 + final ScriptEngine engine = m.getEngineByName("nashorn"); 19.22 + final String TEST_SCRIPT = "typeof obj.foo"; 19.23 + 19.24 + final Bindings global = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE); 19.25 + engine.eval("var obj = java.util.Collections.emptyMap()"); 19.26 + // this will drive callsite "obj.foo" of TEST_SCRIPT 19.27 + // to use "obj instanceof Map" as it's guard 19.28 + engine.eval(TEST_SCRIPT, global); 19.29 + // redefine 'obj' to be a script object 19.30 + engine.eval("obj = {}"); 19.31 + 19.32 + final Bindings newGlobal = engine.createBindings(); 19.33 + // transfer 'obj' from default global to new global 19.34 + // new global will get a ScriptObjectMirror wrapping 'obj' 19.35 + newGlobal.put("obj", global.get("obj")); 19.36 + 19.37 + // Every ScriptObjectMirror is a Map! If callsite "obj.foo" 19.38 + // does not see the new 'obj' is a ScriptObjectMirror, it'll 19.39 + // continue to use Map's get("obj.foo") instead of ScriptObjectMirror's 19.40 + // getMember("obj.foo") - thereby getting null instead of undefined 19.41 + assertEquals("undefined", engine.eval(TEST_SCRIPT, newGlobal)); 19.42 + } 19.43 }