# HG changeset patch # User sundar # Date 1389670434 -19800 # Node ID 2b9e9a95f35314d7a8f0362c4f291dd8dc2eb9d7 # Parent f130ca87de6637acae7d99fcd7a8573eea1cbaed# Parent 8ba194954c04ef732575f243a10b1ad99156e7d3 Merge diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/jjs --- a/nashorn/bin/jjs Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/java -server -XX:+TieredCompilation -Xms2G -Xmx2G -esa -ea -Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -XX:+HeapDumpOnOutOfMemoryError -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.debug=true jdk.nashorn.tools.Shell $* diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/jjs.bat --- a/nashorn/bin/jjs.bat Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false jdk.nashorn.tools.Shell diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/jjssecure --- a/nashorn/bin/jjssecure Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=`dirname $0`/../make/java.security.override -Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=true -Dnashorn.home=`dirname $0`/.. -Djava.security.manager jdk.nashorn.tools.Shell $* diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/jjssecure.bat --- a/nashorn/bin/jjssecure.bat Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=%~dp0\..\make\java.security.override -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.home=%~dp0\.. -Djava.security.manager jdk.nashorn.tools.Shell diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/nashorn --- a/nashorn/bin/nashorn Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $* diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/nashorn.bat --- a/nashorn/bin/nashorn.bat Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/nashornsecure --- a/nashorn/bin/nashornsecure Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/jrunscript -J-Djava.security.properties=`dirname $0`/../make/java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $* diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/bin/nashornsecure.bat --- a/nashorn/bin/nashornsecure.bat Wed Jul 05 19:26:54 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -jrunscript -J-Djava.security.properties=%~dp0\..\make\java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java Tue Jan 14 09:03:54 2014 +0530 @@ -279,10 +279,6 @@ } } } else if (kind == Kind.FUNCTION) { - final Type returnType = Type.getReturnType(javaDesc); - if (! returnType.toString().equals(OBJECT_DESC)) { - error("return value should be of Object type, found" + returnType); - } final Type[] argTypes = Type.getArgumentTypes(javaDesc); if (argTypes.length < 1) { error("function methods should have at least 1 arg"); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java Tue Jan 14 09:03:54 2014 +0530 @@ -349,19 +349,19 @@ // invokes, field get/sets void invokeInterface(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc); + super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc, true); } void invokeVirtual(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc); + super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc, false); } void invokeSpecial(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKESPECIAL, owner, method, desc); + super.visitMethodInsn(INVOKESPECIAL, owner, method, desc, false); } void invokeStatic(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKESTATIC, owner, method, desc); + super.visitMethodInsn(INVOKESTATIC, owner, method, desc, false); } void putStatic(final String owner, final String field, final String desc) { @@ -413,7 +413,7 @@ super.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", - "(Ljava/lang/String;)V"); + "(Ljava/lang/String;)V", false); } // print the object on the top of the stack @@ -426,6 +426,6 @@ super.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", - "(Ljava/lang/Object;)V"); + "(Ljava/lang/Object;)V", false); } } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java Tue Jan 14 09:03:54 2014 +0530 @@ -146,16 +146,16 @@ // call $clinit$ just before return from if (isStaticInit && opcode == RETURN) { super.visitMethodInsn(INVOKESTATIC, scriptClassInfo.getJavaName(), - $CLINIT$, DEFAULT_INIT_DESC); + $CLINIT$, DEFAULT_INIT_DESC, false); } super.visitInsn(opcode); } @Override - public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { + public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { if (isConstructor && opcode == INVOKESPECIAL && INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) { - super.visitMethodInsn(opcode, owner, name, desc); + super.visitMethodInsn(opcode, owner, name, desc, false); if (memberCount > 0) { // initialize @Property fields if needed @@ -166,7 +166,7 @@ super.visitTypeInsn(NEW, clazz); super.visitInsn(DUP); super.visitMethodInsn(INVOKESPECIAL, clazz, - INIT, DEFAULT_INIT_DESC); + INIT, DEFAULT_INIT_DESC, false); super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(), memInfo.getJavaName(), memInfo.getJavaDesc()); } @@ -180,7 +180,7 @@ } } } else { - super.visitMethodInsn(opcode, owner, name, desc); + super.visitMethodInsn(opcode, owner, name, desc, itf); } } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/make/build-benchmark.xml --- a/nashorn/make/build-benchmark.xml Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/make/build-benchmark.xml Tue Jan 14 09:03:54 2014 +0530 @@ -330,6 +330,9 @@ dir="."> + + + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/make/build.xml --- a/nashorn/make/build.xml Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/make/build.xml Tue Jan 14 09:03:54 2014 +0530 @@ -66,13 +66,16 @@ + + + + - - - + + @@ -301,6 +304,10 @@ permission java.lang.RuntimePermission "nashorn.JavaReflection"; }; +grant codeBase "file:/${basedir}/test/script/markdown.js" { + permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read"; +}; + \/ @@ -316,6 +323,7 @@ + @@ -339,6 +347,9 @@ + + + @@ -393,6 +404,25 @@ + + + + + + + + + + + + + + + + + + @@ -403,6 +433,9 @@ + + + @@ -537,6 +570,11 @@ + + + + + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/make/project.properties --- a/nashorn/make/project.properties Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/make/project.properties Tue Jan 14 09:03:54 2014 +0530 @@ -71,6 +71,9 @@ fxshell.dir = tools/fxshell fxshell.jar = ${dist.dir}/nashornfx.jar +# configuration for java flight recorder +run.test.jvmargs.jfr=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128 + # jars refererred file.reference.testng.jar=test/lib/testng.jar @@ -119,6 +122,7 @@ test262.dir=${test.external.dir}/test262 test262.suite.dir=${test262.dir}/test/suite testjfx.dir=${test.script.dir}/jfx +testmarkdown.dir=${test.script.dir}/markdown test-sys-prop.test.dir=${test.dir} test-sys-prop.test.js.roots=${test.basic.dir} ${test.error.dir} ${test.sandbox.dir} ${test.trusted.dir} @@ -209,6 +213,16 @@ ${test262.dir}/test/harness/framework.js \ ${test262.dir}/test/harness/sta.js +# testmarkdown test root +testmarkdown-test-sys-prop.test.js.roots=${testmarkdown.dir} + +# execute testmarkdown tests in shared nashorn context or not? +testmarkdown-test-sys-prop.test.js.shared.context=false + +# framework root for markdown script tests +testmarkdown-test-sys-prop.test.js.framework=\ + ${test.script.dir}${file.separator}markdown.js + # testjfx test root testjfx-test-sys-prop.test.js.roots=${testjfx.dir} diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/api/scripting/NashornException.java --- a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java Tue Jan 14 09:03:54 2014 +0530 @@ -29,6 +29,7 @@ import java.util.List; import jdk.nashorn.internal.codegen.CompilerConstants; import jdk.nashorn.internal.runtime.ECMAErrors; +import jdk.nashorn.internal.runtime.ScriptObject; /** * This is base exception for all Nashorn exceptions. These originate from @@ -49,6 +50,8 @@ private final int line; // script column number private final int column; + // underlying ECMA error object - lazily initialized + private Object ecmaError; /** script source name used for "engine.js" */ public static final String ENGINE_SCRIPT_SOURCE_NAME = "nashorn:engine/resources/engine.js"; @@ -155,6 +158,11 @@ if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) { methodName = ""; } + + if (methodName.contains(CompilerConstants.ANON_FUNCTION_PREFIX.symbolName())) { + methodName = ""; + } + filtered.add(new StackTraceElement(className, methodName, st.getFileName(), st.getLineNumber())); } @@ -188,4 +196,33 @@ } return buf.toString(); } + + protected Object getThrown() { + return null; + } + + protected NashornException initEcmaError(final ScriptObject global) { + if (ecmaError != null) { + return this; // initialized already! + } + + final Object thrown = getThrown(); + if (thrown instanceof ScriptObject) { + ecmaError = ScriptObjectMirror.wrap(thrown, global); + } else { + ecmaError = thrown; + } + + return this; + } + + /** + * Return the underlying ECMA error object, if available. + * + * @return underlying ECMA Error object's mirror or whatever was thrown + * from script such as a String, Number or a Boolean. + */ + public Object getEcmaError() { + return ecmaError; + } } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java --- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Tue Jan 14 09:03:54 2014 +0530 @@ -476,16 +476,19 @@ private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException { name.getClass(); // null check + ScriptObject invokeGlobal = null; ScriptObjectMirror selfMirror = null; if (selfObject instanceof ScriptObjectMirror) { selfMirror = (ScriptObjectMirror)selfObject; if (! isOfContext(selfMirror.getHomeGlobal(), nashornContext)) { throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); } + invokeGlobal = selfMirror.getHomeGlobal(); } else if (selfObject instanceof ScriptObject) { // invokeMethod called from script code - in which case we may get 'naked' ScriptObject // Wrap it with oldGlobal to make a ScriptObjectMirror for the same. final ScriptObject oldGlobal = Context.getGlobal(); + invokeGlobal = oldGlobal; if (oldGlobal == null) { throw new IllegalArgumentException(getMessage("no.current.nashorn.global")); } @@ -498,6 +501,7 @@ } else if (selfObject == null) { // selfObject is null => global function call final ScriptObject ctxtGlobal = getNashornGlobalFrom(context); + invokeGlobal = ctxtGlobal; selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(ctxtGlobal, ctxtGlobal); } @@ -509,7 +513,7 @@ if (cause instanceof NoSuchMethodException) { throw (NoSuchMethodException)cause; } - throwAsScriptException(e); + throwAsScriptException(e, invokeGlobal); throw new AssertionError("should not reach here"); } } @@ -543,7 +547,7 @@ } return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal)); } catch (final Exception e) { - throwAsScriptException(e); + throwAsScriptException(e, ctxtGlobal); throw new AssertionError("should not reach here"); } finally { if (globalChanged) { @@ -552,7 +556,7 @@ } } - private static void throwAsScriptException(final Exception e) throws ScriptException { + private static void throwAsScriptException(final Exception e, final ScriptObject global) throws ScriptException { if (e instanceof ScriptException) { throw (ScriptException)e; } else if (e instanceof NashornException) { @@ -560,6 +564,7 @@ final ScriptException se = new ScriptException( ne.getMessage(), ne.getFileName(), ne.getLineNumber(), ne.getColumnNumber()); + ne.initEcmaError(global); se.initCause(e); throw se; } else if (e instanceof RuntimeException) { @@ -605,7 +610,7 @@ return nashornContext.compileScript(source, newGlobal); } catch (final Exception e) { - throwAsScriptException(e); + throwAsScriptException(e, newGlobal); throw new AssertionError("should not reach here"); } finally { if (globalChanged) { @@ -621,6 +626,11 @@ continue; } + // skip check for default methods - non-abstract, interface methods + if (! Modifier.isAbstract(method.getModifiers())) { + continue; + } + Object obj = sobj.get(method.getName()); if (! (obj instanceof ScriptFunction)) { return false; diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java --- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java Tue Jan 14 09:03:54 2014 +0530 @@ -108,6 +108,8 @@ } throw new RuntimeException("not a function: " + toString()); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -135,6 +137,8 @@ } throw new RuntimeException("not a constructor: " + toString()); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -182,6 +186,8 @@ } throw new NoSuchMethodException("No such function " + functionName); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -717,6 +723,8 @@ } try { return callable.call(); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException e) { throw e; } catch (final Exception e) { diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java --- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java Tue Jan 14 09:03:54 2014 +0530 @@ -158,7 +158,7 @@ if (scopeCalls.containsKey(scopeCall)) { return scopeCalls.get(scopeCall); } - scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName("scopeCall")); + scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName(":scopeCall")); scopeCalls.put(scopeCall, scopeCall); return scopeCall; } @@ -177,7 +177,7 @@ if (scopeCalls.containsKey(scopeCall)) { return scopeCalls.get(scopeCall); } - scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName("scopeCall")); + scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName(":scopeCall")); scopeCalls.put(scopeCall, scopeCall); return scopeCall; } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java --- a/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java Tue Jan 14 09:03:54 2014 +0530 @@ -41,6 +41,7 @@ */ public enum CompilerConstants { + /** the __FILE__ variable */ __FILE__, @@ -75,7 +76,7 @@ DEFAULT_SCRIPT_NAME("Script"), /** function prefix for anonymous functions */ - FUNCTION_PREFIX("function$"), + ANON_FUNCTION_PREFIX("L:"), /** method name for Java method that is script entry point */ RUN_SCRIPT("runScript"), @@ -149,26 +150,31 @@ ALLOCATE("allocate"), /** prefix for split methods, @see Splitter */ - SPLIT_PREFIX("$split"), + SPLIT_PREFIX(":split"), /** prefix for split array method and slot */ - SPLIT_ARRAY_ARG("split_array", 3), + SPLIT_ARRAY_ARG(":split_array", 3), /** get string from constant pool */ - GET_STRING("$getString"), + GET_STRING(":getString"), /** get map */ - GET_MAP("$getMap"), + GET_MAP(":getMap"), /** get map */ - SET_MAP("$setMap"), + SET_MAP(":setMap"), /** get array prefix */ - GET_ARRAY_PREFIX("$get"), + GET_ARRAY_PREFIX(":get"), /** get array suffix */ GET_ARRAY_SUFFIX("$array"); + /** + * Prefix used for internal methods generated in script clases. + */ + public static final String INTERNAL_METHOD_PREFIX = ":"; + private final String symbolName; private final Class type; private final int slot; diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java --- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java Tue Jan 14 09:03:54 2014 +0530 @@ -1130,7 +1130,11 @@ popType(Type.OBJECT); } - method.visitMethodInsn(opcode, className, methodName, methodDescriptor); + if (opcode == INVOKEINTERFACE) { + method.visitMethodInsn(opcode, className, methodName, methodDescriptor, true); + } else { + method.visitMethodInsn(opcode, className, methodName, methodDescriptor, false); + } if (returnType != null) { pushType(returnType); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/codegen/types/Type.java --- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java Tue Jan 14 09:03:54 2014 +0530 @@ -261,7 +261,7 @@ } static void invokeStatic(final MethodVisitor method, final Call call) { - method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor()); + method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor(), false); } /** diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/objects/NativeMath.java --- a/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java Tue Jan 14 09:03:54 2014 +0530 @@ -92,7 +92,7 @@ * @return abs of value */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object abs(final Object self, final Object x) { + public static double abs(final Object self, final Object x) { return Math.abs(JSType.toNumber(x)); } @@ -144,7 +144,7 @@ * @return acos of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object acos(final Object self, final Object x) { + public static double acos(final Object self, final Object x) { return Math.acos(JSType.toNumber(x)); } @@ -170,7 +170,7 @@ * @return asin of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object asin(final Object self, final Object x) { + public static double asin(final Object self, final Object x) { return Math.asin(JSType.toNumber(x)); } @@ -196,7 +196,7 @@ * @return atan of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object atan(final Object self, final Object x) { + public static double atan(final Object self, final Object x) { return Math.atan(JSType.toNumber(x)); } @@ -223,7 +223,7 @@ * @return atan2 of x and y */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object atan2(final Object self, final Object y, final Object x) { + public static double atan2(final Object self, final Object y, final Object x) { return Math.atan2(JSType.toNumber(y), JSType.toNumber(x)); } @@ -250,7 +250,7 @@ * @return ceil of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object ceil(final Object self, final Object x) { + public static double ceil(final Object self, final Object x) { return Math.ceil(JSType.toNumber(x)); } @@ -302,7 +302,7 @@ * @return cos of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object cos(final Object self, final Object x) { + public static double cos(final Object self, final Object x) { return Math.cos(JSType.toNumber(x)); } @@ -328,7 +328,7 @@ * @return exp of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object exp(final Object self, final Object x) { + public static double exp(final Object self, final Object x) { return Math.exp(JSType.toNumber(x)); } @@ -341,7 +341,7 @@ * @return floor of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object floor(final Object self, final Object x) { + public static double floor(final Object self, final Object x) { return Math.floor(JSType.toNumber(x)); } @@ -393,7 +393,7 @@ * @return log of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object log(final Object self, final Object x) { + public static double log(final Object self, final Object x) { return Math.log(JSType.toNumber(x)); } @@ -419,7 +419,7 @@ * @return the largest of the arguments, {@link Double#NEGATIVE_INFINITY} if no args given, or identity if one arg is given */ @Function(arity = 2, attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object max(final Object self, final Object... args) { + public static double max(final Object self, final Object... args) { switch (args.length) { case 0: return Double.NEGATIVE_INFINITY; @@ -497,7 +497,7 @@ * @return the smallest of the arguments, {@link Double#NEGATIVE_INFINITY} if no args given, or identity if one arg is given */ @Function(arity = 2, attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object min(final Object self, final Object... args) { + public static double min(final Object self, final Object... args) { switch (args.length) { case 0: return Double.POSITIVE_INFINITY; @@ -576,7 +576,7 @@ * @return x raised to the power of y */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object pow(final Object self, final Object x, final Object y) { + public static double pow(final Object self, final Object x, final Object y) { return Math.pow(JSType.toNumber(x), JSType.toNumber(y)); } @@ -602,7 +602,7 @@ * @return random number in the range [0..1) */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object random(final Object self) { + public static double random(final Object self) { return Math.random(); } @@ -615,7 +615,7 @@ * @return x rounded */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object round(final Object self, final Object x) { + public static double round(final Object self, final Object x) { final double d = JSType.toNumber(x); if (Math.getExponent(d) >= 52) { return d; @@ -632,7 +632,7 @@ * @return sin of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object sin(final Object self, final Object x) { + public static double sin(final Object self, final Object x) { return Math.sin(JSType.toNumber(x)); } @@ -658,7 +658,7 @@ * @return sqrt of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object sqrt(final Object self, final Object x) { + public static double sqrt(final Object self, final Object x) { return Math.sqrt(JSType.toNumber(x)); } @@ -684,7 +684,7 @@ * @return tan of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where=Where.CONSTRUCTOR) - public static Object tan(final Object self, final Object x) { + public static double tan(final Object self, final Object x) { return Math.tan(JSType.toNumber(x)); } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/parser/Parser.java --- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java Tue Jan 14 09:03:54 2014 +0530 @@ -26,7 +26,7 @@ package jdk.nashorn.internal.parser; import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL; -import static jdk.nashorn.internal.codegen.CompilerConstants.FUNCTION_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.ANON_FUNCTION_PREFIX; import static jdk.nashorn.internal.codegen.CompilerConstants.RUN_SCRIPT; import static jdk.nashorn.internal.parser.TokenType.ASSIGN; import static jdk.nashorn.internal.parser.TokenType.CASE; @@ -389,7 +389,9 @@ sb.append(parentFunction.getName()).append('$'); } - sb.append(ident != null ? ident.getName() : FUNCTION_PREFIX.symbolName()); + assert ident.getName() != null; + sb.append(ident.getName()); + final String name = namespace.uniqueName(sb.toString()); assert parentFunction != null || name.equals(RUN_SCRIPT.symbolName()) : "name = " + name;// must not rename runScript(). @@ -2132,11 +2134,20 @@ final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); - final IdentNode argIdent = getIdent(); - verifyStrictIdent(argIdent, "setter argument"); + // be sloppy and allow missing setter parameter even though + // spec does not permit it! + final IdentNode argIdent; + if (type == IDENT || isNonStrictModeIdent()) { + argIdent = getIdent(); + verifyStrictIdent(argIdent, "setter argument"); + } else { + argIdent = null; + } expect(RPAREN); List parameters = new ArrayList<>(); - parameters.add(argIdent); + if (argIdent != null) { + parameters.add(argIdent); + } functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); @@ -2448,7 +2459,7 @@ // name is null, generate anonymous name boolean isAnonymous = false; if (name == null) { - final String tmpName = "_L" + functionLine; + final String tmpName = ANON_FUNCTION_PREFIX.symbolName() + functionLine; name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName); isAnonymous = true; } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java --- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java Tue Jan 14 09:03:54 2014 +0530 @@ -30,6 +30,7 @@ import java.util.ResourceBundle; import jdk.nashorn.api.scripting.NashornException; import jdk.nashorn.internal.scripts.JS; +import jdk.nashorn.internal.codegen.CompilerConstants; /** * Helper class to throw various standard "ECMA error" exceptions such as Error, ReferenceError, TypeError etc. @@ -401,7 +402,7 @@ final String className = frame.getClassName(); // Look for script package in class name (into which compiler puts generated code) - if (className.startsWith(scriptPackage)) { + if (className.startsWith(scriptPackage) && !frame.getMethodName().startsWith(CompilerConstants.INTERNAL_METHOD_PREFIX)) { final String source = frame.getFileName(); /* * Make sure that it is not some Java code that Nashorn has in that package! diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java --- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java Tue Jan 14 09:03:54 2014 +0530 @@ -88,6 +88,7 @@ * Get the thrown object * @return thrown object */ + @Override public Object getThrown() { return thrown; } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java --- a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java Tue Jan 14 09:03:54 2014 +0530 @@ -112,7 +112,7 @@ return property != null && property.hasGetterFunction(prototype) ? self : prototype; } - /** + /** * Return the appropriate receiver for a setter. * @return appropriate receiver */ @@ -172,5 +172,20 @@ property.setObjectValue(getSetterReceiver(), getOwner(), value, strict); } + /** + * Get the number of objects in the prototype chain between the {@code self} and the + * {@code owner} objects. + * @return the prototype chain length + */ + int getProtoChainLength() { + assert self != null; + int length = 0; + for (ScriptObject obj = self; obj != prototype; obj = obj.getProto()) { + assert !(obj instanceof WithObject); + ++length; + } + return length; + } + } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java Tue Jan 14 09:03:54 2014 +0530 @@ -143,6 +143,8 @@ private static final MethodHandle TRUNCATINGFILTER = findOwnMH("truncatingFilter", Object[].class, int.class, Object[].class); private static final MethodHandle KNOWNFUNCPROPGUARD = findOwnMH("knownFunctionPropertyGuard", boolean.class, Object.class, PropertyMap.class, MethodHandle.class, Object.class, ScriptFunction.class); + private static final ArrayList protoFilters = new ArrayList<>(); + /** Method handle for getting a function argument at a given index. Used from MapCreator */ public static final Call GET_ARGUMENT = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArgument", Object.class, int.class); @@ -1712,6 +1714,44 @@ } /** + * Test whether this object contains in its prototype chain or is itself a with-object. + * @return true if a with-object was found + */ + final boolean hasWithScope() { + if (isScope()) { + for (ScriptObject obj = this; obj != null; obj = obj.getProto()) { + if (obj instanceof WithObject) { + return true; + } + } + } + return false; + } + + /** + * Add a filter to the first argument of {@code methodHandle} that calls its {@link #getProto()} method + * {@code depth} times. + * @param methodHandle a method handle + * @param depth distance to target prototype + * @return the filtered method handle + */ + static MethodHandle addProtoFilter(final MethodHandle methodHandle, final int depth) { + if (depth == 0) { + return methodHandle; + } + final int listIndex = depth - 1; // We don't need 0-deep walker + MethodHandle filter = listIndex < protoFilters.size() ? protoFilters.get(listIndex) : null; + + if(filter == null) { + filter = addProtoFilter(GETPROTO, depth - 1); + protoFilters.add(null); + protoFilters.set(listIndex, filter); + } + + return MH.filterArguments(methodHandle, 0, filter.asType(filter.type().changeReturnType(methodHandle.type().parameterType(0)))); + } + + /** * Find the appropriate GET method for an invoke dynamic call. * * @param desc the call site descriptor @@ -1722,7 +1762,7 @@ */ protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if (request.isCallSiteUnstable()) { + if (request.isCallSiteUnstable() || hasWithScope()) { return findMegaMorphicGetMethod(desc, name, "getMethod".equals(operator)); } @@ -1748,22 +1788,24 @@ final Property property = find.getProperty(); methodHandle = find.getGetter(returnType); + final boolean noGuard = ObjectClassGenerator.OBJECT_FIELDS_ONLY && NashornCallSiteDescriptor.isFastScope(desc) && !property.canChangeType(); // getMap() is fine as we have the prototype switchpoint depending on where the property was found - final MethodHandle guard = NashornGuards.getMapGuard(getMap()); + final MethodHandle guard = noGuard ? null : NashornGuards.getMapGuard(getMap()); if (methodHandle != null) { assert methodHandle.type().returnType().equals(returnType); if (find.isSelf()) { - return new GuardedInvocation(methodHandle, ObjectClassGenerator.OBJECT_FIELDS_ONLY && - NashornCallSiteDescriptor.isFastScope(desc) && !property.canChangeType() ? null : guard); + return new GuardedInvocation(methodHandle, guard); } - final ScriptObject prototype = find.getOwner(); - - if (!property.hasGetterFunction(prototype)) { - methodHandle = bindTo(methodHandle, prototype); + if (!property.hasGetterFunction(find.getOwner())) { + // If not a scope bind to actual prototype as changing prototype will change the property map. + // For scopes we install a filter that replaces the self object with the prototype owning the property. + methodHandle = isScope() ? + addProtoFilter(methodHandle, find.getProtoChainLength()) : + bindTo(methodHandle, find.getOwner()); } - return new GuardedInvocation(methodHandle, getMap().getProtoGetSwitchPoint(proto, name), guard); + return new GuardedInvocation(methodHandle, noGuard ? null : getMap().getProtoGetSwitchPoint(proto, name), guard); } assert !NashornCallSiteDescriptor.isFastScope(desc); @@ -1833,7 +1875,7 @@ */ protected GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if (request.isCallSiteUnstable()) { + if (request.isCallSiteUnstable() || hasWithScope()) { return findMegaMorphicSetMethod(desc, name); } @@ -1888,7 +1930,9 @@ final ScriptObject obj = (ScriptObject)self; final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc); if (!obj.isExtensible()) { - throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj)); + if (isStrict) { + throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj)); + } } else if (obj.compareAndSetMap(oldMap, newMap)) { setter.invokeExact(self, value); } else { @@ -2759,7 +2803,8 @@ public final void setObject(final FindProperty find, final boolean strict, final String key, final Object value) { FindProperty f = find; - if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty)) { + if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty) && !isScope()) { + // Setting a property should not modify the property in prototype unless this is a scope object. f = null; } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java --- a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java Tue Jan 14 09:03:54 2014 +0530 @@ -151,10 +151,12 @@ assert methodHandle != null; assert property != null; - final ScriptObject prototype = find.getOwner(); final MethodHandle boundHandle; - if (!property.hasSetterFunction(prototype) && find.isInherited()) { - boundHandle = ScriptObject.bindTo(methodHandle, prototype); + if (!property.hasSetterFunction(find.getOwner()) && find.isInherited()) { + // Bind or add prototype filter depending on whether this is a scope object. + boundHandle = sobj.isScope() ? + ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength()): + ScriptObject.bindTo(methodHandle, find.getOwner()); } else { boundHandle = methodHandle; } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Tue Jan 14 09:03:54 2014 +0530 @@ -317,7 +317,7 @@ final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_STATIC, CLASS_INIT, Type.getMethodDescriptor(Type.VOID_TYPE), null, null)); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR, false); final Label initGlobal; if(samName != null) { // If the class is a SAM, allow having a ScriptFunction passed as class overrides @@ -333,7 +333,7 @@ if(mi.getName().equals(samName)) { mv.dup(); mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR, false); } else { mv.visitInsn(ACONST_NULL); } @@ -350,7 +350,7 @@ mv.dup(); mv.aconst(mi.getName()); mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR, false); mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR); } @@ -367,7 +367,7 @@ private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); - mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context + mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); } @@ -424,7 +424,7 @@ mv.load(offset, argType); offset += argType.getSize(); } - mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor()); + mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false); endInitMethod(mv); } @@ -477,7 +477,7 @@ mv.load(offset, argType); offset += argType.getSize(); } - mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor()); + mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false); // Get a descriptor to the appropriate "JavaAdapterFactory.getHandle" method. final String getHandleDescriptor = fromFunction ? GET_HANDLE_FUNCTION_DESCRIPTOR : GET_HANDLE_OBJECT_DESCRIPTOR; @@ -496,7 +496,7 @@ mv.aconst(mi.getName()); } mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor, false); } mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR); } @@ -520,11 +520,11 @@ } private static void invokeGetGlobal(final InstructionAdapter mv) { - mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR); + mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false); } private static void invokeSetGlobal(final InstructionAdapter mv) { - mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR); + mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false); } /** @@ -647,11 +647,11 @@ // If the super method is abstract, throw an exception mv.anew(UNSUPPORTED_OPERATION_TYPE); mv.dup(); - mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR); + mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR, false); mv.athrow(); } else { // If the super method is not abstract, delegate to it. - emitSuperCall(mv, name, methodDesc); + emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc); } final Label setupGlobal = new Label(); @@ -728,7 +728,7 @@ // Invoke the target method handle final Label tryBlockStart = new Label(); mv.visitLabel(tryBlockStart); - mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString()); + mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); final Label tryBlockEnd = new Label(); mv.visitLabel(tryBlockEnd); emitFinally(mv, currentGlobalVar, globalsDifferVar); @@ -744,7 +744,7 @@ mv.anew(RUNTIME_EXCEPTION_TYPE); mv.dupX1(); mv.swap(); - mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE)); + mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE), false); // Fall through to rethrow handler } else { throwableHandler = null; @@ -830,12 +830,12 @@ SUPER_PREFIX + name, methodDesc, null, getExceptionNames(method.getExceptionTypes()))); mv.visitCode(); - emitSuperCall(mv, name, methodDesc); + emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc); endMethod(mv); } - private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) { + private void emitSuperCall(final InstructionAdapter mv, final Class owner, final String name, final String methodDesc) { mv.visitVarInsn(ALOAD, 0); int nextParam = 1; final Type methodType = Type.getMethodType(methodDesc); @@ -843,7 +843,13 @@ mv.load(nextParam, t); nextParam += t.getSize(); } - mv.invokespecial(superClassName, name, methodDesc); + + // default method - non-abstract, interface method + if (Modifier.isInterface(owner.getModifiers())) { + mv.invokespecial(Type.getInternalName(owner), name, methodDesc, false); + } else { + mv.invokespecial(superClassName, name, methodDesc, false); + } mv.areturn(methodType.getReturnType()); } diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java Tue Jan 14 09:03:54 2014 +0530 @@ -75,7 +75,8 @@ if ((self instanceof Class) && Modifier.isPublic(((Class)self).getModifiers())) { final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor(); if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) { - if ("static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) { + if (desc.getNameTokenCount() > CallSiteDescriptor.NAME_OPERAND && + "static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) { if (Context.isAccessibleClass((Class)self) && !isReflectionClass((Class)self)) { // If "getProp:static" passes access checks, allow access. return; diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8010731.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8010731.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,64 @@ +/* + * 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-8010731: Nashorn exposes internal symbols such as __callee__, __scope__ to scripts + * + * @test + * @run + */ + +function checkCallee() { + var x = arguments[0]; // force __callee__ (renamed as :callee) + + print(__callee__); +} + +try { + checkCallee(); + fail("Should have thrown ReferenceError for __callee__"); +} catch (e) { + if (! (e instanceof ReferenceError)) { + fail("ReferenceError expected, got " + e); + } +} + +function checkScope() { + var x = 334; + + function inner() { + var y = x * x; // force __scope__ (renamed as :scope") + print(__scope__); + } + + inner(); +} + +try { + checkScope(); + fail("Should have thrown ReferenceError for __scope__"); +} catch (e) { + if (! (e instanceof ReferenceError)) { + fail("ReferenceError expected, got " + e); + } +} diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8025515.js --- a/nashorn/test/script/basic/JDK-8025515.js Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/test/script/basic/JDK-8025515.js Tue Jan 14 09:03:54 2014 +0530 @@ -30,13 +30,23 @@ // Make sure synthetic names of anonymous functions have correct line numbers +function getFirstScriptFrame(stack) { + for (frameNum in stack) { + var frame = stack[frameNum]; + if (frame.className.startsWith("jdk.nashorn.internal.scripts.Script$")) { + return frame; + } + } +} + function testMethodName(f, expected) { try { f(); fail("expected error"); } catch (e) { - var stack = e.getStackTrace(); - if (stack[0].methodName !== expected) { + var stack = e.nashornException.getStackTrace(); + var name = getFirstScriptFrame(stack).methodName; + if (name !== expected) { fail("got " + stack[0].methodName + ", expected " + expected); } } @@ -44,15 +54,15 @@ testMethodName(function() { return a.b.c; -}, "_L45"); +}, "L:55"); -testMethodName(function() { throw new Error() }, "_L49"); +testMethodName(function() { throw new Error() }, "L:59"); var f = (function() { return function() { a.b.c; }; })(); -testMethodName(f, "_L51$_L52"); +testMethodName(f, "L:61$L:62"); testMethodName((function() { return function() { return a.b.c; }; -})(), "_L56$_L57"); +})(), "L:66$L:67"); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8029364.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8029364.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,49 @@ +/* + * 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-8029364: NashornException to expose thrown object + * + * @test + * @run + */ + +var m = new javax.script.ScriptEngineManager(); +var e = m.getEngineByName("nashorn"); +var g = e.eval("this"); +try { + e.eval("var e = new Error('foo'); e.bar = 33; throw e"); +} catch (se) { + // ScriptException instance's cause is a NashornException + print(se.getClass()); + var cause = se.cause; + print(cause.getClass()); + // NashornException instance has 'ecmaError' bean getter + print(cause.ecmaError); + // access to underlying ECMA Error object + print(cause.ecmaError instanceof g.Error); + print(cause.ecmaError.name); + print(cause.ecmaError.message); + print(cause.ecmaError.bar); +} + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8029364.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8029364.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,7 @@ +class javax.script.ScriptException +class jdk.nashorn.internal.runtime.ECMAException +Error: foo +true +Error +foo +33 diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8029667.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8029667.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,91 @@ +/* + * 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-8029667: Prototype linking is incorrect + * + * @test + * @run + */ + +function f(x) { + return (function inner() { + var y; (function dummy() { return y })() // force own scope for the inner function + with({}) { // 'with' block turns off fast scopes + return x + } + })(); +} +print(f(1)); +print(f(2)); + +function g(x) { + (function inner() { + var y; (function dummy() { return y })() // force own scope for the inner function + with({}) { // 'with' block turns off fast scopes + // Test setter as well as getter + x = x + 2; + } + })(); + print(x); +} + +g(1); +g(2); + +var withScopes = [{ func: function() { print("called 1");} }, { func: function() { print("called 2");} }]; + +for(var i in withScopes) { + with (withScopes[i]) { + var main = function() { + var frame; // <---- this local variable caused scope to be not set properly prior to fix + + function callFunc() { + frame = func(); + } + + callFunc(); + } + } + main(); +} + +for(var i in withScopes) { + with (withScopes[i]) { + var main = function() { + var frame; // <---- this local variable caused scope to be not set properly prior to fix + + function callFunc() { + frame = func = i; + } + + callFunc(); + } + } + main(); +} + +print(withScopes[0].func); +print(withScopes[1].func); + + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8029667.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8029667.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,8 @@ +1 +2 +3 +4 +called 1 +called 2 +0 +1 diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030182.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030182.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,46 @@ +/* + * 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-8030182: scopeCall with -1 as line number + * + * @test + * @run + */ + +function func() { + throw new Error("Strange..."); +} + +var f2 = func; +var f3 = func; +var f4 = func; +var f5 = func; + +// check that "scopeCall" or some such internal method +// does not appear in script stack trace. +try { + func(); +} catch(err) { + print(err.stack.replace(/\\/g, '/')); +} diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030182.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030182.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,3 @@ +Error: Strange... + at func (test/script/basic/JDK-8030182.js:32) + at (test/script/basic/JDK-8030182.js:43) diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030182_2.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030182_2.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,46 @@ +/* + * 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-8030182: scopeCall with -1 as line number + * + * @test + * @run + */ + +var str = ""; + +// large code to force splitting +for (i = 0; i < 1000; ++i) + str +="o = new Object()\n"; + +str +="g()"; + +// check that "$split" or some such internal method +// does not appear in script stack trace!! +try { + eval(str); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,3 @@ +ReferenceError: "g" is not defined + at (test/script/basic/JDK-8030182_2.js#42:4@0:-1) + at (test/script/basic/JDK-8030182_2.js:42) diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030809.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030809.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,41 @@ +/* + * 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-8030809: Anonymous functions should not be shown with internal names in script stack trace + * + * @test + * @run + */ + +function func() { + (function() { + throw new Error(); + })(); +} + +try { + func(); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8030809.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8030809.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,4 @@ +Error + at (test/script/basic/JDK-8030809.js:33) + at func (test/script/basic/JDK-8030809.js:32) + at (test/script/basic/JDK-8030809.js:38) diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8031317.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8031317.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,41 @@ +/* + * 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-8031317: SyntaxError when property setter has no parameter + * + * @test + * @run + */ + +var obj = { + get toto() { + print("in getter for 'toto'"); + }, + set toto() { + print("in setter for 'toto'"); + } +} + +obj.toto; +obj.toto = 344; diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8031317.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8031317.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,2 @@ +in getter for 'toto' +in setter for 'toto' diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8031359.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8031359.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2010, 2014, 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-8031359: Invocable.getInterface() works incorrectly if interface has default methods + * + * @test + * @run + */ + +var func = new java.util.function.Function() { + apply: function(arg) { + print("func called with " + arg); + return arg.toUpperCase(); + } +}; + +// Function.andThen is a default method +func.andThen(func)("hello"); + +// Function.compose is another default method +func.compose(new java.util.function.Function() { + apply: function(arg) { + print("compose called with " + arg); + return arg.charAt(0); + } +})("hello"); + +var func2 = new java.util.function.Function() { + apply: function(arg) { + print("I am func2: " + arg); + return arg; + }, + + andThen: function(func) { + print("This is my andThen!"); + return func; + } +}; + +func2.apply("hello"); +func2.andThen(func); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/basic/JDK-8031359.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/basic/JDK-8031359.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,6 @@ +func called with hello +func called with HELLO +compose called with hello +func called with h +I am func2: hello +This is my andThen! diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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. + */ + +/** + * Base library for Showdown markdown engine Nashorn testing. + * @subtest + * + * + */ + +load(__DIR__ + "external/showdown/showdown.js"); +var shdwn = Showdown; +var window = { + Showdown: shdwn +} +load(__DIR__ + "external/showdown/table.js"); +var converter = new Showdown.converter({extensions: ['table']}); + diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/anchors-by-reference.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/anchors-by-reference.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is [an example][id] reference-style link.\nThis is [another] [foo] reference-style link.\nThis is [a third][bar] reference-style link.\nThis is [a fourth][4] reference-style link.\n\n [id]: http://example.com/ \"Optional Title Here\"\n [foo]: http://example.com/ (Optional Title Here)\n [bar]: http://example.com/ (Optional Title Here)\n [4]: \n \"Optional Title Here\""; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/anchors-by-reference.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/anchors-by-reference.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,4 @@ +

This is an example reference-style link. +This is another reference-style link. +This is a third reference-style link. +This is a fourth reference-style link.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/automatic-anchors.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/automatic-anchors.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/automatic-anchors.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/automatic-anchors.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

http://example.com/

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/blockquote-nested-markdown.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/blockquote-nested-markdown.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "> ## This is a header.\n>\n> 1. This is the first list item.\n> 2. This is the second list item.\n>\n> Here's some example code:\n>\n> return shell_exec(\"echo $input | $markdown_script\");"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/blockquote-nested-markdown.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/blockquote-nested-markdown.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,13 @@ +
+

This is a header.

+ +
    +
  1. This is the first list item.
  2. +
  3. This is the second list item.
  4. +
+ +

Here's some example code:

+ +
return shell_exec("echo $input | $markdown_script");
+
+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/blockquote.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/blockquote.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = " \n > This is a multi line blockquote test\n >\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/blockquote.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/blockquote.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
+

This is a multi line blockquote test

+ +

With more than one line.

+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/code-block-html-escape.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/code-block-html-escape.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is some HTML:\n\n

Heading

"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/code-block-html-escape.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/code-block-html-escape.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,4 @@ +

This is some HTML:

+ +
<h1>Heading</h1>
+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/code-block.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/code-block.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is a normal paragraph:\n\n This is a code block."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/code-block.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/code-block.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,4 @@ +

This is a normal paragraph:

+ +
This is a code block.
+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/doubline-list.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/doubline-list.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n * Bird\n\n * Magic"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/doubline-list.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/doubline-list.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,4 @@ +
    +
  • Bird

  • +
  • Magic

  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/emphasis.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/emphasis.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n*important*\n\n_important_\n\nthis mid*important*sentence"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/emphasis.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/emphasis.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +

important

+ +

important

+ +

this midimportantsentence

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/escaped-number-period.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/escaped-number-period.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "It happened in 1986\. What a great season."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/escaped-number-period.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/escaped-number-period.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

It happened in 1986. What a great season.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/escaping.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/escaping.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThese should all be escaped:\n\n\\\n\n\`\n\n\*\n\n\_\n\n\{\n\n\}\n\n\[\n\n\]\n\n\(\n\n\)\n\n\#\n\n\+\n\n\-\n\n\.\n\n\!"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/escaping.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/escaping.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,31 @@ +

These should all be escaped:

+ +

\

+ +

`

+ +

*

+ +

_

+ +

{

+ +

}

+ +

[

+ +

]

+ +

(

+ +

)

+ +

#

+ +

+

+ +

-

+ +

.

+ +

!

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-at-start.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-at-start.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "```\nfunction MyFunc(a) {\n // ...\n}\n```\n\nThat is some code!"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-at-start.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-at-start.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,6 @@ +
function MyFunc(a) {
+    // ...
+}
+
+ +

That is some code!

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-codeblock.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-codeblock.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nDefine a function in javascript:\n\n```\nfunction MyFunc(a) {\n var s = '`';\n}\n```\n\nAnd some HTML\n\n```html\n
HTML!
\n```"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-codeblock.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-codeblock.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,11 @@ +

Define a function in javascript:

+ +
function MyFunc(a) {
+    var s = '`';
+}
+
+ +

And some HTML

+ +
<div>HTML!</div>
+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-linebreaks.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-linebreaks.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "```\ncode can go here\nthis is rendered on a second line\n```"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/github-style-linebreaks.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/github-style-linebreaks.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,3 @@ +
code can go here
+this is rendered on a second line
+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-double-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-double-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "# This is an H1 #"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-double-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-double-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H1

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-equals.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-equals.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "This is an H1\n============="; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-equals.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-equals.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H1

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "# This is an H1"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h1-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h1-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H1

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-dashes.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-dashes.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "This is an H2\n-------------"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H2

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-double-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-double-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "## This is an H2 ##"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-double-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-double-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H2

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "## This is an H2"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h2-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h2-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H2

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h3-with-double-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h3-with-double-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "### This is an H3 ###"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h3-with-double-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h3-with-double-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H3

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h3-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h3-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "### This is an H3"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h3-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h3-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H3

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h4-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h4-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "#### This is an H4"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h4-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h4-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

This is an H4

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h5-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h5-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "##### This is an H5"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h5-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h5-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +
This is an H5
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h6-with-single-hash.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h6-with-single-hash.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "###### This is an H6"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/h6-with-single-hash.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/h6-with-single-hash.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +
This is an H6
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/horizontal-rules.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/horizontal-rules.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n* * *\n\n***\n\n*****\n\n- - -\n\n---------------------------------------\n"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/horizontal-rules.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/horizontal-rules.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,9 @@ +
+ +
+ +
+ +
+ +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/html5-strutural-tags.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/html5-strutural-tags.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThese HTML5 tags should pass through just fine.\n\n
hello
\n
head
\n
footsies
\n\n
read me
\n\n
read\nme
\n\n\nthe end"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/html5-strutural-tags.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/html5-strutural-tags.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,22 @@ +

These HTML5 tags should pass through just fine.

+ +
hello
+ +
head
+ +
footsies
+ + + +
read me
+ + + +
read +me
+ + + +

the end

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/images.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/images.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n![Alt text](/path/to/img.jpg)\n\n![Alt text](/path/to/img.jpg \"Optional title\")\n\n![Alt text][id]\n\n [id]: url/to/image \"Optional title attribute\""; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/images.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/images.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +

Alt text

+ +

Alt text

+ +

Alt text

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/implicit-anchors.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/implicit-anchors.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nSearch the web at [Google][] or [Daring Fireball][].\n\n [Google]: http://google.com/\n [Daring Fireball]: http://daringfireball.net/"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/implicit-anchors.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/implicit-anchors.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

Search the web at Google or Daring Fireball.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-anchors.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-anchors.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is [an example](http://example.com/ \"Title\") inline link.\n\n[This link](http://example.net/) has no title attribute."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-anchors.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-anchors.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,3 @@ +

This is an example inline link.

+ +

This link has no title attribute.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-code.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-code.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nCreate a new `function`.\n\nUse the backtick in MySQL syntax ``SELECT `column` FROM whatever``.\n\nA single backtick in a code span: `` ` ``\n\nA backtick-delimited string in a code span: `` `foo` ``\n\nPlease don't use any `` tags.\n\n`—` is the decimal-encoded equivalent of `—`."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-code.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-code.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,11 @@ +

Create a new function.

+ +

Use the backtick in MySQL syntax SELECT `column` FROM whatever.

+ +

A single backtick in a code span: `

+ +

A backtick-delimited string in a code span: `foo`

+ +

Please don't use any <blink> tags.

+ +

&#8212; is the decimal-encoded equivalent of &mdash;.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-style-tag.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-style-tag.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n\n\nAn exciting sentence."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/inline-style-tag.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/inline-style-tag.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ + + +

An exciting sentence.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/lazy-blockquote.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/lazy-blockquote.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n > This is a multi line blockquote test\n\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/lazy-blockquote.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/lazy-blockquote.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
+

This is a multi line blockquote test

+ +

With more than one line.

+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/list-with-blockquote.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/list-with-blockquote.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "* A list item with a blockquote:\n\n > This is a blockquote\n > inside a list item."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/list-with-blockquote.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/list-with-blockquote.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,8 @@ +
    +
  • A list item with a blockquote:

    + +
    +

    This is a blockquote + inside a list item.

    +
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/list-with-code.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/list-with-code.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "* A list item with code:\n\n alert('Hello world!');"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/list-with-code.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/list-with-code.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,6 @@ +
    +
  • A list item with code:

    + +
    alert('Hello world!');
    +
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/multi-paragraph-list.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/multi-paragraph-list.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. This is a major bullet point.\n\n That contains multiple paragraphs.\n\n 2. And another line"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/multi-paragraph-list.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/multi-paragraph-list.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,6 @@ +
    +
  1. This is a major bullet point.

    + +

    That contains multiple paragraphs.

  2. +
  3. And another line

  4. +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/multiline-unordered-list.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/multiline-unordered-list.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n - This line spans\n more than one line and is lazy\n - Similar to this line"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/multiline-unordered-list.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/multiline-unordered-list.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  • This line spans +more than one line and is lazy
  • +
  • Similar to this line
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/nested-blockquote.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/nested-blockquote.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n > This is a multi line blockquote test\n >\n > > And nesting!\n >\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/nested-blockquote.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/nested-blockquote.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,9 @@ +
+

This is a multi line blockquote test

+ +
+

And nesting!

+
+ +

With more than one line.

+
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list-same-number.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list-same-number.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. Red\n 1. Green\n 1. Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list-same-number.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list-same-number.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  1. Red
  2. +
  3. Green
  4. +
  5. Blue
  6. +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list-wrong-numbers.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 8. Red\n 1. Green\n 3. Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list-wrong-numbers.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  1. Red
  2. +
  3. Green
  4. +
  5. Blue
  6. +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. Red\n 2. Green\n 3. Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/ordered-list.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/ordered-list.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  1. Red
  2. +
  3. Green
  4. +
  5. Blue
  6. +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/relative-anchors.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/relative-anchors.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nSee my [About](/about/) page for details."; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/relative-anchors.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/relative-anchors.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

See my About page for details.

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/simple-paragraph.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/simple-paragraph.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nHello, world!"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/simple-paragraph.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/simple-paragraph.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

Hello, world!

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/strong.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/strong.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n**important**\n\n__important__\n\nreally **freaking**strong"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/strong.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/strong.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +

important

+ +

important

+ +

really freakingstrong

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-basic.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-basic.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header |\n| ------------- | ------------- |\n| Row 1 Cell 1 | Row 1 Cell 2 |\n| Row 2 Cell 1 | Row 2 Cell 2 |\n"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-basic.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-basic.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +
First Header Second Header

Row 1 Cell 1

Row 1 Cell 2

Row 2 Cell 1

Row 2 Cell 2

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-large.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-large.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header | Third Header | Fourth Header |\n| ------------- | ------------- | ------------ | ------------- |\n| Row 1 Cell 1 | Row 1 Cell 2 | Row 1 Cell 3 | Row 1 Cell 4 |\n| Row 2 Cell 1 | Row 2 Cell 2 | Row 2 Cell 3 | Row 2 Cell 4 |\n| Row 3 Cell 1 | Row 3 Cell 2 | Row 3 Cell 3 | Row 3 Cell 4 |\n| Row 4 Cell 1 | Row 4 Cell 2 | Row 4 Cell 3 | Row 4 Cell 4 |\n| Row 5 Cell 1 | Row 5 Cell 2 | Row 5 Cell 3 | Row 5 Cell 4 |\n"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-large.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-large.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First Header Second Header Third Header Fourth Header

Row 1 Cell 1

Row 1 Cell 2

Row 1 Cell 3

Row 1 Cell 4

Row 2 Cell 1

Row 2 Cell 2

Row 2 Cell 3

Row 2 Cell 4

Row 3 Cell 1

Row 3 Cell 2

Row 3 Cell 3

Row 3 Cell 4

Row 4 Cell 1

Row 4 Cell 2

Row 4 Cell 3

Row 4 Cell 4

Row 5 Cell 1

Row 5 Cell 2

Row 5 Cell 3

Row 5 Cell 4

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-with-equals.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-with-equals.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header |\n| ============= | ============= |\n| Row 1 Cell 1 | Row 1 Cell 2 |\n| Row 2 Cell 1 | Row 2 Cell 2 |\n"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/table-with-equals.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/table-with-equals.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +
First Header Second Header

Row 1 Cell 1

Row 1 Cell 2

Row 2 Cell 1

Row 2 Cell 2

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-asterisk.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-asterisk.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n * Red\n * Green\n * Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-asterisk.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-asterisk.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  • Red
  • +
  • Green
  • +
  • Blue
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-minus.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-minus.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n - Red\n - Green\n - Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-minus.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-minus.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  • Red
  • +
  • Green
  • +
  • Blue
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-plus.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-plus.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n + Red\n + Green\n + Blue"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/unordered-list-plus.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/unordered-list-plus.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,5 @@ +
    +
  • Red
  • +
  • Green
  • +
  • Blue
  • +
diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/url-with-parenthesis.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/url-with-parenthesis.js Tue Jan 14 09:03:54 2014 +0530 @@ -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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThere's an [episode](http://en.memory-alpha.org/wiki/Darmok_(episode)) of Star Trek: The Next Generation"; +var output = converter.makeHtml(input); +print(output); diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/markdown/url-with-parenthesis.js.EXPECTED --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/markdown/url-with-parenthesis.js.EXPECTED Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,1 @@ +

There's an episode of Star Trek: The Next Generation

diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/script/sandbox/JDK-8031106.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nashorn/test/script/sandbox/JDK-8031106.js Tue Jan 14 09:03:54 2014 +0530 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010, 2014, 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-8031106: Nashorn: IndexOutOfBoundsException in NashornCallSiteDescriptor.getNameToken() + * + * @test + * @run + */ + +var cl = new java.lang.Object().getClass(); +try { + cl["forName"]; + fail("Should have thrown exception!"); +} catch (e) { + if (! (e instanceof java.lang.SecurityException)) { + fail("SecurityException expected, got " + e); + } +} diff -r f130ca87de66 -r 2b9e9a95f353 nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java --- a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java Wed Jul 05 19:26:54 2017 +0200 +++ b/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java Tue Jan 14 09:03:54 2014 +0530 @@ -26,6 +26,7 @@ package jdk.nashorn.api.scripting; import java.util.Objects; +import java.util.function.Function; import javax.script.Invocable; import javax.script.ScriptContext; import javax.script.ScriptEngine; @@ -522,4 +523,16 @@ Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]"); Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]"); } + + @Test + @SuppressWarnings("unchecked") + public void defaultMethodTest() throws ScriptException { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + final Invocable inv = (Invocable) e; + + Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})"); + Function func = inv.getInterface(obj, Function.class); + assertEquals(func.apply("hello"), "HELLO"); + } }