Merge
This commit is contained in:
commit
3b6813140c
@ -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 $*
|
@ -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
|
@ -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 $*
|
@ -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
|
@ -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 $*
|
@ -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
|
@ -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 $*
|
@ -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
|
@ -279,10 +279,6 @@ public final class MemberInfo implements Cloneable {
|
||||
}
|
||||
}
|
||||
} 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");
|
||||
|
@ -349,19 +349,19 @@ public class MethodGenerator extends MethodVisitor {
|
||||
|
||||
// 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 @@ public class MethodGenerator extends MethodVisitor {
|
||||
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 @@ public class MethodGenerator extends MethodVisitor {
|
||||
super.visitMethodInsn(INVOKEVIRTUAL,
|
||||
"java/io/PrintStream",
|
||||
"println",
|
||||
"(Ljava/lang/Object;)V");
|
||||
"(Ljava/lang/Object;)V", false);
|
||||
}
|
||||
}
|
||||
|
@ -146,16 +146,16 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
// call $clinit$ just before return from <clinit>
|
||||
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 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
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 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc);
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,6 +330,9 @@
|
||||
dir=".">
|
||||
<jvmarg line="${ext.class.path}"/>
|
||||
<jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="nashorn."/>
|
||||
</syspropertyset>
|
||||
<arg value="${octane-test-sys-prop.test.js.framework}"/>
|
||||
<arg value="--"/>
|
||||
<arg value="${octane-tests}"/>
|
||||
|
@ -66,13 +66,16 @@
|
||||
<condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt">
|
||||
<istrue value="${make.code.coverage}" />
|
||||
</condition>
|
||||
|
||||
<condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
|
||||
<istrue value="${jfr}"/>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="init" depends="init-conditions, init-cc">
|
||||
|
||||
<!-- extends jvm args -->
|
||||
<property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs}"/>
|
||||
<property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs}" />
|
||||
<property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
|
||||
<property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
|
||||
|
||||
<echo message="run.test.jvmargs=${run.test.jvmargs}"/>
|
||||
<echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
|
||||
@ -301,6 +304,10 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
permission java.lang.RuntimePermission "nashorn.JavaReflection";
|
||||
};
|
||||
|
||||
grant codeBase "file:/${basedir}/test/script/markdown.js" {
|
||||
permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
|
||||
};
|
||||
|
||||
</echo>
|
||||
|
||||
<replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators -->
|
||||
@ -316,6 +323,7 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
<available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
|
||||
<available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
|
||||
<available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
|
||||
<available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
|
||||
</target>
|
||||
|
||||
<target name="check-testng" unless="testng.available">
|
||||
@ -338,6 +346,9 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
|
||||
<jvmarg line="${ext.class.path}"/>
|
||||
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
|
||||
<propertyset>
|
||||
<propertyref prefix="nashorn."/>
|
||||
</propertyset>
|
||||
<propertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
@ -393,6 +404,25 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
</testng>
|
||||
</target>
|
||||
|
||||
<target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
|
||||
<fileset id="test.classes" dir="${build.test.classes.dir}">
|
||||
<include name="**/framework/*Test.class"/>
|
||||
</fileset>
|
||||
|
||||
<testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
|
||||
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
|
||||
<jvmarg line="${ext.class.path}"/>
|
||||
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
|
||||
<propertyset>
|
||||
<propertyref prefix="testmarkdown-test-sys-prop."/>
|
||||
<mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
|
||||
</propertyset>
|
||||
<classpath>
|
||||
<pathelement path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
</testng>
|
||||
</target>
|
||||
|
||||
<target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
|
||||
<fileset id="test.classes" dir="${build.test.classes.dir}">
|
||||
<include name="**/framework/*Test.class"/>
|
||||
@ -402,6 +432,9 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
|
||||
<jvmarg line="${ext.class.path}"/>
|
||||
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
|
||||
<propertyset>
|
||||
<propertyref prefix="nashorn."/>
|
||||
</propertyset>
|
||||
<propertyset>
|
||||
<propertyref prefix="test262-test-sys-prop."/>
|
||||
<mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
|
||||
@ -537,6 +570,11 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
|
||||
<mkdir dir="${test.external.dir}/yui"/>
|
||||
<get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
|
||||
<get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
|
||||
|
||||
<!-- showdown -->
|
||||
<mkdir dir="${test.external.dir}/showdown"/>
|
||||
<get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
|
||||
<get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
|
||||
|
||||
</target>
|
||||
|
||||
|
@ -71,6 +71,9 @@ fxshell.classes.dir = ${build.dir}/fxshell/classes
|
||||
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 @@ test.external.dir=test/script/external
|
||||
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-test-sys-prop.test.js.framework=\
|
||||
${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}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||
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 @@ public abstract class NashornException extends RuntimeException {
|
||||
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 @@ public abstract class NashornException extends RuntimeException {
|
||||
if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
|
||||
methodName = "<program>";
|
||||
}
|
||||
|
||||
if (methodName.contains(CompilerConstants.ANON_FUNCTION_PREFIX.symbolName())) {
|
||||
methodName = "<anonymous>";
|
||||
}
|
||||
|
||||
filtered.add(new StackTraceElement(className, methodName,
|
||||
st.getFileName(), st.getLineNumber()));
|
||||
}
|
||||
@ -188,4 +196,33 @@ public abstract class NashornException extends RuntimeException {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -476,16 +476,19 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
} 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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
if (cause instanceof NoSuchMethodException) {
|
||||
throw (NoSuchMethodException)cause;
|
||||
}
|
||||
throwAsScriptException(e);
|
||||
throwAsScriptException(e, invokeGlobal);
|
||||
throw new AssertionError("should not reach here");
|
||||
}
|
||||
}
|
||||
@ -543,7 +547,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
}
|
||||
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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
|
||||
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 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
|
||||
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;
|
||||
|
@ -108,6 +108,8 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin
|
||||
}
|
||||
|
||||
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 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin
|
||||
}
|
||||
|
||||
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 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin
|
||||
}
|
||||
|
||||
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 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin
|
||||
}
|
||||
try {
|
||||
return callable.call();
|
||||
} catch (final NashornException ne) {
|
||||
throw ne.initEcmaError(global);
|
||||
} catch (final RuntimeException e) {
|
||||
throw e;
|
||||
} catch (final Exception e) {
|
||||
|
@ -158,7 +158,7 @@ final class CodeGeneratorLexicalContext extends LexicalContext {
|
||||
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 @@ final class CodeGeneratorLexicalContext extends LexicalContext {
|
||||
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;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import jdk.nashorn.internal.runtime.Source;
|
||||
*/
|
||||
|
||||
public enum CompilerConstants {
|
||||
|
||||
/** the __FILE__ variable */
|
||||
__FILE__,
|
||||
|
||||
@ -75,7 +76,7 @@ public enum CompilerConstants {
|
||||
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 @@ public enum CompilerConstants {
|
||||
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;
|
||||
|
@ -1130,7 +1130,11 @@ public class MethodEmitter implements Emitter {
|
||||
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);
|
||||
|
@ -261,7 +261,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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 @@ public final class NativeMath extends ScriptObject {
|
||||
* @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));
|
||||
}
|
||||
|
||||
|
@ -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 @@ loop:
|
||||
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 @@ loop:
|
||||
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<IdentNode> 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 @@ loop:
|
||||
// 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;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import java.util.Locale;
|
||||
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 @@ public final class ECMAErrors {
|
||||
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!
|
||||
|
@ -88,6 +88,7 @@ public final class ECMAException extends NashornException {
|
||||
* Get the thrown object
|
||||
* @return thrown object
|
||||
*/
|
||||
@Override
|
||||
public Object getThrown() {
|
||||
return thrown;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public final class FindProperty {
|
||||
return property != null && property.hasGetterFunction(prototype) ? self : prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return the appropriate receiver for a setter.
|
||||
* @return appropriate receiver
|
||||
*/
|
||||
@ -172,5 +172,20 @@ public final class FindProperty {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,8 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
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<MethodHandle> 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);
|
||||
|
||||
@ -1711,6 +1713,44 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
return getter.replaceMethods(MH.foldArguments(invoker, argDroppingGetter), getter.getGuard());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -1722,7 +1762,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
*/
|
||||
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 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
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 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
*/
|
||||
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 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
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 abstract class ScriptObject extends PropertyListenerManager implements Pr
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -151,10 +151,12 @@ final class SetMethodCreator {
|
||||
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;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
}
|
||||
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
// 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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
// 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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,8 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{
|
||||
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;
|
||||
|
64
nashorn/test/script/basic/JDK-8010731.js
Normal file
64
nashorn/test/script/basic/JDK-8010731.js
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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 @@ function testMethodName(f, expected) {
|
||||
|
||||
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");
|
||||
|
49
nashorn/test/script/basic/JDK-8029364.js
Normal file
49
nashorn/test/script/basic/JDK-8029364.js
Normal file
@ -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);
|
||||
}
|
||||
|
7
nashorn/test/script/basic/JDK-8029364.js.EXPECTED
Normal file
7
nashorn/test/script/basic/JDK-8029364.js.EXPECTED
Normal file
@ -0,0 +1,7 @@
|
||||
class javax.script.ScriptException
|
||||
class jdk.nashorn.internal.runtime.ECMAException
|
||||
Error: foo
|
||||
true
|
||||
Error
|
||||
foo
|
||||
33
|
91
nashorn/test/script/basic/JDK-8029667.js
Normal file
91
nashorn/test/script/basic/JDK-8029667.js
Normal file
@ -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);
|
||||
|
||||
|
8
nashorn/test/script/basic/JDK-8029667.js.EXPECTED
Normal file
8
nashorn/test/script/basic/JDK-8029667.js.EXPECTED
Normal file
@ -0,0 +1,8 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
called 1
|
||||
called 2
|
||||
0
|
||||
1
|
46
nashorn/test/script/basic/JDK-8030182.js
Normal file
46
nashorn/test/script/basic/JDK-8030182.js
Normal file
@ -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, '/'));
|
||||
}
|
3
nashorn/test/script/basic/JDK-8030182.js.EXPECTED
Normal file
3
nashorn/test/script/basic/JDK-8030182.js.EXPECTED
Normal file
@ -0,0 +1,3 @@
|
||||
Error: Strange...
|
||||
at func (test/script/basic/JDK-8030182.js:32)
|
||||
at <program> (test/script/basic/JDK-8030182.js:43)
|
46
nashorn/test/script/basic/JDK-8030182_2.js
Normal file
46
nashorn/test/script/basic/JDK-8030182_2.js
Normal file
@ -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, '/'));
|
||||
}
|
||||
|
3
nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
Normal file
3
nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
Normal file
@ -0,0 +1,3 @@
|
||||
ReferenceError: "g" is not defined
|
||||
at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@0:-1)
|
||||
at <program> (test/script/basic/JDK-8030182_2.js:42)
|
41
nashorn/test/script/basic/JDK-8030809.js
Normal file
41
nashorn/test/script/basic/JDK-8030809.js
Normal file
@ -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, '/'));
|
||||
}
|
4
nashorn/test/script/basic/JDK-8030809.js.EXPECTED
Normal file
4
nashorn/test/script/basic/JDK-8030809.js.EXPECTED
Normal file
@ -0,0 +1,4 @@
|
||||
Error
|
||||
at <anonymous> (test/script/basic/JDK-8030809.js:33)
|
||||
at func (test/script/basic/JDK-8030809.js:32)
|
||||
at <program> (test/script/basic/JDK-8030809.js:38)
|
41
nashorn/test/script/basic/JDK-8031317.js
Normal file
41
nashorn/test/script/basic/JDK-8031317.js
Normal file
@ -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;
|
2
nashorn/test/script/basic/JDK-8031317.js.EXPECTED
Normal file
2
nashorn/test/script/basic/JDK-8031317.js.EXPECTED
Normal file
@ -0,0 +1,2 @@
|
||||
in getter for 'toto'
|
||||
in setter for 'toto'
|
62
nashorn/test/script/basic/JDK-8031359.js
Normal file
62
nashorn/test/script/basic/JDK-8031359.js
Normal file
@ -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);
|
6
nashorn/test/script/basic/JDK-8031359.js.EXPECTED
Normal file
6
nashorn/test/script/basic/JDK-8031359.js.EXPECTED
Normal file
@ -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!
|
38
nashorn/test/script/markdown.js
Normal file
38
nashorn/test/script/markdown.js
Normal file
@ -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']});
|
||||
|
33
nashorn/test/script/markdown/anchors-by-reference.js
Normal file
33
nashorn/test/script/markdown/anchors-by-reference.js
Normal file
@ -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]: <http://example.com/>\n \"Optional Title Here\"";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
@ -0,0 +1,4 @@
|
||||
<p>This is <a href="http://example.com/" title="Optional Title Here">an example</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">another</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">a third</a> reference-style link.
|
||||
This is <a href="http://example.com/" title="Optional Title Here">a fourth</a> reference-style link.</p>
|
33
nashorn/test/script/markdown/automatic-anchors.js
Normal file
33
nashorn/test/script/markdown/automatic-anchors.js
Normal file
@ -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<http://example.com/>";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
@ -0,0 +1 @@
|
||||
<p><a href="http://example.com/">http://example.com/</a></p>
|
33
nashorn/test/script/markdown/blockquote-nested-markdown.js
Normal file
33
nashorn/test/script/markdown/blockquote-nested-markdown.js
Normal file
@ -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);
|
@ -0,0 +1,13 @@
|
||||
<blockquote>
|
||||
<h2 id="thisisaheader">This is a header.</h2>
|
||||
|
||||
<ol>
|
||||
<li>This is the first list item.</li>
|
||||
<li>This is the second list item.</li>
|
||||
</ol>
|
||||
|
||||
<p>Here's some example code:</p>
|
||||
|
||||
<pre><code>return shell_exec("echo $input | $markdown_script");
|
||||
</code></pre>
|
||||
</blockquote>
|
33
nashorn/test/script/markdown/blockquote.js
Normal file
33
nashorn/test/script/markdown/blockquote.js
Normal file
@ -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);
|
5
nashorn/test/script/markdown/blockquote.js.EXPECTED
Normal file
5
nashorn/test/script/markdown/blockquote.js.EXPECTED
Normal file
@ -0,0 +1,5 @@
|
||||
<blockquote>
|
||||
<p>This is a multi line blockquote test</p>
|
||||
|
||||
<p>With more than one line.</p>
|
||||
</blockquote>
|
33
nashorn/test/script/markdown/code-block-html-escape.js
Normal file
33
nashorn/test/script/markdown/code-block-html-escape.js
Normal file
@ -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 <h1>Heading</h1>";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
@ -0,0 +1,4 @@
|
||||
<p>This is some HTML:</p>
|
||||
|
||||
<pre><code><h1>Heading</h1>
|
||||
</code></pre>
|
33
nashorn/test/script/markdown/code-block.js
Normal file
33
nashorn/test/script/markdown/code-block.js
Normal file
@ -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);
|
4
nashorn/test/script/markdown/code-block.js.EXPECTED
Normal file
4
nashorn/test/script/markdown/code-block.js.EXPECTED
Normal file
@ -0,0 +1,4 @@
|
||||
<p>This is a normal paragraph:</p>
|
||||
|
||||
<pre><code>This is a code block.
|
||||
</code></pre>
|
33
nashorn/test/script/markdown/doubline-list.js
Normal file
33
nashorn/test/script/markdown/doubline-list.js
Normal file
@ -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);
|
4
nashorn/test/script/markdown/doubline-list.js.EXPECTED
Normal file
4
nashorn/test/script/markdown/doubline-list.js.EXPECTED
Normal file
@ -0,0 +1,4 @@
|
||||
<ul>
|
||||
<li><p>Bird</p></li>
|
||||
<li><p>Magic</p></li>
|
||||
</ul>
|
33
nashorn/test/script/markdown/emphasis.js
Normal file
33
nashorn/test/script/markdown/emphasis.js
Normal file
@ -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);
|
5
nashorn/test/script/markdown/emphasis.js.EXPECTED
Normal file
5
nashorn/test/script/markdown/emphasis.js.EXPECTED
Normal file
@ -0,0 +1,5 @@
|
||||
<p><em>important</em></p>
|
||||
|
||||
<p><em>important</em></p>
|
||||
|
||||
<p>this mid<em>important</em>sentence</p>
|
33
nashorn/test/script/markdown/escaped-number-period.js
Normal file
33
nashorn/test/script/markdown/escaped-number-period.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<p>It happened in 1986. What a great season.</p>
|
33
nashorn/test/script/markdown/escaping.js
Normal file
33
nashorn/test/script/markdown/escaping.js
Normal file
@ -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);
|
31
nashorn/test/script/markdown/escaping.js.EXPECTED
Normal file
31
nashorn/test/script/markdown/escaping.js.EXPECTED
Normal file
@ -0,0 +1,31 @@
|
||||
<p>These should all be escaped:</p>
|
||||
|
||||
<p>\</p>
|
||||
|
||||
<p>`</p>
|
||||
|
||||
<p>*</p>
|
||||
|
||||
<p>_</p>
|
||||
|
||||
<p>{</p>
|
||||
|
||||
<p>}</p>
|
||||
|
||||
<p>[</p>
|
||||
|
||||
<p>]</p>
|
||||
|
||||
<p>(</p>
|
||||
|
||||
<p>)</p>
|
||||
|
||||
<p>#</p>
|
||||
|
||||
<p>+</p>
|
||||
|
||||
<p>-</p>
|
||||
|
||||
<p>.</p>
|
||||
|
||||
<p>!</p>
|
33
nashorn/test/script/markdown/github-style-at-start.js
Normal file
33
nashorn/test/script/markdown/github-style-at-start.js
Normal file
@ -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);
|
@ -0,0 +1,6 @@
|
||||
<pre><code>function MyFunc(a) {
|
||||
// ...
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>That is some code!</p>
|
33
nashorn/test/script/markdown/github-style-codeblock.js
Normal file
33
nashorn/test/script/markdown/github-style-codeblock.js
Normal file
@ -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<div>HTML!</div>\n```";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
@ -0,0 +1,11 @@
|
||||
<p>Define a function in javascript:</p>
|
||||
|
||||
<pre><code>function MyFunc(a) {
|
||||
var s = '`';
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>And some HTML</p>
|
||||
|
||||
<pre><code class="html"><div>HTML!</div>
|
||||
</code></pre>
|
33
nashorn/test/script/markdown/github-style-linebreaks.js
Normal file
33
nashorn/test/script/markdown/github-style-linebreaks.js
Normal file
@ -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);
|
@ -0,0 +1,3 @@
|
||||
<pre><code>code can go here
|
||||
this is rendered on a second line
|
||||
</code></pre>
|
33
nashorn/test/script/markdown/h1-with-double-hash.js
Normal file
33
nashorn/test/script/markdown/h1-with-double-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h1 id="thisisanh1">This is an H1</h1>
|
33
nashorn/test/script/markdown/h1-with-equals.js
Normal file
33
nashorn/test/script/markdown/h1-with-equals.js
Normal file
@ -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);
|
1
nashorn/test/script/markdown/h1-with-equals.js.EXPECTED
Normal file
1
nashorn/test/script/markdown/h1-with-equals.js.EXPECTED
Normal file
@ -0,0 +1 @@
|
||||
<h1 id="thisisanh1">This is an H1</h1>
|
33
nashorn/test/script/markdown/h1-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h1-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h1 id="thisisanh1">This is an H1</h1>
|
33
nashorn/test/script/markdown/h2-with-dashes.js
Normal file
33
nashorn/test/script/markdown/h2-with-dashes.js
Normal file
@ -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);
|
1
nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED
Normal file
1
nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED
Normal file
@ -0,0 +1 @@
|
||||
<h2 id="thisisanh2">This is an H2</h2>
|
33
nashorn/test/script/markdown/h2-with-double-hash.js
Normal file
33
nashorn/test/script/markdown/h2-with-double-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h2 id="thisisanh2">This is an H2</h2>
|
33
nashorn/test/script/markdown/h2-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h2-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h2 id="thisisanh2">This is an H2</h2>
|
33
nashorn/test/script/markdown/h3-with-double-hash.js
Normal file
33
nashorn/test/script/markdown/h3-with-double-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h3 id="thisisanh3">This is an H3</h3>
|
33
nashorn/test/script/markdown/h3-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h3-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h3 id="thisisanh3">This is an H3</h3>
|
33
nashorn/test/script/markdown/h4-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h4-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h4 id="thisisanh4">This is an H4</h4>
|
33
nashorn/test/script/markdown/h5-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h5-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h5 id="thisisanh5">This is an H5</h5>
|
33
nashorn/test/script/markdown/h6-with-single-hash.js
Normal file
33
nashorn/test/script/markdown/h6-with-single-hash.js
Normal file
@ -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);
|
@ -0,0 +1 @@
|
||||
<h6 id="thisisanh6">This is an H6</h6>
|
33
nashorn/test/script/markdown/horizontal-rules.js
Normal file
33
nashorn/test/script/markdown/horizontal-rules.js
Normal file
@ -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);
|
@ -0,0 +1,9 @@
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
||||
|
||||
<hr />
|
33
nashorn/test/script/markdown/html5-strutural-tags.js
Normal file
33
nashorn/test/script/markdown/html5-strutural-tags.js
Normal file
@ -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<section>hello</section>\n<header>head</header>\n<footer>footsies</footer>\n<nav>navigation</nav>\n<article>read me</article>\n<aside>ignore me</aside>\n<article>read\nme</article>\n<aside>\nignore me\n</aside>\n\nthe end";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
@ -0,0 +1,22 @@
|
||||
<p>These HTML5 tags should pass through just fine.</p>
|
||||
|
||||
<section>hello</section>
|
||||
|
||||
<header>head</header>
|
||||
|
||||
<footer>footsies</footer>
|
||||
|
||||
<nav>navigation</nav>
|
||||
|
||||
<article>read me</article>
|
||||
|
||||
<aside>ignore me</aside>
|
||||
|
||||
<article>read
|
||||
me</article>
|
||||
|
||||
<aside>
|
||||
ignore me
|
||||
</aside>
|
||||
|
||||
<p>the end</p>
|
33
nashorn/test/script/markdown/images.js
Normal file
33
nashorn/test/script/markdown/images.js
Normal file
@ -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![Alt text][id]\n\n [id]: url/to/image \"Optional title attribute\"";
|
||||
var output = converter.makeHtml(input);
|
||||
print(output);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user