Mercurial > hg > release > icedtea6-1.11
changeset 1904:ce190943412e
Merge
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Sat, 16 Jan 2010 04:30:59 +0000 |
parents | fafd64b4a0a4 (current diff) 327907cd1d5b (diff) |
children | a8247a10bcac |
files | ChangeLog Makefile.am acinclude.m4 configure.ac patches/icedtea-memory-limits.patch |
diffstat | 34 files changed, 5048 insertions(+), 251 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sat Jan 16 04:25:58 2010 +0000 +++ b/.hgignore Sat Jan 16 04:30:59 2010 +0000 @@ -469,3 +469,4 @@ pulse-java.jar hotspot.tar.gz ports/hotspot/src/cpu/zero/vm/bytecodes_arm.s +plugin/tests/LiveConnect/*jar
--- a/ChangeLog Sat Jan 16 04:25:58 2010 +0000 +++ b/ChangeLog Sat Jan 16 04:30:59 2010 +0000 @@ -9,7 +9,148 @@ Remove @Override on interface methods in OCSPResponse.java http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/c33ca6c539bf - + +2010-01-16 Andrew John Hughes <ahughes@redhat.com> + + * acinclude.m4: + (IT_CHECK_NUMBER_OF_PARALLEL_JOBS): + Handle --with-parallel-jobs and + --without-parallel-jobs correctly. + --with-parallel-jobs (no arguments) uses + available processors + 1, while + --without-parallel-jobs (the default) uses 2. + (IT_FIND_NUMBER_OF_PROCESSORS): + Dependency of above. Uses getconf to + obtain the number of available processors. + +2010-01-16 Andrew John Hughes <ahughes@redhat.com> + + * acinclude.m4: + Send output to AS_MESSAGE_LOG_FD rather + than /dev/null so we have a record of errors. + +2010-01-16 Andrew John Hughes <ahughes@redhat.com> + + configure output and option cleanup + * Makefile.am: + Change !ENABLE_OPTIMIZATIONS to + DISABLE_OPTIMIZATIONS. + * acinclude.m4: + (FIND_ECJ_JAR): Always produce output, + not just when explicitly specified. + (FIND_JAVAH): Handle the yes and no + possibilities better. + (FIND_JAR): Likewise. + (FIND_RMIC): Likewise. + (WITH_OPENJDK_SRC_ZIP): Quote checking output. + (WITH_ALT_JAR_BINARY): Likewise. + (FIND_XALAN2_JAR): Improve wording. + (FIND_XALAN2_SERIALIZER_JAR): Likewise. + (FIND_XERCES_JAR): Likewise. + (FIND_NETBEANS): Handle yes and no + possibilities better. + (FIND_RHINO_JAR): Quote checking output. + (ENABLE_OPTIMIZATIONS): Rename to + DISABLE_OPTIMIZATIONS for clarity. + (ENABLE_ZERO_BUILD): Quote checking output. + (AC_CHECK_WITH_CACAO_SRC_ZIP): Likewise. + (AC_CHECK_WITH_CACAO_SRC_DIR): Likewise. + (WITH_OPENJDK): Complete output + with no when not specified. + (IT_CHECK_ADDITIONAL_VMS): Moved to a macro + from configure.ac + (IT_CHECK_NUMBER_OF_PARALLEL_JOBS): Likewise. + * configure.ac: + Invoke new macros. Quote output and correct + typos. Perform IT_CHECK_ADDITIONAL_VMS earlier + with Shark, Zero and CACAO checks. + +2010-01-15 Edward Nevill <ed@camswl.com> + + * ports/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp + Implement is_allocatable to make build word with hs16 + +2010-01-15 Xerxes Rånby <xerxes@zafena.se> + + PR icedtea/428: + * configure.ac (LLVM_CFLAGS): Remove -pedantic from LLVM_CFLAGS. + +2010-01-14 Matthias Klose <doko@ubuntu.com> + + * Makefile.am (stamps/icedtea-npplugin): New target, add file + dependencies for building the IcedTeaNPPlugin.so. + +2010-01-13 Deepak Bhole <dbhole@redhat.com> + + * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc + (newMessageOnBus): Service GetSlot and SetSlot requests. + (call): Create Java object from result only if it is non-null. + (setMember): Pass a preset identifier to _setMember. Handle array slot + setting. + (sendMember): Handle array slot read. + (queue_processor): Service GetSlot and SetSlot requests. + (_setMember): Work with property NPIdentifier instead of name string. + (_getMember): Same. + * plugin/icedteanp/IcedTeaPluginUtils.cc + (isObjectJSArray): Handle void constructor objects like 'window'. + * plugin/tests/LiveConnect/DummyObject.java: New file. Helper for plugin + tests. + * plugin/tests/LiveConnect/OverloadTestHelper1.java: Same. + * plugin/tests/LiveConnect/OverloadTestHelper2.java: Same. + * plugin/tests/LiveConnect/OverloadTestHelper3.java: Same. + * plugin/tests/LiveConnect/PluginTest.java: New file. Plugin test applet to + drive LiveConnect tests. + * plugin/tests/LiveConnect/build: New build. Build file for plugin tests. + * plugin/tests/LiveConnect/common.js: New file. Contains common + LiveConnect test functions. + * plugin/tests/LiveConnect/index.html: New file. Index from which + LiveConnect tests can be launched. + * plugin/tests/LiveConnect/jjs_func_parameters_tests.js: New file. + Contains Java -> JS parameter passing tests. + * plugin/tests/LiveConnect/jjs_func_rettype_tests.js: New file. Contains + Java -> JS invocation return type read tests. + * plugin/tests/LiveConnect/jjs_get_tests.js: New file. Contains Java -> + JS variable read tests. + * plugin/tests/LiveConnect/jjs_set_tests.js: New file. Contains Java -> JS + variable write tests. + * plugin/tests/LiveConnect/jsj_func_overload_tests.js: New file. Contains + overload resolution tests for JS -> Java invocation. + * plugin/tests/LiveConnect/jsj_func_parameters_tests.js: New file. + Contains JS -> Java parameter passing tests. + * plugin/tests/LiveConnect/jsj_func_rettype_tests.js: New file. Contains + JS -> Java invocation return type read tests. + * plugin/tests/LiveConnect/jsj_get_tests.js: New file. Contains JS -> Java + variable read tests. + * plugin/tests/LiveConnect/jsj_set_tests.js: New file. Contains JS -> Java + variable write tests. + * plugin/tests/LiveConnect/jsj_type_casting_tests.js: New file. Contains + JS -> Java type conversion tests. + +2010-01-11 Andrew John Hughes <ahughes@redhat.com> + + * Makefile.am: + Remove redundant platform_zero symlink. + Add new Shark patch. + * patches/hotspot/hs16/shark.patch: + Replace 32-bit DefaultMaxRAM with 64-bit + MaxRAM when building HotSpot 16 b13. + +2010-01-11 Andrew John Hughes <ahughes@redhat.com> + + * patches/hotspot/hs16/memory-limits.patch: + Add HotSpot 16 version of memory limits patch. + +2010-01-11 Andrew John Hughes <ahughes@redhat.com> + + Bump to latest HotSpot 16 (b13). + * patches/icedtea-memory-limits.patch: + Moved to HotSpot-specific directories. + * Makefile.am: Use new memory-limits patches. + * hotspot.map: Bump to HotSpot 16 b13. + * patches/hotspot/hs16/icedtea-params-cast-size_t.patch, + * patches/hotspot/original/memory-limits.patch: + Recreated for the new build. + 2010-01-11 Andrew John Hughes <ahughes@redhat.com> * patches/icedtea-libraries.patch:
--- a/Makefile.am Sat Jan 16 04:25:58 2010 +0000 +++ b/Makefile.am Sat Jan 16 04:30:59 2010 +0000 @@ -123,7 +123,7 @@ # FIXME (plugin): NPPLUGIN_DIR becomes PLUGIN_DIR if ENABLE_NPPLUGIN ICEDTEAPLUGIN_CLEAN = clean-IcedTeaNPPlugin -ICEDTEAPLUGIN_TARGET = IcedTeaNPPlugin.so +ICEDTEAPLUGIN_TARGET = stamps/icedtea-npplugin PLUGIN_PATCH = patches/icedtea-liveconnect.patch LIVECONNECT_DIR = -C lib/rt netscape -C lib/rt sun/applet NPPLUGIN_DIR=$(abs_top_srcdir)/plugin/icedteanp @@ -233,7 +233,7 @@ patches/icedtea-gcc-suffix.patch \ patches/icedtea-gcc-suffix-hotspot.patch \ patches/icedtea-bytebuffer-compact.patch \ - patches/icedtea-memory-limits.patch \ + patches/hotspot/$(HSBUILD)/memory-limits.patch \ patches/icedtea-sunsrc.patch \ patches/icedtea-libraries.patch \ patches/icedtea-javafiles.patch \ @@ -342,7 +342,8 @@ if WITH_ALT_HSBUILD ICEDTEA_PATCHES += patches/hotspot/$(HSBUILD)/openjdk-6886353-ignore_deoptimizealot.patch \ - patches/hotspot/$(HSBUILD)/zero.patch + patches/hotspot/$(HSBUILD)/zero.patch \ + patches/hotspot/$(HSBUILD)/shark.patch else ICEDTEA_PATCHES += patches/hotspot/original/icedtea-6778662-lib64.patch \ patches/hotspot/original/icedtea-6778657-f2i-overflow.patch \ @@ -426,7 +427,7 @@ ALT_HOTSPOT_IMPORT_PATH="$(CACAO_IMPORT_PATH)" endif -if !ENABLE_OPTIMIZATIONS +if DISABLE_OPTIMIZATIONS ICEDTEA_ENV += \ NO_OPTIMIZATIONS="true" \ CC_NO_OPT="-O0 -g" @@ -509,7 +510,7 @@ ALT_HOTSPOT_IMPORT_PATH="$(CACAO_IMPORT_PATH)" endif -if !ENABLE_OPTIMIZATIONS +if DISABLE_OPTIMIZATIONS ICEDTEA_ENV_ECJ += \ NO_OPTIMIZATIONS="true" \ CC_NO_OPT="-O0 -g" @@ -922,7 +923,6 @@ link=$$(dirname $$target | sed 's/^.*ports/openjdk/'|sed "s#hotspot/build#hotspot/$(HOTSPOT_MAKE_DIR)#"); \ cp -rv $$target $$link; \ done - ln -sf $(abs_top_builddir)/platform_zero openjdk/hotspot/$(HOTSPOT_MAKE_DIR)/linux if ! test "x$(WITH_CACAO)" = "xno" ; then \ mkdir -p openjdk/jdk/src/solaris/bin/$(BUILD_ARCH_DIR) ; \ ln -sf $(abs_top_builddir)/jvm.cfg \ @@ -1562,7 +1562,7 @@ IcedTeaJavaRequestProcessor.o IcedTeaPluginRequestProcessor.o \ IcedTeaPluginUtils.o -IcedTeaNPPlugin_objects: +$(addprefix $(NPPLUGIN_DIR)/,$(NPPLUGIN_OBJECTS)): $(addprefix $(NPPLUGIN_DIR)/,$(NPPLUGIN_SRC)) cd $(NPPLUGIN_DIR); \ if [ -e $(abs_top_srcdir)/.hg ] && which $(HG) >/dev/null; then \ revision="-r`(cd $(abs_top_srcdir); $(HG) tip --template '{rev}')`" ; \ @@ -1579,7 +1579,7 @@ -fPIC -c $(NPPLUGIN_SRC); \ cd ../ -IcedTeaNPPlugin.so: IcedTeaNPPlugin_objects +$(NPPLUGIN_DIR)/IcedTeaNPPlugin.so: $(addprefix $(NPPLUGIN_DIR)/,$(NPPLUGIN_OBJECTS)) cd $(NPPLUGIN_DIR); \ $(CXX) $(CXXFLAGS) \ $(NPPLUGIN_OBJECTS) \ @@ -1589,6 +1589,9 @@ -shared -o $@; \ cd ../ +stamps/icedtea-npplugin: $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so + touch stamps/icedtea-npplugin + clean-IcedTeaNPPlugin: cd $(NPPLUGIN_DIR);\ rm -f *.o; \
--- a/acinclude.m4 Sat Jan 16 04:25:58 2010 +0000 +++ b/acinclude.m4 Sat Jan 16 04:30:59 2010 +0000 @@ -238,41 +238,33 @@ AC_DEFUN([FIND_ECJ_JAR], [ + AC_MSG_CHECKING([for an ecj JAR file]) AC_ARG_WITH([ecj-jar], [AS_HELP_STRING(--with-ecj-jar,specify location of the ECJ jar)], [ if test -f "${withval}"; then - AC_MSG_CHECKING(for an ecj jar) ECJ_JAR="${withval}" - AC_MSG_RESULT(${withval}) fi ], [ ECJ_JAR= ]) if test -z "${ECJ_JAR}"; then - AC_MSG_CHECKING(for eclipse-ecj.jar) - if test -e "/usr/share/java/eclipse-ecj.jar"; then - ECJ_JAR=/usr/share/java/eclipse-ecj.jar - AC_MSG_RESULT(${ECJ_JAR}) - elif test -e "/usr/share/java/ecj.jar"; then - ECJ_JAR=/usr/share/java/ecj.jar - AC_MSG_RESULT(${ECJ_JAR}) - elif test -e "/usr/share/eclipse-ecj-3.3/lib/ecj.jar"; then - ECJ_JAR=/usr/share/eclipse-ecj-3.3/lib/ecj.jar - AC_MSG_RESULT(${ECJ_JAR}) - elif test -e "/usr/share/eclipse-ecj-3.2/lib/ecj.jar"; then - ECJ_JAR=/usr/share/eclipse-ecj-3.2/lib/ecj.jar - AC_MSG_RESULT(${ECJ_JAR}) - elif test -e "/usr/share/eclipse-ecj-3.1/lib/ecj.jar"; then - ECJ_JAR=/usr/share/eclipse-ecj-3.1/lib/ecj.jar - AC_MSG_RESULT(${ECJ_JAR}) - else - AC_MSG_RESULT(no) - fi + for jar in /usr/share/java/eclipse-ecj.jar \ + /usr/share/java/ecj.jar \ + /usr/share/eclipse-ecj-3.{2,3,4,5}/lib/ecj.jar; do + if test -e $jar; then + ECJ_JAR=$jar + break + fi + done + if test -z "${ECJ_JAR}"; then + ECJ_JAR=no + fi fi - if test -z "${ECJ_JAR}"; then - AC_MSG_ERROR("A ECJ jar was not found.") + AC_MSG_RESULT(${ECJ_JAR}) + if test "x${ECJ_JAR}" = "xno"; then + AC_MSG_ERROR("No compiler or ecj JAR file was found.") fi AC_SUBST(ECJ_JAR) ]) @@ -289,20 +281,27 @@ AC_DEFUN([FIND_JAVAH], [ + AC_MSG_CHECKING([if a javah executable is specified]) AC_ARG_WITH([javah], - [AS_HELP_STRING(--with-javah,specify location of the javah)], + [AS_HELP_STRING(--with-javah,specify location of javah)], [ - if test -f "${withval}"; then - AC_MSG_CHECKING(for javah) + if test "x${withval}" = "xyes"; then + JAVAH=no + else JAVAH="${withval}" - AC_MSG_RESULT(${withval}) - else - AC_PATH_PROG(JAVAH, "${withval}") fi ], [ - JAVAH= + JAVAH=no ]) + AC_MSG_RESULT(${JAVAH}) + if ! test -f "${JAVAH}"; then + if test "x${JAVAH}" = "xno"; then + JAVAH= + else + AC_PATH_PROG(JAVAH, "${JAVAH}") + fi + fi if test -z "${JAVAH}"; then AC_PATH_PROG(JAVAH, "gjavah") fi @@ -310,27 +309,34 @@ AC_PATH_PROG(JAVAH, "javah") fi if test -z "${JAVAH}"; then - AC_MSG_ERROR("javah was not found.") + AC_MSG_ERROR("A Java header generator was not found.") fi AC_SUBST(JAVAH) ]) AC_DEFUN([FIND_JAR], [ + AC_MSG_CHECKING([if a jar executable is specified]) AC_ARG_WITH([jar], - [AS_HELP_STRING(--with-jar,specify location of the jar)], + [AS_HELP_STRING(--with-jar,specify location of jar)], [ - if test -f "${withval}"; then - AC_MSG_CHECKING(for jar) + if test "x${withval}" = "xyes"; then + JAR=no + else JAR="${withval}" - AC_MSG_RESULT(${withval}) - else - AC_PATH_PROG(JAR, "${withval}") fi ], [ - JAR= + JAR=no ]) + AC_MSG_RESULT(${JAR}) + if ! test -f "${JAR}"; then + if test "x${JAR}" = "xno"; then + JAR= + else + AC_PATH_PROG(JAR, "${JAR}") + fi + fi if test -z "${JAR}"; then AC_PATH_PROG(JAR, "gjar") fi @@ -338,14 +344,14 @@ AC_PATH_PROG(JAR, "jar") fi if test -z "${JAR}"; then - AC_MSG_ERROR("jar was not found.") + AC_MSG_ERROR("A jar tool was not found.") fi AC_MSG_CHECKING([whether jar supports @<file> argument]) touch _config.txt cat >_config.list <<EOF _config.txt EOF - if $JAR cf _config.jar @_config.list 2>/dev/null; then + if $JAR cf _config.jar @_config.list 2>&AS_MESSAGE_LOG_FD; then JAR_KNOWS_ATFILE=1 AC_MSG_RESULT(yes) else @@ -353,7 +359,7 @@ AC_MSG_RESULT(no) fi AC_MSG_CHECKING([whether jar supports stdin file arguments]) - if cat _config.list | $JAR cf@ _config.jar 2>/dev/null; then + if cat _config.list | $JAR cf@ _config.jar 2>&AS_MESSAGE_LOG_FD; then JAR_ACCEPTS_STDIN_LIST=1 AC_MSG_RESULT(yes) else @@ -362,7 +368,7 @@ fi rm -f _config.list _config.jar AC_MSG_CHECKING([whether jar supports -J options at the end]) - if $JAR cf _config.jar _config.txt -J-Xmx896m 2>/dev/null; then + if $JAR cf _config.jar _config.txt -J-Xmx896m 2>&AS_MESSAGE_LOG_FD; then JAR_KNOWS_J_OPTIONS=1 AC_MSG_RESULT(yes) else @@ -378,20 +384,27 @@ AC_DEFUN([FIND_RMIC], [ + AC_MSG_CHECKING(if an rmic executable is specified) AC_ARG_WITH([rmic], - [AS_HELP_STRING(--with-rmic,specify location of the rmic)], + [AS_HELP_STRING(--with-rmic,specify location of rmic)], [ - if test -f "${withval}"; then - AC_MSG_CHECKING(for rmic) + if test "x${withval}" = "xyes"; then + RMIC=no + else RMIC="${withval}" - AC_MSG_RESULT(${withval}) - else - AC_PATH_PROG(RMIC, "${withval}") fi ], [ - RMIC= + RMIC=no ]) + AC_MSG_RESULT(${RMIC}) + if ! test -f "${RMIC}"; then + if test "x${RMIC}" = "xno"; then + RMIC= + else + AC_PATH_PROG(RMIC, "${RMIC}") + fi + fi if test -z "${RMIC}"; then AC_PATH_PROG(RMIC, "grmic") fi @@ -399,7 +412,7 @@ AC_PATH_PROG(RMIC, "rmic") fi if test -z "${RMIC}"; then - AC_MSG_ERROR("rmic was not found.") + AC_MSG_ERROR("An RMI compiler was not found.") fi AC_SUBST(RMIC) ]) @@ -446,7 +459,7 @@ AC_DEFUN([WITH_OPENJDK_SRC_ZIP], [ - AC_MSG_CHECKING(for an OpenJDK source zip) + AC_MSG_CHECKING([for an OpenJDK source zip]) AC_ARG_WITH([openjdk-src-zip], [AS_HELP_STRING(--with-openjdk-src-zip,specify the location of the openjdk source zip)], [ @@ -463,7 +476,7 @@ AC_DEFUN([WITH_ALT_JAR_BINARY], [ - AC_MSG_CHECKING(for an alternate jar command) + AC_MSG_CHECKING([for an alternate jar command]) AC_ARG_WITH([alt-jar], [AS_HELP_STRING(--with-alt-jar, specify the location of an alternate jar binary to use for building)], [ @@ -480,7 +493,7 @@ AC_DEFUN([FIND_XALAN2_JAR], [ - AC_MSG_CHECKING(xalan2 jar) + AC_MSG_CHECKING([for a xalan2 jar]) AC_ARG_WITH([xalan2-jar], [AS_HELP_STRING(--with-xalan2-jar,specify location of the xalan2 jar)], [ @@ -511,7 +524,7 @@ AC_DEFUN([FIND_XALAN2_SERIALIZER_JAR], [ - AC_MSG_CHECKING(for xalan2 serializer jar) + AC_MSG_CHECKING([for a xalan2 serializer jar]) AC_ARG_WITH([xalan2-serializer-jar], [AS_HELP_STRING(--with-xalan2-serializer-jar,specify location of the xalan2-serializer jar)], [ @@ -542,7 +555,7 @@ AC_DEFUN([FIND_XERCES2_JAR], [ - AC_MSG_CHECKING(for xerces2 jar) + AC_MSG_CHECKING([for a xerces2 jar]) AC_ARG_WITH([xerces2-jar], [AS_HELP_STRING(--with-xerces2-jar,specify location of the xerces2 jar)], [ @@ -575,20 +588,27 @@ AC_DEFUN([FIND_NETBEANS], [ + AC_MSG_CHECKING([if the location of NetBeans is specified]) AC_ARG_WITH([netbeans], [AS_HELP_STRING(--with-netbeans,specify location of netbeans)], [ - if test -f "${withval}"; then - AC_MSG_CHECKING(netbeans) + if test "x${withval}" = "xyes"; then + NETBEANS=no + else NETBEANS="${withval}" - AC_MSG_RESULT(${withval}) - else - AC_PATH_PROG(NETBEANS, "${withval}") fi ], [ - NETBEANS= + NETBEANS=no ]) + AC_MSG_RESULT(${NETBEANS}) + if ! test -f "${NETBEANS}"; then + if test "x${NETBEANS}" = "xno"; then + NETBEANS= + else + AC_PATH_PROG(NETBEANS, "${NETBEANS}") + fi + fi if test -z "${NETBEANS}"; then AC_PATH_PROG(NETBEANS, "netbeans") fi @@ -600,7 +620,7 @@ AC_DEFUN([FIND_RHINO_JAR], [ - AC_MSG_CHECKING(whether to include Javascript support via Rhino) + AC_MSG_CHECKING([whether to include Javascript support via Rhino]) AC_ARG_WITH([rhino], [AS_HELP_STRING(--with-rhino,specify location of the rhino jar)], [ @@ -642,27 +662,26 @@ AC_SUBST(RHINO_JAR) ]) -AC_DEFUN([ENABLE_OPTIMIZATIONS], +AC_DEFUN([DISABLE_OPTIMIZATIONS], [ - AC_MSG_CHECKING(whether to disable optimizations) + AC_MSG_CHECKING([whether to disable optimizations and build with -O0 -g]) AC_ARG_ENABLE([optimizations], [AS_HELP_STRING(--disable-optimizations,build with -O0 -g [[default=no]])], [ case "${enableval}" in no) - AC_MSG_RESULT([yes, building with -O0 -g]) - enable_optimizations=no + disable_optimizations=yes ;; *) - AC_MSG_RESULT([no]) - enable_optimizations=yes + disable_optimizations=no ;; esac ], [ - enable_optimizations=yes + disable_optimizations=no ]) - AM_CONDITIONAL([ENABLE_OPTIMIZATIONS], test x"${enable_optimizations}" = "xyes") + AC_MSG_RESULT([$disable_optimizations]) + AM_CONDITIONAL([DISABLE_OPTIMIZATIONS], test x"${disable_optimizations}" = "xyes") ]) AC_DEFUN([FIND_TOOL], @@ -675,7 +694,7 @@ AC_DEFUN([ENABLE_ZERO_BUILD], [ - AC_MSG_CHECKING(whether to use the zero-assembler port) + AC_MSG_CHECKING([whether to use the zero-assembler port]) use_zero=no AC_ARG_ENABLE([zero], [AS_HELP_STRING(--enable-zero, @@ -805,7 +824,7 @@ AC_DEFUN([AC_CHECK_WITH_CACAO_HOME], [ - AC_MSG_CHECKING(for CACAO home directory) + AC_MSG_CHECKING([for a CACAO home directory]) AC_ARG_WITH([cacao-home], [AS_HELP_STRING([--with-cacao-home], [CACAO home directory [[default=/usr/local/cacao]]])], @@ -830,7 +849,7 @@ AC_DEFUN([AC_CHECK_WITH_CACAO_SRC_ZIP], [ - AC_MSG_CHECKING(for a CACAO source zip) + AC_MSG_CHECKING([for a CACAO source zip]) AC_ARG_WITH([cacao-src-zip], [AS_HELP_STRING(--with-cacao-src-zip,specify the location of the CACAO source zip)], [ @@ -847,7 +866,7 @@ AC_DEFUN([AC_CHECK_WITH_CACAO_SRC_DIR], [ - AC_MSG_CHECKING(for a Cacao source directory) + AC_MSG_CHECKING([for a CACAO source directory]) AC_ARG_WITH([cacao-src-dir], [AS_HELP_STRING(--with-cacao-src-dir,specify the location of the Cacao sources)], [ @@ -1060,7 +1079,7 @@ [ if test "x${withval}" = xno then - SYSTEM_OPENJDK_DIR= + SYSTEM_OPENJDK_DIR=no with_openjdk=false else SYSTEM_OPENJDK_DIR=${withval} @@ -1068,7 +1087,7 @@ fi ], [ - SYSTEM_OPENJDK_DIR= + SYSTEM_OPENJDK_DIR=no with_openjdk=false ]) if test "x${SYSTEM_OPENJDK_DIR}" = xyes; then @@ -1080,12 +1099,12 @@ break fi done - elif ! test -z "${SYSTEM_OPENJDK_DIR}"; then + elif ! test x"${SYSTEM_OPENJDK_DIR}" = xno; then if ! test -d "${SYSTEM_OPENJDK_DIR}"; then AC_MSG_ERROR("An OpenJDK home directory could not be found.") fi fi - AM_CONDITIONAL(WITH_OPENJDK, test "x${SYSTEM_OPENJDK_DIR}" != x) + AM_CONDITIONAL(WITH_OPENJDK, test "x${SYSTEM_OPENJDK_DIR}" != xno) AC_MSG_RESULT(${SYSTEM_OPENJDK_DIR}) AC_SUBST(SYSTEM_OPENJDK_DIR) AC_SUBST(with_openjdk) @@ -1122,6 +1141,51 @@ AC_CONFIG_FILES([tz.properties]) ]) +AC_DEFUN([IT_CHECK_ADDITIONAL_VMS], +AC_MSG_CHECKING([for additional virtual machines to build]) +AC_ARG_WITH(additional-vms, + AC_HELP_STRING([--with-additional-vms=vm-list], + [build additional virtual machines. Valid value is a comma separated string with the backend names `cacao', `zero' and `shark'.]), +[ +if test "x${withval}" != x +then + with_additional_vms=${withval} + for vm in `echo $with_additional_vms | sed 's/,/ /g'`; do + case "x$vm" in + xcacao) add_vm_cacao=yes;; + xzero) add_vm_zero=yes;; + xshark) add_vm_shark=yes;; + *) AC_MSG_ERROR([proper usage is --with-additional-vms=vm1,vm2,...]) + esac + done +fi]) +if test "x${with_additional_vms}" = x; then + with_additional_vms="none"; +fi +AC_MSG_RESULT($with_additional_vms) + +AM_CONDITIONAL(ADD_CACAO_BUILD, test x$add_vm_cacao != x) +AM_CONDITIONAL(ADD_ZERO_BUILD, test x$add_vm_zero != x || test x$add_vm_shark != x) +AM_CONDITIONAL(ADD_SHARK_BUILD, test x$add_vm_shark != x) +AM_CONDITIONAL(BUILD_CACAO, test x$add_vm_cacao != x || test "x${WITH_CACAO}" = xyes) + +if test "x${WITH_CACAO}" = xyes && test "x${ADD_CACAO_BUILD_TRUE}" = x; then + AC_MSG_ERROR([additional vm is the default vm]) +fi +if test "x${ZERO_BUILD_TRUE}" = x && test "x${ADD_ZERO_BUILD_TRUE}" = x && test "x${ADD_SHARK_BUILD_TRUE}" != x; then + AC_MSG_ERROR([additional vm is the default vm]) +fi +if test "x${SHARK_BUILD_TRUE}" = x && test "x${ADD_SHARK_BUILD_TRUE}" = x; then + AC_MSG_ERROR([additional vm is the default vm]) +fi +if test "x${USE_SYSTEM_CACAO_TRUE}" = x; then + AC_MSG_ERROR([cannot build with system cacao as additional vm]) +fi +if test "x${ADD_ZERO_BUILD_TRUE}" = x && test "x${abs_top_builddir}" = "x${abs_top_srcdir}"; then + AC_MSG_ERROR([build of additional zero/shark VM requires build with srcdir != builddir]) +fi +]) + dnl Generic macro to check for a Java class dnl Takes two arguments: the name of the macro dnl and the name of the class. The macro name @@ -1162,6 +1226,47 @@ AC_PROVIDE([$0])dnl ]) +# Finds number of available processors using sysconf +AC_DEFUN_ONCE([IT_FIND_NUMBER_OF_PROCESSORS],[ + FIND_TOOL([GETCONF], [getconf]) + AC_CACHE_CHECK([the number of online processors], it_cv_proc, [ + if number=$($GETCONF _NPROCESSORS_ONLN); then + it_cv_proc=$number; + else + it_cv_proc=2; + fi + ]) + AC_PROVIDE([$0])dnl +]) + +# Provides the option --with-parallel-jobs +# * --with-parallel-jobs; use jobs=processors + 1 +# * --with-parallel-jobs=x; use jobs=x +# * --without-parallel-jobs (default); use jobs=2 +AC_DEFUN_ONCE([IT_CHECK_NUMBER_OF_PARALLEL_JOBS], +[ +AC_REQUIRE([IT_FIND_NUMBER_OF_PROCESSORS]) +proc_default=$(($it_cv_proc + 1)) +AC_MSG_CHECKING([how many parallel build jobs to execute]) +AC_ARG_WITH([parallel-jobs], + [AS_HELP_STRING([--with-parallel-jobs], + [build IcedTea using the specified number of parallel jobs])], + [ + if test "x${withval}" = xyes; then + PARALLEL_JOBS=${proc_default} + elif test "x${withval}" = xno; then + PARALLEL_JOBS=2 + else + PARALLEL_JOBS=${withval} + fi + ], + [ + PARALLEL_JOBS=2 + ]) +AC_MSG_RESULT(${PARALLEL_JOBS}) +AC_SUBST(PARALLEL_JOBS) +]) + AC_DEFUN([IT_GET_LSB_DATA], [ if test -n "$LSB_RELEASE"; then
--- a/configure.ac Sat Jan 16 04:25:58 2010 +0000 +++ b/configure.ac Sat Jan 16 04:30:59 2010 +0000 @@ -48,6 +48,7 @@ AC_PATH_TOOL([LINUX32],[linux32]) AC_CHECK_GCC_VERSION AC_CHECK_FOR_OPENJDK +IT_CHECK_NUMBER_OF_PARALLEL_JOBS AC_MSG_CHECKING([for a NetBeans installation]) AC_ARG_WITH([netbeans-home], @@ -67,7 +68,7 @@ AC_MSG_RESULT([${SYSTEM_NETBEANS_DIR}]) AC_SUBST(SYSTEM_NETBEANS_DIR) -AC_MSG_CHECKING(for Ant home directory) +AC_MSG_CHECKING([for an Ant home directory]) AC_ARG_WITH([ant-home], [AS_HELP_STRING([--with-ant-home], [Ant home directory (default is /usr/share/ant)])], @@ -85,7 +86,7 @@ AC_SUBST(SYSTEM_ANT_DIR) AC_MSG_RESULT(${SYSTEM_ANT_DIR}) -AC_MSG_CHECKING(whether to build VisualVM) +AC_MSG_CHECKING([whether to build VisualVM]) AC_ARG_ENABLE([visualvm], [AS_HELP_STRING([--enable-visualvm], [Enable compilation of visualvm.])], @@ -117,7 +118,7 @@ AM_CONDITIONAL(ENABLE_PULSE_JAVA, test "x${enable_pulse_java}" = "xyes") AC_MSG_RESULT(${enable_pulse_java}) -AC_MSG_CHECKING(whether to build documentation) +AC_MSG_CHECKING([whether to build documentation]) AC_ARG_ENABLE([docs], [AS_HELP_STRING([--disable-docs], [Disable generation of documentation])], @@ -126,7 +127,7 @@ AC_MSG_RESULT(${ENABLE_DOCS}) # OpenJDK experimental cross-compilation support which is not yet complete -AC_MSG_CHECKING(whether to enable experimental OpenJDK cross-compilation support) +AC_MSG_CHECKING([whether to enable experimental OpenJDK cross-compilation support]) AC_ARG_ENABLE([openjdk-cross-compilation], [AS_HELP_STRING([--enable-openjdk-cross-compilation], [Enable experimental OpenJDK cross-compilation support])], @@ -134,7 +135,7 @@ AM_CONDITIONAL([ENABLE_CROSS_COMPILATION], [test x$ENABLE_CROSS_COMPILATION = xyes]) AC_MSG_RESULT(${ENABLE_CROSS_COMPILATION}) -AC_MSG_CHECKING(whether to include the XRender pipeline) +AC_MSG_CHECKING([whether to include the XRender pipeline]) AC_ARG_ENABLE([xrender], [AS_HELP_STRING([--disable-xrender], [Disable inclusion of xrender pipeline])], @@ -142,7 +143,7 @@ AM_CONDITIONAL([ENABLE_XRENDER], [test x$ENABLE_XRENDER = xyes]) AC_MSG_RESULT(${ENABLE_XRENDER}) -AC_MSG_CHECKING(whether to include NIO2 support) +AC_MSG_CHECKING([whether to include NIO2 support]) AC_ARG_ENABLE([nio2], [AS_HELP_STRING([--disable-nio2], [Disable inclusion of backported NIO2])], @@ -150,10 +151,10 @@ AM_CONDITIONAL([ENABLE_NIO2], [test x$ENABLE_NIO2 = xyes]) AC_MSG_RESULT(${ENABLE_NIO2}) -AC_MSG_CHECKING([whether to include systemtap tracing support]) +AC_MSG_CHECKING([whether to include SystemTap tracing support]) AC_ARG_ENABLE([systemtap], [AS_HELP_STRING([--enable-systemtap], - [Enable inclusion of systemtap trace support])], + [Enable inclusion of SystemTap trace support])], [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) @@ -166,24 +167,6 @@ AM_CONDITIONAL([ENABLE_NSS], [test x$ENABLE_NSS = xyes]) AC_MSG_RESULT(${ENABLE_NSS}) -AC_MSG_CHECKING(how many parallel build jobs to execute) -AC_ARG_WITH([parallel-jobs], - [AS_HELP_STRING([--with-parallel-jobs], - [build IcedTea using the specified number of parallel jobs])], - [ - if test "x${withval}" = x - then - PARALLEL_JOBS=2 - else - PARALLEL_JOBS=${withval} - fi - ], - [ - PARALLEL_JOBS=2 - ]) -AC_MSG_RESULT(${PARALLEL_JOBS}) -AC_SUBST(PARALLEL_JOBS) - AC_ARG_WITH([pkgversion], [AS_HELP_STRING([--with-pkgversion=PKG], [Use PKG in the version string in addition to "IcedTea"])], @@ -239,9 +222,10 @@ AC_CHECK_WITH_CACAO_HOME AC_CHECK_WITH_CACAO_SRC_ZIP AC_CHECK_WITH_CACAO_SRC_DIR -ENABLE_OPTIMIZATIONS +DISABLE_OPTIMIZATIONS SET_SHARK_BUILD ENABLE_ZERO_BUILD +IT_CHECK_ADDITIONAL_VMS ENABLE_HG AC_CHECK_WITH_HG_REVISION AC_CHECK_WITH_TZDATA_DIR @@ -253,7 +237,7 @@ FIND_NETBEANS fi -dnl pkgconfig cannot be used to finid these headers and libraries. +dnl pkgconfig cannot be used to find these headers and libraries. AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],[] ,[AC_MSG_ERROR("CUPS headers were not found - try installing cups-devel.")]) @@ -544,44 +528,6 @@ AC_CONFIG_FILES([nss.cfg]) fi -AC_MSG_CHECKING(for --with-additional-vms) -AC_ARG_WITH(additional-vms, - AC_HELP_STRING([--with-additional-vms=vm-list], [build additional virtual machines. Valid value is a comma separated string with the backend names `cacao', `zero' and `shark'.]), -[ -if test x$with_additional_vms != x -then - for vm in `echo $with_additional_vms | sed 's/,/ /g'`; do - case "x$vm" in - xcacao) add_vm_cacao=yes;; - xzero) add_vm_zero=yes;; - xshark) add_vm_shark=yes;; - *) AC_MSG_ERROR([proper usage is --with-additional-vms=vm1,vm2,...]) - esac - done -fi]) -AC_MSG_RESULT($with_additional_vms) - -AM_CONDITIONAL(ADD_CACAO_BUILD, test x$add_vm_cacao != x) -AM_CONDITIONAL(ADD_ZERO_BUILD, test x$add_vm_zero != x || test x$add_vm_shark != x) -AM_CONDITIONAL(ADD_SHARK_BUILD, test x$add_vm_shark != x) -AM_CONDITIONAL(BUILD_CACAO, test x$add_vm_cacao != x || test "x${WITH_CACAO}" = xyes) - -if test "x${WITH_CACAO}" = xyes && test "x${ADD_CACAO_BUILD_TRUE}" = x; then - AC_MSG_ERROR([additional vm is the default vm]) -fi -if test "x${ZERO_BUILD_TRUE}" = x && test "x${ADD_ZERO_BUILD_TRUE}" = x && test "x${ADD_SHARK_BUILD_TRUE}" != x; then - AC_MSG_ERROR([additional vm is the default vm]) -fi -if test "x${SHARK_BUILD_TRUE}" = x && test "x${ADD_SHARK_BUILD_TRUE}" = x; then - AC_MSG_ERROR([additional vm is the default vm]) -fi -if test "x${USE_SYSTEM_CACAO_TRUE}" = x; then - AC_MSG_ERROR([cannot build with system cacao as additional vm]) -fi -if test "x${ADD_ZERO_BUILD_TRUE}" = x && test "x${abs_top_builddir}" = "x${abs_top_srcdir}"; then - AC_MSG_ERROR([build of additional zero/shark VM requires build with srcdir != builddir]) -fi - if test "x${ZERO_BUILD_TRUE}" = x || test "x${ADD_ZERO_BUILD_TRUE}" = x; then dnl Check for libffi headers and libraries. PKG_CHECK_MODULES(LIBFFI, libffi,[LIBFFI_FOUND=yes],[LIBFFI_FOUND=no]) @@ -605,7 +551,7 @@ llvm_components="jit engine nativecodegen" LLVM_CFLAGS=`$LLVM_CONFIG --cxxflags $llvm_components | \ sed -e 's/-O.//g' | sed -e 's/-fomit-frame-pointer//g' | \ - sed -e 's/-D_DEBUG//g'` + sed -e 's/-pedantic//g' | sed -e 's/-D_DEBUG//g'` LLVM_CFLAGS="$LLVM_CFLAGS -DSHARK_LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/\.//;s/svn.*//'`" LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags $llvm_components` LLVM_LIBS=`$LLVM_CONFIG --libs $llvm_components`
--- a/hotspot.map Sat Jan 16 04:25:58 2010 +0000 +++ b/hotspot.map Sat Jan 16 04:30:59 2010 +0000 @@ -1,2 +1,2 @@ # version url changeset md5sum -hs16 http://hg.openjdk.java.net/hsx/hsx16/master 6bdfda9a7120 e194a7baefb2f55e21a280276a11b49a +hs16 http://hg.openjdk.java.net/hsx/hsx16/master 62926c7f67a3 d683eb501e7ce710198f20f0c127ebbb
--- a/patches/hotspot/hs16/icedtea-params-cast-size_t.patch Sat Jan 16 04:25:58 2010 +0000 +++ b/patches/hotspot/hs16/icedtea-params-cast-size_t.patch Sat Jan 16 04:30:59 2010 +0000 @@ -1,7 +1,7 @@ diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2009-10-20 22:59:56.000000000 +0100 -@@ -940,7 +940,7 @@ +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2010-01-11 20:57:36.000000000 +0000 +@@ -941,7 +941,7 @@ if (free_percentage < desired_free_percentage) { size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); assert(desired_capacity >= capacity(), "invalid expansion size"); @@ -10,7 +10,7 @@ } if (expand_bytes > 0) { if (PrintGCDetails && Verbose) { -@@ -6094,7 +6094,7 @@ +@@ -6095,7 +6095,7 @@ HeapWord* curAddr = _markBitMap.startWord(); while (curAddr < _markBitMap.endWord()) { size_t remaining = pointer_delta(_markBitMap.endWord(), curAddr); @@ -19,7 +19,7 @@ _markBitMap.clear_large_range(chunk); if (ConcurrentMarkSweepThread::should_yield() && !foregroundGCIsActive() && -@@ -6382,7 +6382,7 @@ +@@ -6383,7 +6383,7 @@ return; } // Double capacity if possible @@ -29,8 +29,8 @@ // get the double capacity that we desired. ReservedSpace rs(ReservedSpace::allocation_align_size_up( diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2009-10-20 22:57:45.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2009-10-20 22:59:56.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2010-01-11 20:48:22.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -412,7 +412,7 @@ _regionStack(), // _finger set in set_non_marking_state @@ -67,7 +67,7 @@ for (int i = 0; i < size; i++) delete _par_cleanup_thread_state[i]; FREE_C_HEAP_ARRAY(ParCleanupThreadState*, _par_cleanup_thread_state); -@@ -1761,7 +1761,7 @@ +@@ -1708,7 +1708,7 @@ if (has_aborted()) return; int first = 0; @@ -76,7 +76,7 @@ for (int t = 0; t < last; t++) { UncleanRegionList* list = &_par_cleanup_thread_state[t]->list; assert(list->well_formed(), "Inv"); -@@ -3197,7 +3197,7 @@ +@@ -3202,7 +3202,7 @@ // of things to do) or totally (at the very end). size_t target_size; if (partially) @@ -86,8 +86,8 @@ target_size = 0; diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2009-10-20 23:01:31.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -1058,7 +1058,7 @@ // This can be done by either mutator threads together with the // concurrent refinement threads or GC threads. @@ -98,8 +98,8 @@ HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2009-10-20 22:59:56.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -863,8 +863,8 @@ void PSParallelCompact::initialize_dead_wood_limiter() { @@ -112,8 +112,8 @@ DEBUG_ONLY(_dwl_initialized = true;) _dwl_adjustment = normal_distribution(1.0); diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp ---- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp 2009-10-20 22:59:56.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -63,7 +63,7 @@ _last_used = current_live; @@ -124,8 +124,8 @@ // Compute the desired size: diff -Nru openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp ---- openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp 2009-10-20 22:59:56.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -281,7 +281,7 @@ // yield a size that is too small) and bound it by MaxNewSize above. // Ergonomics plays here by previously calculating the desired @@ -198,8 +198,8 @@ } else { diff -Nru openjdk.orig/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp ---- openjdk.orig/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp 2009-10-02 22:16:39.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp 2009-10-20 22:59:56.000000000 +0100 +--- openjdk.orig/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp 2010-01-11 20:57:36.000000000 +0000 @@ -221,7 +221,7 @@ size_t init_sz; @@ -210,9 +210,9 @@ // Startup issue - main thread initialized before heap initialized. init_sz = min_size(); diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp ---- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp 2009-10-20 22:57:44.000000000 +0100 -+++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp 2009-10-20 23:02:17.000000000 +0100 -@@ -1064,7 +1064,7 @@ +--- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp 2010-01-11 20:48:21.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp 2010-01-11 20:59:44.000000000 +0000 +@@ -1071,7 +1071,7 @@ // NewSize was set on the command line and it is larger than // preferred_max_new_size. if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line @@ -221,7 +221,7 @@ } else { FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size); } -@@ -1083,7 +1083,7 @@ +@@ -1090,7 +1090,7 @@ // there was no obvious reason. Also limit to the case where // MaxNewSize has not been set. @@ -230,23 +230,23 @@ // Code along this path potentially sets NewSize and OldSize -@@ -1125,8 +1125,8 @@ +@@ -1132,8 +1132,8 @@ // Unless explicitly requested otherwise, make young gen // at least min_new, and at most preferred_max_new_size. if (FLAG_IS_DEFAULT(NewSize)) { - FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new)); - FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize)); -+ FLAG_SET_ERGO(uintx, NewSize, MAX2((size_t) NewSize, min_new)); ++ FLAG_SET_ERGO(uintx, NewSize, MAX2((size_t) NewSize, min_new)); + FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, (size_t) NewSize)); - if(PrintGCDetails && Verbose) { + if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("Ergo set NewSize: " SIZE_FORMAT, NewSize); -@@ -1137,7 +1137,7 @@ +@@ -1144,7 +1144,7 @@ // later NewRatio will decide how it grows; see above. if (FLAG_IS_DEFAULT(OldSize)) { if (max_heap > NewSize) { -- FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize)); -+ FLAG_SET_ERGO(uintx, OldSize, MIN2((size_t) (3*NewSize), max_heap - (size_t) NewSize)); - if(PrintGCDetails && Verbose) { +- FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize)); ++ FLAG_SET_ERGO(uintx, OldSize, MIN2((size_t) 3*NewSize, max_heap - (size_t) NewSize)); + if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("Ergo set OldSize: " SIZE_FORMAT, OldSize);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs16/memory-limits.patch Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,24 @@ +diff -Nru openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +--- openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2010-01-11 20:44:32.000000000 +0000 +@@ -95,7 +95,7 @@ + + // Heap related flags + define_pd_global(uintx,PermSize, ScaleForWordSize(16*M)); +-define_pd_global(uintx,MaxPermSize, ScaleForWordSize(64*M)); ++define_pd_global(uintx,MaxPermSize, ScaleForWordSize(128*M)); + + // Ergonomics related flags + define_pd_global(bool, NeverActAsServerClassMachine, false); +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp +--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp 2009-12-08 23:12:17.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2010-01-11 20:45:17.000000000 +0000 +@@ -2809,7 +2809,7 @@ + product(uintx, InitialHeapSize, 0, \ + "Initial heap size (in bytes); zero means OldSize + NewSize") \ + \ +- product(uintx, MaxHeapSize, ScaleForWordSize(96*M), \ ++ product(uintx, MaxHeapSize, ScaleForWordSize(512*M), \ + "Maximum heap size (in bytes)") \ + \ + product(uintx, OldSize, ScaleForWordSize(4*M), \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/hs16/shark.patch Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,9 @@ +--- openjdk.orig/hotspot/src/cpu//zero/vm/shark_globals_zero.hpp 2009-09-10 15:36:58.658607552 +0100 ++++ openjdk/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp 2010-01-13 14:57:16.000000000 +0000 +@@ -59,5 +59,5 @@ + define_pd_global(uintx, PermSize, 12*M ); + define_pd_global(uintx, MaxPermSize, 64*M ); + define_pd_global(bool, NeverActAsServerClassMachine, true ); +-define_pd_global(uintx, DefaultMaxRAM, 1*G ); ++define_pd_global(uint64_t,MaxRAM, 1ULL*G); + define_pd_global(bool, CICompileOSR, true );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/original/memory-limits.patch Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,23 @@ +diff -Nru openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +--- openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2008-05-23 22:30:44.000000000 +0100 ++++ openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2008-05-23 22:30:59.000000000 +0100 +@@ -98,7 +98,7 @@ + + // Heap related flags + define_pd_global(uintx, PermSize, ScaleForWordSize(16*M)); +-define_pd_global(uintx, MaxPermSize, ScaleForWordSize(64*M)); ++define_pd_global(uintx, MaxPermSize, ScaleForWordSize(128*M)); + + // Ergonomics related flags + define_pd_global(bool, NeverActAsServerClassMachine, false); +--- penjdk6/hotspot/src/share/vm/runtime/globals.hpp 2008-02-12 04:14:24.000000000 -0500 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2008-02-14 16:34:00.000000000 -0500 +@@ -2606,7 +2606,7 @@ + "an OS lock") \ + \ + /* gc parameters */ \ +- product(uintx, MaxHeapSize, ScaleForWordSize(64*M), \ ++ product(uintx, MaxHeapSize, ScaleForWordSize(512*M), \ + "Default maximum size for object heap (in bytes)") \ + \ + product_pd(uintx, NewSize, \
--- a/patches/icedtea-memory-limits.patch Sat Jan 16 04:25:58 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -diff -Nru openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp ---- openjdk.orig/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2008-05-23 22:30:44.000000000 +0100 -+++ openjdk/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp 2008-05-23 22:30:59.000000000 +0100 -@@ -98,7 +98,7 @@ - - // Heap related flags - define_pd_global(uintx, PermSize, ScaleForWordSize(16*M)); --define_pd_global(uintx, MaxPermSize, ScaleForWordSize(64*M)); -+define_pd_global(uintx, MaxPermSize, ScaleForWordSize(128*M)); - - // Ergonomics related flags - define_pd_global(bool, NeverActAsServerClassMachine, false); ---- penjdk6/hotspot/src/share/vm/runtime/globals.hpp 2008-02-12 04:14:24.000000000 -0500 -+++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2008-02-14 16:34:00.000000000 -0500 -@@ -2606,7 +2606,7 @@ - "an OS lock") \ - \ - /* gc parameters */ \ -- product(uintx, MaxHeapSize, ScaleForWordSize(64*M), \ -+ product(uintx, MaxHeapSize, ScaleForWordSize(512*M), \ - "Default maximum size for object heap (in bytes)") \ - \ - product_pd(uintx, NewSize, \
--- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Sat Jan 16 04:25:58 2010 +0000 +++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Sat Jan 16 04:30:59 2010 +0000 @@ -899,7 +899,7 @@ alreadyCreated = true; } else { - PLUGIN_DEBUG_0ARG("NPObject is not a Java object"); + PLUGIN_DEBUG_0ARG("NPObject is not a Java object\n"); NPIdentifier length_id = browser_functions.getstringidentifier("length"); // FIXME: We currently only handle <= 2 dim arrays. Do we really need more though?
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Sat Jan 16 04:25:58 2010 +0000 +++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc Sat Jan 16 04:30:59 2010 +0000 @@ -117,6 +117,8 @@ command == "SetMember" || command == "ToString" || command == "Call" || + command == "GetSlot" || + command == "SetSlot" || command == "Eval") { @@ -331,7 +333,14 @@ NPVariant* result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result); std::string result_variant_jniid = std::string(); - createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid); + + if (result_variant) + { + createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid); + } else + { + result_variant_jniid = "0"; + } IcedTeaPluginUtilities::constructMessagePrefix(0, &response); response += " JavaScriptCall "; @@ -408,11 +417,11 @@ PluginRequestProcessor::setMember(std::vector<std::string>* message_parts) { std::string propertyNameID; - std::string property_name = std::string(); std::string value = std::string(); NPP instance; NPVariant* member; + NPIdentifier property_identifier; JavaRequestProcessor java_request = JavaRequestProcessor(); JavaResultData* java_result; @@ -434,18 +443,23 @@ instance = IcedTeaPluginUtilities::getInstanceFromMemberPtr(member); - java_result = java_request.getString(propertyNameID); - - // the result we want is in result_string (assuming there was no error) - if (java_result->error_occurred) + if (message_parts->at(2) == "SetSlot") + { + property_identifier = browser_functions.getintidentifier(atoi(message_parts->at(4).c_str())); + } else { - printf("Unable to get member name for setMember. Error occurred: %s\n", java_result->error_msg); - //goto cleanup; + java_result = java_request.getString(propertyNameID); + + // the result we want is in result_string (assuming there was no error) + if (java_result->error_occurred) + { + printf("Unable to get member name for setMember. Error occurred: %s\n", java_result->error_msg); + //goto cleanup; + } + + property_identifier = browser_functions.getstringidentifier(java_result->return_string->c_str()); } - // Copy into local variable before disposing the object - property_name.append(*(java_result->return_string)); - AsyncCallThreadData thread_data = AsyncCallThreadData(); thread_data.result_ready = false; thread_data.parameters = std::vector<void*>(); @@ -453,7 +467,7 @@ thread_data.parameters.push_back(instance); thread_data.parameters.push_back(NPVARIANT_TO_OBJECT(*member)); - thread_data.parameters.push_back(&property_name); + thread_data.parameters.push_back(&property_identifier); thread_data.parameters.push_back(&value); #ifdef CHROMIUM_WORKAROUND @@ -505,6 +519,8 @@ std::string jsObjectConstructorID = std::string(); std::string response = std::string(); + NPIdentifier member_identifier; + int method_id; int instance_id; long reference; @@ -517,16 +533,23 @@ parent_ptr = (NPVariant*) (IcedTeaPluginUtilities::stringToJSID(message_parts->at(3))); member_id += message_parts->at(4); - /** Request data from Java **/ - - // make a new request for getString, to get the name of the identifier - java_result = java_request.getString(member_id); + /** Request data from Java if necessary **/ + if (message_parts->at(2) == "GetSlot") + { + member_identifier = browser_functions.getintidentifier(atoi(member_id.c_str())); + } else + { + // make a new request for getString, to get the name of the identifier + java_result = java_request.getString(member_id); - // the result we want is in result_string (assuming there was no error) - if (java_result->error_occurred) - { - printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg); - //goto cleanup; + // the result we want is in result_string (assuming there was no error) + if (java_result->error_occurred) + { + printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg); + //goto cleanup; + } + + member_identifier = browser_functions.getstringidentifier(java_result->return_string->c_str()); } /** Make an internal request for the main thread to handle, to get the member pointer **/ @@ -541,7 +564,7 @@ NPP instance = IcedTeaPluginUtilities::getInstanceFromMemberPtr(parent_ptr); thread_data.parameters.push_back(instance); thread_data.parameters.push_back(NPVARIANT_TO_OBJECT(*parent_ptr)); - thread_data.parameters.push_back(java_result->return_string); + thread_data.parameters.push_back(&member_identifier); #ifdef CHROMIUM_WORKAROUND // Workaround for chromium @@ -609,7 +632,12 @@ IcedTeaPluginUtilities::constructMessagePrefix(0, &response); - response.append(" JavaScriptGetMember "); + if (message_parts->at(2) == "GetSlot") + { + response.append(" JavaScriptGetMember "); + } else { + response.append(" JavaScriptGetSlot "); + } response.append(java_result->return_string->c_str()); plugin_to_java_bus->post(response.c_str()); @@ -678,6 +706,12 @@ pthread_mutex_lock(&syn_write_mutex); processor->sendMember(message_parts); pthread_mutex_unlock(&syn_write_mutex); + } else if (command == "SetSlot") + { + // write methods are synchronized + pthread_mutex_lock(&syn_write_mutex); + processor->setMember(message_parts); + pthread_mutex_unlock(&syn_write_mutex); } else { // Nothing matched @@ -704,27 +738,25 @@ void _setMember(void* data) { - std::string* property_name; std::string* value; std::string response = std::string(); NPP instance; NPVariant value_variant = NPVariant(); NPObject* member; - NPIdentifier property; + NPIdentifier* property; std::vector<void*> parameters = ((AsyncCallThreadData*) data)->parameters; instance = (NPP) parameters.at(0); member = (NPObject*) parameters.at(1); - property_name = (std::string*) parameters.at(2); + property = (NPIdentifier*) parameters.at(2); value = (std::string*) parameters.at(3); - PLUGIN_DEBUG_4ARG("Setting %s on instance %p, object %p to value %s\n", property_name->c_str(), instance, member, value->c_str()); + PLUGIN_DEBUG_4ARG("Setting %s on instance %p, object %p to value %s\n", browser_functions.utf8fromidentifier(*property), instance, member, value->c_str()); IcedTeaPluginUtilities::javaResultToNPVariant(instance, value, &value_variant); - property = browser_functions.getstringidentifier(property_name->c_str()); - ((AsyncCallThreadData*) data)->call_successful = browser_functions.setproperty(instance, member, property, &value_variant); + ((AsyncCallThreadData*) data)->call_successful = browser_functions.setproperty(instance, member, *property, &value_variant); IcedTeaPluginUtilities::constructMessagePrefix(0, &response); response.append(" JavaScriptSetMember "); @@ -737,31 +769,25 @@ void _getMember(void* data) { - std::string* member_name; - NPObject* parent_ptr; NPVariant* member_ptr = new NPVariant(); std::string member_ptr_str = std::string(); NPP instance; - NPIdentifier member_identifier; std::vector<void*> parameters = ((AsyncCallThreadData*) data)->parameters; instance = (NPP) parameters.at(0); parent_ptr = (NPObject*) parameters.at(1); - member_name = (std::string*) parameters.at(2); - - // Get the corresponding windowId - member_identifier = browser_functions.getstringidentifier(member_name->c_str()); + NPIdentifier* member_identifier = (NPIdentifier*) parameters.at(2); // Get the NPVariant corresponding to this member - PLUGIN_DEBUG_4ARG("Looking for %p %p %p (%s)\n", instance, parent_ptr, member_identifier,member_name->c_str()); + PLUGIN_DEBUG_4ARG("Looking for %p %p %p (%s)\n", instance, parent_ptr, member_identifier, browser_functions.utf8fromidentifier(*member_identifier)); - if (!browser_functions.hasproperty(instance, parent_ptr, member_identifier)) + if (!browser_functions.hasproperty(instance, parent_ptr, *member_identifier)) { - printf("%s not found!\n", member_name->c_str()); + printf("%s not found!\n", browser_functions.utf8fromidentifier(*member_identifier)); } - ((AsyncCallThreadData*) data)->call_successful = browser_functions.getproperty(instance, parent_ptr, member_identifier, member_ptr); + ((AsyncCallThreadData*) data)->call_successful = browser_functions.getproperty(instance, parent_ptr, *member_identifier, member_ptr); IcedTeaPluginUtilities::printNPVariant(*member_ptr);
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc Sat Jan 16 04:25:58 2010 +0000 +++ b/plugin/icedteanp/IcedTeaPluginUtils.cc Sat Jan 16 04:30:59 2010 +0000 @@ -815,14 +815,18 @@ NPVariant constructor_v = NPVariant(); NPIdentifier constructor_id = browser_functions.getstringidentifier("constructor"); browser_functions.getproperty(instance, object, constructor_id, &constructor_v); + IcedTeaPluginUtilities::printNPVariant(constructor_v); - IcedTeaPluginUtilities::printNPVariant(constructor_v); + // void constructor => not an array + if (NPVARIANT_IS_VOID(constructor_v)) + return false; NPObject* constructor = NPVARIANT_TO_OBJECT(constructor_v); NPVariant constructor_str; NPIdentifier toString = browser_functions.getstringidentifier("toString"); browser_functions.invoke(instance, constructor, toString, NULL, 0, &constructor_str); + IcedTeaPluginUtilities::printNPVariant(constructor_str); std::string constructor_name = std::string();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/DummyObject.java Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,15 @@ +public class DummyObject { + private String str; + + public DummyObject(String s) { + this.str = s; + } + + public void setStr(String s) { + this.str = s; + } + + public String toString() { + return str; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/OverloadTestHelper1.java Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,1 @@ +public class OverloadTestHelper1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/OverloadTestHelper2.java Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,1 @@ +public class OverloadTestHelper2 extends OverloadTestHelper1 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/OverloadTestHelper3.java Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,1 @@ +public class OverloadTestHelper3 extends OverloadTestHelper2 {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/PluginTest.java Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,699 @@ +import javax.swing.JApplet; +import java.awt.Graphics; +import java.awt.*; +import java.applet.*; +import java.awt.event.*; +import netscape.javascript.JSObject; +import java.lang.reflect.Array; + +public class PluginTest extends JApplet { + + public int i = 42; + public double d = 42.42; + public float f = 42.1F; + public long l = 4294967296L; + public boolean b = true; + public char c = '\u2323'; + public byte by = 43; + public String rs = "I'm a string!"; + public String ss = "𠁎〒£$ǣ€𝍖"; + public Object n = null; + public int[] ia = new int[5]; + + public Integer I = 24; + public Double D = 24.24; + public Float F = 24.124F; + public Long L = 6927694924L; + public Boolean B = false; + public Character C = '\u1526'; + public Byte By = 34; + public Double[] Da1 = new Double[10]; + public Double[] Da2 = null; + + public char[] ca = new char[3]; + public Character[] Ca = new Character[3]; + + public void setUpForGMTests() { + i = 42; + d = 42.42; + f = 42.1F; + l = 4294967296L; + b = true; + c = '\u2323'; + by = 43; + rs = "I'm a string!"; + ss = "𠁎〒£$ǣ€𝍖"; + n = null; + + I = 24; + D = 24.24; + F = 24.124F; + L = 6927694924L; + B = false; + C = '\u1526'; + By = 34; + + ia[4] = 1024; + Da1[9] = D; + } + + public void setUpForSMTests() { + i = 0; + d = 0.0; + f = 0F; + l = 0L; + b = false; + c = 'A'; + by = 0; + rs = ""; + ss = ""; + n = new String("non-null object"); + + I = 0; + D = 0.0; + F = 0F; + L = 0L; + B = false; + C = 'A'; + By = null; + + ia[4] = 0; + Da1[9] = D; + } + + /* + ***************************************** + * JS -> Java Parameter conversion tests * + ***************************************** + */ + public void setUpForReturnTests() { + i = 41; + d = 41.41; + f = 41.411F; + l = 4294967297L; + b = true; + c = '\u2329'; + by = 44; + rs = "I'm a string too!"; + ss = "𠁎〒£$ǣ€𝍖"; + n = null; + + I = 14; + D = 14.14; + F = 14.114F; + L = 6927694925L; + B = false; + C = '\u2417'; + By = 46; + } + + /* + ************************************** + * JS -> Java invocation return tests * + ************************************** + */ + + public int intReturnTest() { return i; } + + public double doubleReturnTest() { return d; } + + public float floatReturnTest() { return f; } + + public long longReturnTest() { return l; } + + public boolean booleanReturnTest() { return b; } + + public char charReturnTest() { return c; } + + public byte byteReturnTest() { return by; } + + public char[] charArrayReturnTest() { + ca[0] = '\u2410'; + ca[1] = '\u2411'; + ca[2] = '\u2412'; + return ca; + } + + public String regularStringReturnTest() { return rs; } + + public String specialStringReturnTest() { return ss; } + + public void voidReturnTest() { } + + public Object nullReturnTest() { return null; } + + public Integer IntegerReturnTest() { return I; } + + public Double DoubleReturnTest() { return D; } + public void DoubleSetTest(double set) { D = set; } + + public Float FloatReturnTest() { return F; } + + public Long LongReturnTest() { return L; } + + public Boolean BooleanReturnTest() { return B; } + + public Character CharacterReturnTest() { return C; } + + public Byte ByteReturnTest() { return By; } + + public Character[] CharacterArrayReturnTest() { + Ca[0] = '\u2350'; + Ca[1] = '\u2351'; + Ca[2] = '\u2352'; + return Ca; + } + + /* + ************************************** + * JS -> Java parameter passing tests * + ************************************** + */ + + public void setUpForParameterTests() { + i = 41; + d = 41.41; + f = 41.411F; + l = 4294967297L; + b = true; + c = '\u2329'; + by = 44; + rs = "I'm a string too!"; + ss = "𠁎〒£$ǣ€𝍖"; + n = null; + + I = 14; + D = 14.14; + F = 14.114F; + L = 6927694925L; + B = false; + C = '\u2417'; + By = 46; + } + + public String functioniParamTest(int i) { + String ret = Integer.toString(i); + return ret; + } + + public String functiondParamTest(double d) { + String ret = Double.toString(d); + return ret; + } + + public String functionfParamTest(float f) { + String ret = Float.toString(f); + return ret; + } + + public String functionlParamTest(long l) { + String ret = Long.toString(l); + return ret; + } + + public String functionbParamTest(boolean b) { + String ret = Boolean.toString(b); + return ret; + } + + public String functioncParamTest(char c) { + String ret = Character.toString(c); + return ret; + } + + public String functionbyParamTest(byte b) { + String ret = Byte.toString(b); + return ret; + } + + public String functioncaParamTest(char[] ca) { + + String ret = ""; + ret += ca[0]; + for (int i=1 ; i < ca.length; i++) { + ret += ":" + ca[i]; + } + + return ret; + } + + public String functionsiaParamTest(String[] s) { + + String ret = s[0]; + for (int i=1 ; i < s.length; i++) { + ret += ":" + s[i]; + } + + return ret; + } + + public String functionsParamTest(String s) { + return s + ":" + s.getClass().getName(); + } + + public String functionIParamTest(Integer p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionDParamTest(Double p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionFParamTest(Float p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionLParamTest(Long p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionBParamTest(Boolean p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionCParamTest(Character p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionBParamTest(Byte p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functionCaParamTest(Character p) { + String ret = p.toString() + ":" + p.getClass().getName(); + return ret; + } + + public String functioncomplexaParamTest(DummyObject[] ca) { + String ret = ca[0].toString(); + for (int i=1 ; i < ca.length; i++) { + ret += ":" + ca[i].toString(); + } + + return ret; + } + + /* + *********************************************** + * JS -> Java overload resolution plugin tests * + *********************************************** + */ + + /* Numeric type to the analogous Java primitive type */ + + public String foo_num_to_num(int p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":int"; } + + // int -> int is lower than: + // int to double + public String foo_num_to_num(long p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":long"; } + // int to String + public String foo_num_to_num(String p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + /* Null to any non-primitive type */ + public String foo_null_to_nonprim(Integer p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":Integer"; } + + // Null to non-prim is better than: + // null -> prim (not allowed) + public String foo_null_to_nonprim(int p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":int"; } + + + /* JSObject to JSObject */ + public String foo_jso_to_jso(JSObject p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":JSObject"; } + + // JSO -> JSO is better than: + // JSO -> String + public String foo_jso_to_jso(String p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + // JSO -> Java array + public String foo_jso_to_jso(String[] p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + // JSO -> Superclass (Object) + public String foo_jso_to_jso(Object p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + /* Class type to Class type where the types are equal */ + public String foo_ct_to_ct(OverloadTestHelper2 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + // CT -> CT is better than: + // CT -> Superclass + public String foo_ct_to_ct(OverloadTestHelper1 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + // CT->Subclass + public String foo_ct_to_ct(OverloadTestHelper3 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + + /* Numeric type to a different primitive type */ + public String foo_multiprim(double p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":double"; } + + // Num -> Diff. prim. is better than: + // Better than anything else.. using string as a dummy + public String foo_multiprim(String p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + + /* String to numeric */ + public String foo_strnum(double p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":double"; } + + // Str -> Num is better than: + // Anything else .. using OverloadTestHelper1 as a dummy + public String foo_strnum(OverloadTestHelper1 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + /* Class type to superclass type (with subclass passed) */ + public String foo_ct_to_sc(OverloadTestHelper1 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":OverloadTestHelper1"; } + + // CT -> Superclass is better than CT to String + public String foo_ct_to_sc(String p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + + /* Any Java value to String */ + public String foo_jv_to_str(String p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + // JV -> Str is better than anything else allowed + public String foo_jv_to_str(JSObject p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + + /* JSO to Array (lower cost) */ + public String foo_jso_to_array(int[] p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":int[]"; } + + // JSO to array is better than: + // something not possible + public String foo_jso_to_array(Integer p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + + /****** Not allowed resolutions *******/ + + /* null to primitive */ + public String foo_null_to_prim(int p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":int"; } + + /* JSObject to something else */ + public String foo_jso_to_somethingelse(OverloadTestHelper1 p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + /* Any other conversion not described ... e.g. sending non-array to array */ + public String foo_unsupported(Object[] p) { return (new Throwable()).getStackTrace()[0].getMethodName() + ":" + p.getClass().getName(); } + + /* + ****************************** + * JS -> Java type conversion * + ****************************** + */ + + public byte byte_type = 0; + public char char_type = 'A'; + public short short_type = 0; + public int int_type = 0; + public long long_type = 0L; + public float float_type = 0F; + public double double_type = 0.0; + public boolean boolean_type = false; + + public byte[] byte_array = null; + public char[] char_array = null; + public short[] short_array = null; + public int[] int_array = null; + public long[] long_array = null; + public float[] float_array = null; + public double[] double_array = null; + public char[][] char_array_array = null; + + public Byte Byte_type = null; + public Character Character_type = 'A'; + public Short Short_type = 0; + public Integer Integer_type = 0; + public Long Long_type = 0L; + public Float Float_type = 0F; + public Double Double_type = 0.0; + public String String_type = ""; + public Boolean Boolean_type = false; + public JSObject JSObject_type = null; + + public Byte[] Byte_array = null; + public Character[] Character_array = null; + public Short[] Short_array = null; + public Integer[] Integer_array = null; + public Long[] Long_array = null; + public Float[] Float_array = null; + public Double[] Double_array = null; + public String[] String_array = null; + public String[][] String_array_array = null; + + public Object Object_type = null; + + public String getArrayAsStr(Object array) { + int size = Array.getLength(array); + + String ret = ""; + for (int i=0; i < size; i++) { + ret += Array.get(array, i) == null ? "null" : Array.get(array, i).toString(); + ret += ","; + } + + if (ret.length() > 0) { + ret = ret.substring(0, ret.length()-1); + } + + return ret; + } + + /* + ************************** + ************************** + * Begin Java -> JS tests * + ************************** + ************************** + */ + + public DummyObject dummyObject = new DummyObject("DummyObject1"); + public Object value; + private JSObject window; + + /* + ************************* + * Java -> JS read tests * + ************************* + */ + + public boolean jjsReadIntTest() { + value = new Integer(window.getMember("intvar").toString()); + return ((Integer) value).equals(1); + } + + public boolean jjsReadDoubleTest() { + value = new Double(window.getMember("doublevar").toString()); + return ((Double) value).equals(1.1); + } + + public boolean jjsReadBooleanTest() { + value = new Boolean(window.getMember("boolvar").toString()); + return ((Boolean) value).equals(true); + } + + public boolean jjsReadStringTest() { + value = window.getMember("stringvar").toString(); + return ((String) value).equals("stringvar"); + } + + public boolean jjsReadObjectTest() { + value = window.getMember("objectvar").toString(); + return value.equals("DummyObject1"); + } + + public boolean jjsRead1DArrayTest() { + value = ((JSObject) window.getMember("arrayvar")).getSlot(1); + return value.toString().equals("100"); + } + + public boolean jjsRead2DArrayTest() { + value = ((JSObject) ((JSObject) window.getMember("arrayvar2")).getSlot(1)).getSlot(2); + return value.toString().equals("200"); + } + + /* + ************************** + * Java -> JS write tests * + ************************** + */ + + public void jjsSetIntTest() { + window.setMember("setvar", (int) 1); + } + + public void jjsSetIntegerTest() { + window.setMember("setvar", new Integer(2)); + } + + public void jjsSetdoubleTest() { + window.setMember("setvar", (double) 2.1); + } + + public void jjsSetDoubleTest() { + window.setMember("setvar", new Double(2.2)); + } + + public void jjsSetfloatTest() { + window.setMember("setvar", (float) 2.3); + } + + public void jjsSetFloatTest() { + window.setMember("setvar", new Float(2.4)); + } + + public void jjsSetshortTest() { + window.setMember("setvar", (short) 3); + } + + public void jjsSetShortTest() { + window.setMember("setvar", new Short((short) 4)); + } + + public void jjsSetlongTest() { + window.setMember("setvar", (long) 4294967296L); + } + + public void jjsSetLongTest() { + window.setMember("setvar", new Long(4294967297L)); + } + + public void jjsSetbyteTest() { + window.setMember("setvar", (byte) 5); + } + + public void jjsSetByteTest() { + window.setMember("setvar", new Byte((byte) 6)); + } + + public void jjsSetcharTest() { + window.setMember("setvar", (char) '\u2323'); + } + + public void jjsSetCharacterTest() { + window.setMember("setvar", new Character('\u2324')); + } + + public void jjsSetbooleanTest() { + window.setMember("setvar", (boolean) true); + } + + public void jjsSetBooleanTest() { + window.setMember("setvar", new Boolean(false)); + } + + public void jjsSetStringTest() { + window.setMember("setvar", "𠁎〒£$ǣ€𝍖"); + } + + public void jjsSetObjectTest() { + dummyObject = new DummyObject("DummyObject2"); + window.setMember("setvar", dummyObject); + } + + public void jjsSet1DArrayTest() { + ((JSObject) window.getMember("setvar")).setSlot(1, 100); + } + + public void jjsSet2DArrayTest() { + ((JSObject) ((JSObject) window.getMember("setvar")).getSlot(1)).setSlot(2, 200); + } + + /* + **************************************** + * Java -> JS call parameter conversion * + **************************************** + */ + + public String jjsCallParamTest(String type) { + + Object ret = new Object(); + + int i = 1; + double d = 1.1; + float f = 1.2F; + long l = 4294967296L; + short s = 2; + byte b = 3; + char c = '\u2323'; + boolean bl = true; + Integer I = 4; + Double D = 4.1; + Float F = 4.2F; + Long L = 4294967297L; + Short S = 5; + Byte B = 6; + Boolean Bl = false; + Character C = '\u2324'; + String str = "𠁎〒£$ǣ€𝍖"; + Object o = new DummyObject("d1"); + + String callParamTestFuncName = "JJSParameterTypeCallTest"; + + if (type.equals("int")) + ret = window.call(callParamTestFuncName, new Object[]{i}); + else if (type.equals("double")) + ret = window.call(callParamTestFuncName, new Object[]{d}); + else if (type.equals("float")) + ret = window.call(callParamTestFuncName, new Object[]{f}); + else if (type.equals("long")) + ret = window.call(callParamTestFuncName, new Object[]{l}); + else if (type.equals("short")) + ret = window.call(callParamTestFuncName, new Object[]{s}); + else if (type.equals("byte")) + ret = window.call(callParamTestFuncName, new Object[]{b}); + else if (type.equals("char")) + ret = window.call(callParamTestFuncName, new Object[]{c}); + else if (type.equals("boolean")) + ret = window.call(callParamTestFuncName, new Object[]{bl}); + else if (type.equals("java.lang.Integer")) + ret = window.call(callParamTestFuncName, new Object[]{I}); + else if (type.equals("java.lang.Double")) + ret = window.call(callParamTestFuncName, new Object[]{D}); + else if (type.equals("java.lang.Float")) + ret = window.call(callParamTestFuncName, new Object[]{F}); + else if (type.equals("java.lang.Long")) + ret = window.call(callParamTestFuncName, new Object[]{L}); + else if (type.equals("java.lang.Short")) + ret = window.call(callParamTestFuncName, new Object[]{S}); + else if (type.equals("java.lang.Byte")) + ret = window.call(callParamTestFuncName, new Object[]{B}); + else if (type.equals("java.lang.Boolean")) + ret = window.call(callParamTestFuncName, new Object[]{Bl}); + else if (type.equals("java.lang.Character")) + ret = window.call(callParamTestFuncName, new Object[]{C}); + else if (type.equals("java.lang.String")) + ret = window.call(callParamTestFuncName, new Object[]{str}); + else if (type.equals("PluginTest.Packages.DummyObject")) + ret = window.call(callParamTestFuncName, new Object[]{o}); + else + ret = "Unknown param type: " + type; + + return ret.toString(); + } + + /* + ******************************************* + * Java -> JS invocation return type tests * + ******************************************* + */ + + public String jjsReturnTypeTest(String type) { + + String returnTypeTestFuncName = "JJSReturnTypeCallTest"; + Object ret = window.call(returnTypeTestFuncName, new Object[]{type}); + + return ret.toString(); + } + + public void init() { + window = JSObject.getWindow(this); + //JSObject.getWindow(this).call("appletLoaded", new Object[]{}); + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/build Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,18 @@ +#!/bin/sh + +# change to dir with tests +cd `dirname $0` + +JAVAC=javac +JAR=jar + +if [ ! -z $JAVA_HOME ]; then + JAVAC=$JAVA_HOME/bin/javac + JAVAC=$JAVA_HOME/bin/jar +fi + +$JAVAC PluginTest.java DummyObject.java OverloadTestHelper*java +$JAR cf PluginTest.jar PluginTest.class DummyObject.class OverloadTestHelper*class +rm -f *class + +echo "Done. Now launch \"firefox file://`pwd`/index.html\""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/common.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,215 @@ +/* + * Commonly used functions + */ + + var cell, cellText; // reused + + function updateTotals() { + document.getElementById("totals").innerHTML = "<table class=\"results\" width=\"100%\"><tr><th>Total tests run </th><th> Passed </th><th> Failed </th><th> Errors </th></tr>" + + "<tr><td>" + (passed+failed+errored) + " </td><td> " + passed + " </td><td> " + failed + " </td><td> " + errored + " </td></tr>"; + } + + function pass(row) { + cell = document.createElement("td"); + cell.setAttribute("style","color:green;text-align:center;font-weight: bold"); + cellText = document.createTextNode("passed"); + cell.appendChild(cellText); + row.appendChild(cell); + + passed++; + updateTotals(); + } + + function fail(row, reason) { + cell = document.createElement("td"); + cell.setAttribute("style","color:red;text-align:center;font-weight: bold"); + if (reason) + cellText = document.createTextNode(reason); + else + cellText = document.createTextNode("failed"); + cell.appendChild(cellText); + row.appendChild(cell); + + failed++; + updateTotals(); + } + + function error(type, expected, e, row) { + + cell = document.createElement("td"); + cell.setAttribute("style","color:red;text-align:center;font-weight: bold"); + cell.setAttribute("colspan","5"); + cellText = document.createTextNode("An error occurred when running this test: " + e); + cell.appendChild(cellText); + row.appendChild(cell); + + errored++; + updateTotals(); + } + + function check(actual, expected, expectedtype, row) { + if (actual == expected) { + if (typeof(actual) == expectedtype) { + pass(row); + } else { + fail(row, "Type mismatch: " + typeof(actual) + " != " + expectedtype); + } + } else { + fail(row, "Failed: " + actual + " [" + typeof(actual) + "] != " + expected + " [" + typeof(expected) + "]"); + } + } + + function doTest() { + + passed = 0; + failed = 0; + errored = 0; + document.getElementById("results").innerHTML = ""; + updateTotals(); + + try { + if (document.getElementById("testForm").jsjget.checked == 1) + getMemberTests(); + + if (document.getElementById("testForm").jsjset.checked == 1) + setMemberTests(); + + if (document.getElementById("testForm").jsjfp.checked == 1) + fpCallTests(); + + if (document.getElementById("testForm").jsjfrt.checked == 1) + rtCallTests(); + + if (document.getElementById("testForm").jsjfr.checked == 1) + frCallTests(); + + if (document.getElementById("testForm").jsjtc.checked == 1) + typeCastingTests(); + + if (document.getElementById("testForm").jjsget.checked == 1) + jjsGetMemberTests(); + + if (document.getElementById("testForm").jjsset.checked == 1) + jjsSetMemberTests(); + + if (document.getElementById("testForm").jjcparam.checked == 1) + jjsCallParameterTests(); + + if (document.getElementById("testForm").jjcrt.checked == 1) + jjsCallReturnTypeTests(); + } catch (e) { + document.getElementById("results").innerHTML += "<font color=\"red\">ERROR:<BR>" + e; + } + } + + function testAll() { + document.getElementById("testForm").jsjget.checked = 1; + document.getElementById("testForm").jsjset.checked = 1; + document.getElementById("testForm").jsjfp.checked = 1; + document.getElementById("testForm").jsjfrt.checked = 1; + document.getElementById("testForm").jsjfr.checked = 1; + document.getElementById("testForm").jsjtc.checked = 1; + document.getElementById("testForm").jjsget.checked = 1; + document.getElementById("testForm").jjsset.checked = 1; + document.getElementById("testForm").jjcparam.checked = 1; + document.getElementById("testForm").jjcrt.checked = 1; + + doTest(); + } + + +var intvar; +var doublevar; +var boolvar; +var stringvar; +var objectvar; +var arrayvar; +var arrayvar2; +var setvar; + +function initVars() { + intvar = 1; + doublevar = 1.1; + boolvar = true; + stringvar = "stringvar"; + objectvar = new PluginTest.Packages.DummyObject("DummyObject1"); + arrayvar = new Array(); + arrayvar[1] = 100; + + arrayvar2 = new Array(); + arrayvar2[1] = new Array(); + arrayvar2[1][2] = 200; +} + +function createResultTable(tbl, tblBody, columnNames) { + tbl.setAttribute("border", "5"); + tbl.setAttribute("width", "100%"); + tbl.setAttribute("class", "results"); + row = document.createElement("tr"); + + for (var i=0; i < columnNames.length; i++) { + cell = document.createElement("th"); + cellText = document.createTextNode(columnNames[i]); + cell.appendChild(cellText); + row.appendChild(cell); + } + + tblBody.appendChild(row); + tbl.appendChild(tblBody); + document.getElementById("results").appendChild(tbl); +} + +function addResult() { + + var row = arguments[arguments.length-1]; + + // Different length arguments imply different width distributions + + if (arguments.length == 4) { + + cell = document.createElement("td"); + cell.setAttribute("width","25%"); + cellText = document.createTextNode(arguments[0]); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(arguments[1]); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","40%"); + cellText = document.createTextNode(arguments[2]); + cell.appendChild(cellText); + row.appendChild(cell); + + } else if (arguments.length == 5) { + + cell = document.createElement("td"); + cell.setAttribute("width","25%"); + cellText = document.createTextNode(arguments[0]); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(arguments[1]); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(arguments[2]); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(arguments[3]); + cell.appendChild(cellText); + row.appendChild(cell); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/index.html Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,89 @@ +<HTML> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + +<HEAD> + + <style type="text/css"> + table.results { + background-color: white; + border-collapse: collapse; + border-color: black black black black; + border-spacing: 0px; + border-style: outset outset outset outset; + border-width: 0px 0px 0px 0px; + } + + table.results th { + background-color: white; + border-style: inset inset inset inset; + border-color: gray gray gray gray; + border-width: 1px 1px 1px 1px; + padding: 1px 1px 1px 1px; + } + + table.results td { + background-color: white; + border-color: gray gray gray gray; + border-style: inset inset inset inset; + border-width: 1px 1px 1px 1px; + padding: 2px 2px 2px 2px; + } + + </style> + + <!-- Load all tests scripts --> + <script language="JavaScript" src="common.js"></script> + <script language="JavaScript" src="jsj_get_tests.js"></script> + <script language="JavaScript" src="jsj_set_tests.js"></script> + <script language="JavaScript" src="jsj_func_rettype_tests.js"></script> + <script language="JavaScript" src="jsj_func_parameters_tests.js"></script> + <script language="JavaScript" src="jsj_func_overload_tests.js"></script> + <script language="JavaScript" src="jsj_type_conversion_tests.js"></script> + <script language="JavaScript" src="jjs_tests.js"></script> + <script language="JavaScript" src="jjs_get_tests.js"></script> + <script language="JavaScript" src="jjs_set_tests.js"></script> + <script language="JavaScript" src="jjs_func_rettype_tests.js"></script> + <script language="JavaScript" src="jjs_func_parameters_tests.js"></script> + +</HEAD> + +<BODY> + +<!-- Test selection/launch input --> +<form id="testForm"> + <table STYLE="width:100%; float:static"> + <tr> + <td> + <input type=checkbox name="jsjget"><tt>JS -> Java read tests</tt><BR> + <input type=checkbox name="jsjset"><tt>JS -> Java set tests</tt><BR> + <input type=checkbox name="jsjfp"><tt>JS -> Java function parameter conversion tests</tt><BR> + <input type=checkbox name="jsjfrt"><tt>JS -> Java function return type tests</tt><BR> + <input type=checkbox name="jsjfr"><tt>JS -> Java function resolution tests</tt><BR> + </td> + <td> + <input type=checkbox name="jsjtc"><tt>JS -> Java type conversion tests</tt><BR> + <input type=checkbox name="jjsget"><tt>Java -> JS read tests</tt><BR> + <input type=checkbox name="jjsset"><tt>Java -> JS set tests</tt><BR> + <input type=checkbox name="jjcparam"><tt>Java -> JS function parameter conversion tests</tt><BR> + <input type=checkbox name="jjcrt"><tt>Java -> JS function return type tests</tt><BR> + </td> + </tr> + <tr> + <td> + <input type=button id="run_selected" value="Run selected tests" onclick="doTest();"> + <input type=button id= "run_all" value="Run all tests" onclick="testAll();"> + </td> + </tr> + </table> +</form> + +<!-- Results --> +<DIV ID="RESULTS"> + <DIV ID="totals" STYLE="width:100%; float:static"></DIV> + <DIV ID="results" STYLE="width:100%; float:static"></DIV> +</DIV> + +<APPLET CODE="PluginTest.class" ARCHIVE="PluginTest.jar" NAME="PluginTest" WIDTH="0" HEIGHT=0 MAYSCRIPT></APPLET><BR> + +</BODY> +</HTML>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jjs_func_parameters_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,107 @@ +/****************************************************** + * Tests for parameter conversion between Java and JS * + ******************************************************/ + +function JJSParameterTypeCallTest(type_parameter) { + return type_parameter + ":" + typeof(type_parameter); +} + +function runSingleJjsCallParameterTest(type, control_arg, row) { + try { + expectedvalue = JJSParameterTypeCallTest(control_arg); + actualvalue = PluginTest.jjsCallParamTest(type); + addResult(type, expectedvalue, actualvalue, row); + check(actualvalue, expectedvalue, "string", row); + } catch (e) { + error(type, "", e, row); + } +} + +function jjsCallParameterTests() { + + document.getElementById("results").innerHTML += "<h2>Java -> JS Call tests (Parameter Type):</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Parameter Type (Java side)"; + columnNames[1] = "Expecting Java to receive"; + columnNames[2] = "Java Received"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("int", 1, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("double", 1.1, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("float", 1.2000000476837158, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("long", 4294967296, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("short", 2, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("byte", 3, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("char", 8995, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("boolean", true, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Integer", 4, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Double", 4.1, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Float", 4.199999809265137, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Long", 4294967297, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Short", 5, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Byte", 6, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Boolean", false, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.Character", 8996, row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("java.lang.String", "𠁎〒£$ǣ€𝍖", row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJjsCallParameterTest("PluginTest.Packages.DummyObject", (new PluginTest.Packages.DummyObject("d1")), row); + tblBody.appendChild(row); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jjs_func_rettype_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,61 @@ +/****************************************************** + * Tests for parameter conversion between Java and JS * + ******************************************************/ + +function JJSReturnTypeCallTest(type) { + + if (type == "Number") + return 1; + + if (type == "Boolean") + return false; + + if (type == "String") + return "𠁎〒£$ǣ€𝍖"; + + if (type == "Object") + return window; +} + +function runSingleJJSReturnTypeTest(type, row) { + try { + expectedvalue = JJSReturnTypeCallTest(type); + actualvalue = PluginTest.jjsReturnTypeTest(type); + addResult(type, expectedvalue, actualvalue, row); + check(actualvalue, expectedvalue + "", "string", row); + } catch (e) { + error(type, "", e, row); + } +} + +function jjsCallReturnTypeTests() { + + document.getElementById("results").innerHTML += "<h2>Java -> JS Call tests (Return Type):</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Parameter Type (Java side)"; + columnNames[1] = "Expected return value"; + columnNames[2] = "Actual return value"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + row = document.createElement("tr"); + runSingleJJSReturnTypeTest("Number", row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJJSReturnTypeTest("Boolean", row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJJSReturnTypeTest("String", row); + tblBody.appendChild(row); + + row = document.createElement("tr"); + runSingleJJSReturnTypeTest("Object", row); + tblBody.appendChild(row); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jjs_get_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,114 @@ +/***************************************** + * Tests for reading JS values from Java * + *****************************************/ + +function jjsGetMemberTests() { + + initVars(); + + document.getElementById("results").innerHTML += "<h2>JS -> Java get tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Member Type"; + columnNames[1] = "Expected Value"; + columnNames[2] = "Actual value"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + try { + row = document.createElement("tr"); + type = "int"; + expectedvalue = intvar; + tpassed = PluginTest.jjsReadIntTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + expectedvalue = doublevar; + tpassed = PluginTest.jjsReadDoubleTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + expectedvalue = boolvar; + tpassed = PluginTest.jjsReadBooleanTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "string"; + expectedvalue = stringvar; + tpassed = PluginTest.jjsReadStringTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "object"; + expectedvalue = objectvar; + tpassed = PluginTest.jjsReadObjectTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "1D Array"; + expectedvalue = 100; + tpassed = PluginTest.jjsRead1DArrayTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "2D Array"; + expectedvalue = 200; + tpassed = PluginTest.jjsRead2DArrayTest(); + actualValue = PluginTest.value; + addResult(type, expectedvalue, PluginTest.value, row); + check(tpassed, true, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); return; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jjs_set_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,314 @@ +/***************************************** + * Tests for setting JS values from Java * + *****************************************/ + +function jjsSetMemberTests() { + + initVars(); + + document.getElementById("results").innerHTML += "<h2>JS -> Java set tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Java Member Type"; + columnNames[1] = "Old Value"; + columnNames[2] = "Expected value"; + columnNames[3] = "Actual Value"; + columnNames[4] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + try { + row = document.createElement("tr"); + type = "int"; + oldvalue = setvar; + PluginTest.jjsSetIntTest(); + expectedvalue = 1; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "java.lang.Integer"; + oldvalue = setvar; + PluginTest.jjsSetIntegerTest(); + expectedvalue = 2; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + oldvalue = setvar; + PluginTest.jjsSetdoubleTest(); + expectedvalue = 2.1; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "java.lang.Double"; + oldvalue = setvar; + PluginTest.jjsSetDoubleTest(); + expectedvalue = 2.2; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "float"; + oldvalue = setvar; + PluginTest.jjsSetfloatTest(); + expectedvalue = 2.299999952316284 ; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Float"; + oldvalue = setvar; + PluginTest.jjsSetFloatTest(); + expectedvalue = 2.4000000953674316; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "long"; + oldvalue = setvar; + PluginTest.jjsSetlongTest(); + expectedvalue = 4294967296; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Long"; + oldvalue = setvar; + PluginTest.jjsSetLongTest(); + expectedvalue = 4294967297; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "short"; + oldvalue = setvar; + PluginTest.jjsSetshortTest(); + expectedvalue = 3; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Short"; + oldvalue = setvar; + PluginTest.jjsSetShortTest(); + expectedvalue = 4; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "byte"; + oldvalue = setvar; + PluginTest.jjsSetbyteTest(); + expectedvalue = 5; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Byte"; + oldvalue = setvar; + PluginTest.jjsSetByteTest(); + expectedvalue = 6; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char"; + oldvalue = setvar; + PluginTest.jjsSetcharTest(); + expectedvalue = 8995; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Character"; + oldvalue = setvar; + PluginTest.jjsSetCharacterTest(); + expectedvalue = 8996; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + oldvalue = setvar; + PluginTest.jjsSetbooleanTest(); + expectedvalue = true; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "java.lang.Boolean"; + oldvalue = setvar; + PluginTest.jjsSetBooleanTest(); + expectedvalue = false; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "boolean", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "java.lang.String"; + oldvalue = setvar; + PluginTest.jjsSetStringTest(); + expectedvalue = "𠁎〒£$ǣ€𝍖"; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "string", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "(Complex java object)"; + oldvalue = setvar; + PluginTest.jjsSetObjectTest(); + expectedvalue = PluginTest.dummyObject; + addResult(type, oldvalue, expectedvalue, setvar, row); + check(setvar, expectedvalue, "object", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "1D Array"; + setvar = new Array(); + oldvalue = setvar[1]; + PluginTest.jjsSet1DArrayTest(); + expectedvalue = 100; + addResult(type, oldvalue, expectedvalue, setvar[1], row); + check(setvar[1], expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "2D Array"; + setvar = new Array(); + setvar[1] = new Array(); + oldvalue = setvar[1][2]; + PluginTest.jjsSet2DArrayTest(); + expectedvalue = 200; + addResult(type, oldvalue, expectedvalue, setvar[1][2], row); + check(setvar[1][2], expectedvalue, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); +} + +function java_to_js_call_test_info (type, expectedreply, functionreply, row) { + + cell = document.createElement("td"); + cell.setAttribute("width","25%"); + cellText = document.createTextNode(type); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(expectedreply); + cell.appendChild(cellText); + row.appendChild(cell); + + cell = document.createElement("td"); + cell.setAttribute("width","20%"); + cellText = document.createTextNode(functionreply); + cell.appendChild(cellText); + row.appendChild(cell); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_func_overload_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,181 @@ + /************************************************************** + * Tests for overloaded function resolution when calling Java * + * functions from JS * + **************************************************************/ + +function frCallTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java Call tests [Overload and casting]:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Available functions"; + columnNames[1] = "Expected reply"; + columnNames[2] = "Reply"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + try { + row = document.createElement("tr"); + fname = "foo_null_to_nonprim"; + available = fname + " [(Integer), (int)]"; + expectedreply = fname + ":Integer"; + reply = PluginTest.foo_null_to_nonprim(null); + addResult(available, expectedreply, reply, row); + check(fname + ":Integer", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_jso_to_jso"; + available = fname + " [(JSObject), (String), (String[]), (Object)]"; + expectedreply = fname + ":JSObject"; + reply = PluginTest.foo_jso_to_jso(window); + addResult(available, expectedreply, reply, row); + check(fname + ":JSObject", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_ct_to_ct"; + available = fname + " [(OverloadTestHelper1), (OverloadTestHelper2), (OverloadTestHelper3)]"; + expectedreply = fname + ":OverloadTestHelper2"; + reply = PluginTest.foo_ct_to_ct(new PluginTest.Packages.OverloadTestHelper2()); + addResult(available, expectedreply, reply, row); + check(fname + ":OverloadTestHelper2", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_multiprim"; + available = fname + " [(double), (String)]"; + expectedreply = fname + ":double"; + reply = PluginTest.foo_multiprim(1.1); + addResult(available, expectedreply, reply, row); + check(fname + ":double", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_multiprim"; + available = fname + " [(double), (String)]"; + expectedreply = fname + ":double"; + reply = PluginTest.foo_multiprim(1.1); + addResult(available, expectedreply, reply, row); + check(fname + ":double", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_strnum"; + available = fname + " [(double), (OverloadTestHelper1)]"; + expectedreply = fname + ":double"; + reply = PluginTest.foo_strnum(1.1); + addResult(available, expectedreply, reply, row); + check(fname + ":double", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_ct_to_sc"; + available = fname + " [(OverloadTestHelper1), (String)]"; + expectedreply = fname + ":double"; + reply = PluginTest.foo_ct_to_sc(new PluginTest.Packages.OverloadTestHelper2()); + addResult(available, expectedreply, reply, row); + check(fname + ":OverloadTestHelper1", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_jv_to_str"; + available = fname + " [(String), (JSObject)]"; + expectedreply = fname + ":String"; + reply = PluginTest.foo_jv_to_str(new PluginTest.Packages.OverloadTestHelper1()); + addResult(available, expectedreply, reply, row); + check(fname + ":java.lang.String", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + fname = "foo_jso_to_array"; + available = fname + " [(int[]), (Integer), (Integer[])]"; + expectedreply = fname + ":int[]"; + arr = new Array(); + arr[0] = 10; + reply = PluginTest.foo_jso_to_array(arr); + addResult(available, expectedreply, reply, row); + check(fname + ":int[]", reply, "string", row); + } catch (e) { + error(null, null, e, row); + } + tblBody.appendChild(row); + + // Tests where exceptions are expected + fname = "foo_null_to_prim"; + available = fname + " [(int)] -- Not allowed"; + + try { + row = document.createElement("tr"); + expectedreply = null; + reply = PluginTest.foo_null_to_prim(null); + fail(row, "An exception was expected. Instead, got reply: " + reply); + } catch (e) { + addResult(available, "[An exception]", e.toString(), row); + pass(row); + } + tblBody.appendChild(row); + fname = "foo_jso_to_somethingelse"; + available = fname + " [(OverloadTestHelper1)] -- Not allowed"; + + try { + row = document.createElement("tr"); + expectedreply = null; + reply = PluginTest.foo_jso_to_somethingelse(window); + fail(row, "An exception was expected. Instead, got reply: " + reply); + } catch (e) { + addResult(available, "[An exception]", e.toString(), row); + pass(row); + } + tblBody.appendChild(row); + fname = "foo_unsupported"; + available = fname + " [(Object[] p)] -- Not allowed"; + try { + row = document.createElement("tr"); + expectedreply = null; + reply = PluginTest.foo_unsupported(25); + fail(row, "An exception was expected. Instead, got reply: " + reply); + } catch (e) { + addResult(available, "[An exception]", e.toString(), row); + pass(row); + } + + tblBody.appendChild(row); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_func_parameters_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,216 @@ + /******************************************************************** + * Tests for function parameter coversion when calling Java from JS * + ********************************************************************/ + +function fpCallTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java Call tests [Parameter type]:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Parameter type"; + columnNames[1] = "Sending"; + columnNames[2] = "Expected reply"; + columnNames[3] = "Reply"; + columnNames[4] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + PluginTest.setUpForReturnTests(); + + try { + row = document.createElement("tr"); + type = "int"; + send = 1; + reply = PluginTest.functioniParamTest(send); + addResult(type, send, send, reply, row); + check(send, reply, "number", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + send = 1.1; + reply = PluginTest.functiondParamTest(send); + addResult(type, send, send, reply, row); + check(send, reply, "number", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "float"; + send = 1.11; + reply = PluginTest.functionfParamTest(send); + addResult(type, send, send, reply, row); + check(send, reply, "number", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "long"; + send = 4294967300; + reply = PluginTest.functionlParamTest(send); + addResult(type, send, send, reply, row); + check(send, reply, "number", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + send = true; + reply = PluginTest.functionbParamTest(send); + addResult(type, send, send, reply, row); + check("true", reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char"; + send = 75; + reply = PluginTest.functioncParamTest(send); + addResult(type, send, "K", reply, row); + check("K", reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "byte"; + send = 76; + reply = PluginTest.functionbyParamTest(send); + addResult(type, send, send, reply, row); + check(send, reply, "number", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char[] (simple primitive)"; + arr = new Array(); + arr[0] = 80; + arr[1] = 81; + reply = PluginTest.functioncaParamTest(arr); + addResult(type, "[80,81]", "P:Q", reply, row); + check(reply, "P:Q", "string", row); + } catch (e) { + error(type, "P:Q", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String"; + send = "$〒£€𝍖𠁎ǣ"; + expectedreply = "$〒£€𝍖𠁎ǣ:java.lang.String"; + reply = PluginTest.functionsParamTest(send); + addResult(type, send, expectedreply, reply, row); + check(expectedreply, reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Integer"; + send = "32"; + expectedreply = send+":java.lang.Integer"; + reply = PluginTest.functionIParamTest(send); + addResult(type, send, expectedreply, reply, row); + check(expectedreply, reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double"; + send = 32.0; + expectedreply = "32.0:java.lang.Double"; + reply = PluginTest.functionDParamTest(send); + addResult(type, send, expectedreply, reply, row); + check(expectedreply, reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Float"; + send = 32.01; + expectedreply = send+":java.lang.Float"; + reply = PluginTest.functionFParamTest(send); + addResult(type, send, expectedreply, reply, row); + check(expectedreply, reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Long"; + send = 4294967301; + expectedreply = send+":java.lang.Long"; + reply = PluginTest.functionLParamTest(send); + addResult(type, send, expectedreply, reply, row); + check(expectedreply, reply, "string", row); + } catch (e) { + error(type, send, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "String/Int [] (mixed)"; + arr = new Array(); + arr[0] = "s1"; + arr[1] = 42; + reply = PluginTest.functionsiaParamTest(arr); + addResult(type, "[s1,42]", "s1:42", reply, row); + check(reply, "s1:42", "string", row); + } catch (e) { + error(type, "s1:42", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "DummyObject[] (complex)"; + arr = new Array(); + arr[0] = new PluginTest.Packages.DummyObject("DummyObject1"); + arr[1] = new PluginTest.Packages.DummyObject("DummyObject2"); + reply = PluginTest.functioncomplexaParamTest(arr); + addResult(type, "[DummyObject1,DummyObjec2]", "DummyObject1:DummyObject2", reply, row); + check(reply, "DummyObject1:DummyObject2", "string", row); + } catch (e) { + error(type, "DummyObject1:DummyObject2", e, row); + } + + tblBody.appendChild(row); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_func_rettype_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,262 @@ +/*********************************************************************** + * Tests to process various return types from Java side function calls * + ***********************************************************************/ + +function rtCallTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java Call tests [Return Type]:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Function return type"; + columnNames[1] = "Expected Value"; + columnNames[2] = "Actual Value"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + PluginTest.setUpForParameterTests(); + + try { + row = document.createElement("tr"); + type = "int"; + expectedvalue = 41; + addResult(type, expectedvalue, PluginTest.intReturnTest(), row); + check(PluginTest.intReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + expectedvalue = 41.41; + addResult(type, expectedvalue, PluginTest.doubleReturnTest(), row); + check(PluginTest.doubleReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "float"; + expectedvalue = 41.4109992980957; + addResult(type, expectedvalue, PluginTest.floatReturnTest(), row); + check(PluginTest.floatReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "long"; + expectedvalue = 4294967297; + addResult(type, expectedvalue, PluginTest.longReturnTest(), row); + check(PluginTest.longReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + expectedvalue = true; + addResult(type, expectedvalue, PluginTest.booleanReturnTest(), row); + check(PluginTest.booleanReturnTest(), expectedvalue, "boolean", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char"; + expectedvalue = 9001; + addResult(type, expectedvalue, PluginTest.charReturnTest(), row); + check(PluginTest.charReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "byte"; + expectedvalue = 44; + addResult(type, expectedvalue, PluginTest.byteReturnTest(), row); + check(PluginTest.byteReturnTest(), expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char[] (direct element access)"; + expectedvalue = 9234; + addResult(type, expectedvalue, PluginTest.charArrayReturnTest()[2], row); + check(PluginTest.charArrayReturnTest()[2], expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Regular char string"; + expectedvalue = "I'm a string too!"; + addResult(type, expectedvalue, PluginTest.regularStringReturnTest(), row); + check(PluginTest.regularStringReturnTest(), expectedvalue, "string", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Special char string"; + expectedvalue = "𠁎〒£$ǣ€𝍖"; + addResult(type, expectedvalue, PluginTest.specialStringReturnTest(), row); + check(PluginTest.specialStringReturnTest(), expectedvalue, "string", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "void"; + expectedvalue = null; + addResult(type, "undefined", PluginTest.voidReturnTest(), row); + check(PluginTest.voidReturnTest(), expectedvalue, "undefined", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "null"; + expectedvalue = null; + addResult(type, expectedvalue, PluginTest.nullReturnTest(), row); + check(PluginTest.nullReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Integer"; + expectedvalue = 14; + addResult(type, expectedvalue, PluginTest.IntegerReturnTest(), row); + check(PluginTest.IntegerReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double"; + expectedvalue = 14.14; + addResult(type, expectedvalue, PluginTest.DoubleReturnTest(), row); + check(PluginTest.DoubleReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Float"; + expectedvalue = 14.114; + addResult(type, expectedvalue, PluginTest.FloatReturnTest(), row); + check(PluginTest.FloatReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Long"; + expectedvalue = 6927694925; + addResult(type, expectedvalue, PluginTest.LongReturnTest(), row); + check(PluginTest.LongReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean"; + expectedvalue = "false"; + addResult(type, expectedvalue, PluginTest.BooleanReturnTest(), row); + check(PluginTest.BooleanReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Character"; + expectedvalue = "␗"; + addResult(type, expectedvalue, PluginTest.CharacterReturnTest(), row); + check(PluginTest.CharacterReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Byte"; + expectedvalue = 46; + addResult(type, expectedvalue, PluginTest.ByteReturnTest(), row); + check(PluginTest.ByteReturnTest(), expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Character[] (direct element access)"; + expectedvalue = "⍑"; + addResult(type, expectedvalue, PluginTest.CharacterArrayReturnTest()[1], row); + check(PluginTest.CharacterArrayReturnTest()[1], expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Character[] (Full array)"; + expectedvalue = "[Ljava.lang.Character;@"; + addResult(type, expectedvalue+"*", PluginTest.CharacterArrayReturnTest(), row); + if (PluginTest.CharacterArrayReturnTest().toString().substr(0,23) == "[Ljava.lang.Character;@") + if (typeof(PluginTest.CharacterArrayReturnTest()) == "object") { + pass(row); + } else { + fail(row, "Type mismatch: " + typeof(SMPluginTest.Da) + " != object"); + } + else + fail(row, ""); + + } catch (e) { + error(type, expectedvalue, e, row); + } + + tblBody.appendChild(row); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_get_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,260 @@ +/******************************************** + * Tests for getting members from Java side * + ********************************************/ + +function getMemberTests() { + document.getElementById("results").innerHTML += "<h2>JS -> Java get tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Member Type"; + columnNames[1] = "Expected Value"; + columnNames[2] = "Actual Value"; + columnNames[3] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + PluginTest.setUpForGMTests(); + + try { + row = document.createElement("tr"); + type = "int"; + expectedvalue = 42; + addResult(type, expectedvalue, PluginTest.i, row); + check(PluginTest.i, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + expectedvalue = 42.42; + addResult(type, expectedvalue, PluginTest.d, row); + check(PluginTest.d, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "float"; + expectedvalue = 42.099998474121094; + addResult(type, expectedvalue, PluginTest.f, row); + check(PluginTest.f, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "long"; + expectedvalue = 4294967296; + addResult(type, expectedvalue, PluginTest.l, row); + check(PluginTest.l, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + expectedvalue = true; + addResult(type, expectedvalue, PluginTest.b, row); + check(PluginTest.b, expectedvalue, "boolean", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char"; + expectedvalue = 8995; + addResult(type, expectedvalue, PluginTest.c, row); + check(PluginTest.c, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "byte"; + expectedvalue = 43; + addResult(type, expectedvalue, PluginTest.by, row); + check(PluginTest.by, expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "int[] (element access)"; + expectedvalue = "1024"; + addResult(type, expectedvalue, PluginTest.ia[4], row); + check(PluginTest.ia[4], expectedvalue, "number", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "int[] (beyond length)"; + expectedvalue = null; + addResult(type, expectedvalue, PluginTest.ia[30], row); + check(PluginTest.ia[30], expectedvalue, "undefined", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Regular String"; + expectedvalue = "I'm a string!"; + addResult(type, expectedvalue, PluginTest.rs, row); + check(PluginTest.rs, expectedvalue, "string", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String with special characters"; + expectedvalue = "𠁎〒£$ǣ€𝍖"; + addResult(type, expectedvalue, PluginTest.ss, row); + check(PluginTest.ss, expectedvalue, "string", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "null"; + expectedvalue = null; + addResult(type, expectedvalue, PluginTest.n, row); + check(PluginTest.n, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Integer"; + expectedvalue = 24; + addResult(type, expectedvalue, PluginTest.I, row); + check(PluginTest.I, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double"; + expectedvalue = 24.24; + addResult(type, expectedvalue, PluginTest.D, row); + check(PluginTest.D, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Float"; + expectedvalue = 24.124; + addResult(type, expectedvalue, PluginTest.F, row); + check(PluginTest.F, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Long"; + expectedvalue = 6927694924; + addResult(type, expectedvalue, PluginTest.L, row); + check(PluginTest.L, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean"; + expectedvalue = "false"; + addResult(type, expectedvalue, PluginTest.B, row); + check(PluginTest.B, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Character"; + expectedvalue = 'ᔦ'; + addResult(type, expectedvalue, PluginTest.C, row); + check(PluginTest.C, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Byte"; + expectedvalue = 34; + addResult(type, expectedvalue, PluginTest.By, row); + check(PluginTest.By, expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double[] (element access)"; + expectedvalue = "24.24"; + addResult(type, expectedvalue, PluginTest.Da1[9], row); + check(PluginTest.Da1[9], expectedvalue, "object", row); + } catch (e) { + error(type, expectedvalue, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double[] (Full array)"; + expectedvalue = "[Ljava.lang.Double;@"; + addResult(type, expectedvalue+"*", PluginTest.Da1, row); + + if (PluginTest.Da1.toString().substr(0,20) == expectedvalue) + if (typeof(PluginTest.Da1) == "object") { + pass(row); + } else { + fail(row, "Type mismatch: " + typeof(PluginTest.Da1) + " != object"); + } + else + fail(row, ""); + } catch (e) { + error(type, expectedvalue, e, row); + } + + tblBody.appendChild(row); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_set_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,318 @@ +/****************************************** + * Tests for setting members on Java side * + ******************************************/ + +function setMemberTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java set tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Member Type"; + columnNames[1] = "Old Value"; + columnNames[2] = "Setting To"; + columnNames[3] = "New Value"; + columnNames[4] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + PluginTest.setUpForSMTests(); + + try { + row = document.createElement("tr"); + type = "int"; + setto = 42; + curr = PluginTest.i; + PluginTest.i = setto; + now = PluginTest.i; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "double"; + setto = 42.42; + curr = PluginTest.d; + PluginTest.d = setto; + now = PluginTest.d; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "float"; + setto = 42.421; + curr = PluginTest.f; + PluginTest.f = setto; + now = PluginTest.f; + addResult(type, curr, 42.42100143432617, now, row); + check(now, 42.42100143432617, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "long"; + setto = 4294967296; + curr = PluginTest.l; + PluginTest.l = setto; + now = PluginTest.l; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "boolean"; + setto = true; + curr = PluginTest.b; + PluginTest.b = setto; + now = PluginTest.b; + addResult(type, curr, setto, now, row); + check(now, setto, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "char"; + setto = 58; + curr = PluginTest.c; + PluginTest.c = setto; + now = PluginTest.c; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "byte"; + setto = 43; + curr = PluginTest.by; + PluginTest.by = setto; + now = PluginTest.by; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "int[] (element)"; + setto = 100; + curr = PluginTest.ia[4]; + PluginTest.ia[4] = setto; + now = PluginTest.ia[4]; + addResult(type, curr, setto, now, row); + check(now, setto, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "int[] (beyond length)"; + setto = 100; + curr = PluginTest.ia[30]; + PluginTest.ia[30] = setto; + now = PluginTest.ia[30]; + addResult(type, curr, setto, now, row); + check(now, null, "undefined", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Regular string"; + setto = 'Test string'; + curr = PluginTest.rs; + PluginTest.rs = setto; + now = PluginTest.rs; + addResult(type, curr, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String with special chars"; + setto = "𠁎〒£$ǣ€𝍖"; + curr = PluginTest.ss; + PluginTest.ss = setto; + now = PluginTest.ss; + addResult(type, curr, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "null"; + setto = null; + curr = PluginTest.n; + PluginTest.n = setto; + now = PluginTest.n; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Integer"; + setto = 24; + curr = PluginTest.I; + PluginTest.I = setto; + now = PluginTest.I; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double"; + setto = 24.24; + curr = PluginTest.D; + PluginTest.D = setto; + now = PluginTest.D; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Float"; + setto = 24.124; + curr = PluginTest.F; + PluginTest.F = setto; + now = PluginTest.F; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Long"; + setto = 6927694924; + curr = PluginTest.L; + PluginTest.L = setto; + now = PluginTest.L; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean"; + setto = new java.lang.Boolean("true"); + curr = PluginTest.B; + PluginTest.B = setto; + now = PluginTest.B; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Character"; + setto = new java.lang.Character(64); + curr = PluginTest.C; + PluginTest.C = setto; + now = PluginTest.C; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Byte"; + setto = new java.lang.Byte(39); + curr = PluginTest.By; + PluginTest.By = setto; + now = PluginTest.By; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double[] (element)"; + setto = 100.100; + curr = PluginTest.Da1[9]; + PluginTest.Da1[9] = setto; + now = PluginTest.Da1[9]; + addResult(type, curr, setto, now, row); + check(now, setto, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Double[] (Full array)"; + curr = PluginTest.Da2; + PluginTest.Da2 = java.lang.reflect.Array.newInstance(java.lang.Double, 3); + PluginTest.Da2[0] = 1.1; + PluginTest.Da2[1] = 2.1; + addResult(type, curr, "[1.1,2.1,null]", "["+PluginTest.Da2[0]+","+PluginTest.Da2[1]+","+PluginTest.Da2[2]+"]", row); + check("["+PluginTest.Da2[0]+","+PluginTest.Da2[1]+","+PluginTest.Da2[2]+"]", "[1.1,2.1,null]", "string", row); + } catch (e) { + error(type, "[1.0,2.0,]", e, row); + } + + tblBody.appendChild(row); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_type_casting_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,825 @@ +/************************************************************ + * Tests for data type conversion from JS to Java variables * + ************************************************************/ + +function typeCastingTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java type casting tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Test Type"; + columnNames[1] = "Send Value"; + columnNames[2] = "Expected Value"; + columnNames[3] = "Actual Value"; + columnNames[4] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.String (Integer)"; + setto = 1; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.String (Double)"; + setto = 1.1; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.Object (Integer)"; + setto = 1.0; + PluginTest.Object_type = setto; + now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row); + check(now, setto + " | Superclass = java.lang.Number", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.Object (Double)"; + setto = 1.1; + PluginTest.Object_type = setto; + now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row); + check(now, setto + " | Superclass = java.lang.Number", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> boolean (0)"; + setto = 0; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, false, now, row); + check(now, false, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> boolean (1.1)"; + setto = 1.1; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, true, now, row); + check(now, true, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Boolean (true)"; + setto = true; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type; + addResult (type, setto, "true", now, row); + check(now, "true", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Boolean (false)"; + setto = false; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type; + addResult (type, setto, "false", now, row); + check(now, "false", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Object"; + setto = true; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type + " | Class = " + PluginTest.Boolean_type.getClass().getName(); + addResult (type, setto, "true | Class = java.lang.Boolean", now, row); + check(now, "true | Class = java.lang.Boolean", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.String"; + setto = true; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "true", now, row); + check(now, "true", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.String"; + setto = true; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "true", now, row); + check(now, "true", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> byte (true)"; + setto = true; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> char (true)"; + setto = true; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> short (true)"; + setto = true; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> int (true)"; + setto = true; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> long (true)"; + setto = true; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> float (true)"; + setto = true; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> double (true)"; + setto = true; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> byte (false)"; + setto = false; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> char (false)"; + setto = false; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> short (false)"; + setto = false; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> int (false)"; + setto = false; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> long (false)"; + setto = false; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> float (false)"; + setto = false; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> double (false)"; + setto = false; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> Object"; + setto = "𠁎〒£$ǣ€𝍖"; + PluginTest.Object_type = setto; + + // Some weird FF bug is causing getClass to not work correctly when set + // to a String (hasProperty/hasMethod "getClass" doesn't come through + // to the plugin at all, so it is definitely an ff issue). So for now, + // we just compare values. + + //now = PluginTest.Object_type + " | Class = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + //addResult (type, setto, setto + " | Class = java.lang.String", now, row); + //check(now, setto + " | Class = java.lang.String", "string", row); + + now = PluginTest.Object_type; + PluginTest.Object_type.charAt(3); // try a String specific function to be sure it is a String + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> byte"; + setto = "1"; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> short"; + setto = "2"; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 2, now, row); + check(now, 2, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> int"; + setto = "3"; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 3, now, row); + check(now, 3, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> long"; + setto = "4"; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 4, now, row); + check(now, 4, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> float"; + setto = "0.0"; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> double"; + setto = "6.2"; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 6.2, now, row); + check(now, 6.2, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> char"; + setto = "7"; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 7, now, row); + check(now, 7, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "String -> boolean (empty/false)"; + setto = ""; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, false, now, row); + check(now, false, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "String -> boolean (non-empty/true)"; + setto = "A non-empty string"; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, true, now, row); + check(now, true, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> byte[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.byte_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.byte_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> char[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.char_array = setto; + + // For char array, don't convert to string.. the empty/null/0 character messes it up + now = PluginTest.char_array[0] + "," + PluginTest.char_array[1] + "," + PluginTest.char_array[2]; + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> short[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.short_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.short_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> int[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.int_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.int_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> long[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.long_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.long_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> float[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.float_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.float_array); + addResult (type, setto, "1.0,0.0,2.0", now, row); + check(now, "1.0,0.0,2.0", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> double[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.double_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.double_array); + addResult (type, setto, "1.0,0.0,2.0", now, row); + check(now, "1.0,0.0,2.0", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> String[] (int)"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.String_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.String_array); + addResult (type, setto, "1,null,2", now, row); + check(now, "1,null,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> String[] (int)"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.String_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.String_array); + addResult (type, setto, "1,null,2", now, row); + check(now, "1,null,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = "100"; + a[0][2] = "102"; + a[2][0] = "120"; + a[2][1] = "121"; + a[2][3] = "123"; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> char[][] (string to primitive)"; + PluginTest.char_array_array = a; + now = PluginTest.char_array_array[0][0] + "," + + PluginTest.char_array_array[0][1] + "," + + PluginTest.char_array_array[0][2] + "," + + PluginTest.char_array_array[1][0] + "," + + PluginTest.char_array_array[2][0] + "," + + PluginTest.char_array_array[2][1] + "," + + PluginTest.char_array_array[2][2] + "," + + PluginTest.char_array_array[2][3]; + expected = "100,0,102,undefined,120,121,0,123" + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = 100; + a[0][2] = 102; + a[2][0] = 120; + a[2][1] = 121; + a[2][3] = 123; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> String[][] (int to complex)"; + PluginTest.String_array_array = a; + now = PluginTest.String_array_array[0][0] + "," + + PluginTest.String_array_array[0][1] + "," + + PluginTest.String_array_array[0][2] + "," + + PluginTest.String_array_array[1][0] + "," + + PluginTest.String_array_array[2][0] + "," + + PluginTest.String_array_array[2][1] + "," + + PluginTest.String_array_array[2][2] + "," + + PluginTest.String_array_array[2][3]; + expected = "100,null,102,undefined,120,121,null,123"; + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = 100; + a[0][2] = 102; + a[2][0] = 120; + a[2][1] = 121; + a[2][3] = 123; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> String"; + PluginTest.String_type = a; + now = PluginTest.String_type; + expected = "100,,102,,120,121,,123"; + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "JSObject -> JSObject"; + setto = window; + PluginTest.JSObject_type = setto; + now = PluginTest.JSObject_type; + addResult (type, setto, "[object Window]", now, row); + check(now, "[object Window]", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "JSObject -> String"; + setto = window; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "[object Window]", now, row); + check(now, "[object Window]", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Java Object -> Java Object"; + PluginTest.Float_type = 1.111; + orig_hash = PluginTest.Float_type.hashCode(); + PluginTest.Object_type = PluginTest.Float_type; + new_hash = PluginTest.Object_type.hashCode(); + addResult (type, "hashcode=" + orig_hash, orig_hash, new_hash, row); + check(new_hash, orig_hash, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Java Object -> String"; + setto = new PluginTest.Packages.DummyObject("Test object"); + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "Test object", now, row); + check(now, "Test object", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "null -> Java Object (String)"; + + // Assuming the set tests have passed, we know that object is non-null after this + PluginTest.String_type = "Not Null"; + + setto = null; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, null, now, row); + check(now, null, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + +/* + // NULL -> primitive tests are disabled for now due to ambiguity. + // Section 2.2 here: http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/ + // States that null to primitive is not allowed, yet, section 2.3.7 claims it is.. + + try { + row = document.createElement("tr"); + type = "null -> byte"; + + // Assuming the set tests have passed, we know that object is non-null after this + PluginTest.byte_type = "100"; + + setto = null; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, null, now, row); + check(now, null, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); +*/ + +} + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/tests/LiveConnect/jsj_type_conversion_tests.js Sat Jan 16 04:30:59 2010 +0000 @@ -0,0 +1,825 @@ +/************************************************************ + * Tests for data type conversion from JS to Java variables * + ************************************************************/ + +function typeCastingTests() { + + document.getElementById("results").innerHTML += "<h2>JS -> Java type casting tests:</h2>"; + + var tbl = document.createElement("table"); + var tblBody = document.createElement("tbody"); + var columnNames = new Array(); + columnNames[0] = "Test Type"; + columnNames[1] = "Send Value"; + columnNames[2] = "Expected Value"; + columnNames[3] = "Actual Value"; + columnNames[4] = "Status"; + var row; + + createResultTable(tbl, tblBody, columnNames); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.String (Integer)"; + setto = 1; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.String (Double)"; + setto = 1.1; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.Object (Integer)"; + setto = 1.0; + PluginTest.Object_type = setto; + now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row); + check(now, setto + " | Superclass = java.lang.Number", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> java.lang.Object (Double)"; + setto = 1.1; + PluginTest.Object_type = setto; + now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row); + check(now, setto + " | Superclass = java.lang.Number", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> boolean (0)"; + setto = 0; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, false, now, row); + check(now, false, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Numeric -> boolean (1.1)"; + setto = 1.1; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, true, now, row); + check(now, true, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Boolean (true)"; + setto = true; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type; + addResult (type, setto, "true", now, row); + check(now, "true", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Boolean (false)"; + setto = false; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type; + addResult (type, setto, "false", now, row); + check(now, "false", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.Object"; + setto = true; + PluginTest.Boolean_type = setto; + now = PluginTest.Boolean_type + " | Class = " + PluginTest.Boolean_type.getClass().getName(); + addResult (type, setto, "true | Class = java.lang.Boolean", now, row); + check(now, "true | Class = java.lang.Boolean", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.String"; + setto = true; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "true", now, row); + check(now, "true", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "Boolean -> java.lang.String"; + setto = true; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "true", now, row); + check(now, "true", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> byte (true)"; + setto = true; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> char (true)"; + setto = true; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> short (true)"; + setto = true; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> int (true)"; + setto = true; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> long (true)"; + setto = true; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> float (true)"; + setto = true; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> double (true)"; + setto = true; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> byte (false)"; + setto = false; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> char (false)"; + setto = false; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> short (false)"; + setto = false; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> int (false)"; + setto = false; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> long (false)"; + setto = false; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> float (false)"; + setto = false; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Boolean -> double (false)"; + setto = false; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> Object"; + setto = "𠁎〒£$ǣ€𝍖"; + PluginTest.Object_type = setto; + + // Some weird FF bug is causing getClass to not work correctly when set + // to a String (hasProperty/hasMethod "getClass" doesn't come through + // to the plugin at all, so it is definitely an ff issue). So for now, + // we just compare values. + + //now = PluginTest.Object_type + " | Class = " + PluginTest.Object_type.getClass().getSuperclass().getName(); + //addResult (type, setto, setto + " | Class = java.lang.String", now, row); + //check(now, setto + " | Class = java.lang.String", "string", row); + + now = PluginTest.Object_type; + PluginTest.Object_type.charAt(3); // try a String specific function to be sure it is a String + addResult (type, setto, setto, now, row); + check(now, setto, "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> byte"; + setto = "1"; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, 1, now, row); + check(now, 1, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> short"; + setto = "2"; + PluginTest.short_type = setto; + now = PluginTest.short_type; + addResult (type, setto, 2, now, row); + check(now, 2, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> int"; + setto = "3"; + PluginTest.int_type = setto; + now = PluginTest.int_type; + addResult (type, setto, 3, now, row); + check(now, 3, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> long"; + setto = "4"; + PluginTest.long_type = setto; + now = PluginTest.long_type; + addResult (type, setto, 4, now, row); + check(now, 4, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> float"; + setto = "0.0"; + PluginTest.float_type = setto; + now = PluginTest.float_type; + addResult (type, setto, 0, now, row); + check(now, 0, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> double"; + setto = "6.2"; + PluginTest.double_type = setto; + now = PluginTest.double_type; + addResult (type, setto, 6.2, now, row); + check(now, 6.2, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "String -> char"; + setto = "7"; + PluginTest.char_type = setto; + now = PluginTest.char_type; + addResult (type, setto, 7, now, row); + check(now, 7, "number", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "String -> boolean (empty/false)"; + setto = ""; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, false, now, row); + check(now, false, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + + try { + row = document.createElement("tr"); + type = "String -> boolean (non-empty/true)"; + setto = "A non-empty string"; + PluginTest.boolean_type = setto; + now = PluginTest.boolean_type; + addResult (type, setto, true, now, row); + check(now, true, "boolean", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> byte[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.byte_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.byte_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> char[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.char_array = setto; + + // For char array, don't convert to string.. the empty/null/0 character messes it up + now = PluginTest.char_array[0] + "," + PluginTest.char_array[1] + "," + PluginTest.char_array[2]; + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> short[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.short_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.short_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> int[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.int_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.int_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> long[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.long_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.long_array); + addResult (type, setto, "1,0,2", now, row); + check(now, "1,0,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> float[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.float_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.float_array); + addResult (type, setto, "1.0,0.0,2.0", now, row); + check(now, "1.0,0.0,2.0", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> double[]"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.double_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.double_array); + addResult (type, setto, "1.0,0.0,2.0", now, row); + check(now, "1.0,0.0,2.0", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> String[] (int)"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.String_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.String_array); + addResult (type, setto, "1,null,2", now, row); + check(now, "1,null,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Array -> String[] (int)"; + setto = new Array(); + setto[0] = 1; + setto[2] = 2; + PluginTest.String_array = setto; + now = PluginTest.getArrayAsStr(PluginTest.String_array); + addResult (type, setto, "1,null,2", now, row); + check(now, "1,null,2", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = "100"; + a[0][2] = "102"; + a[2][0] = "120"; + a[2][1] = "121"; + a[2][3] = "123"; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> char[][] (string to primitive)"; + PluginTest.char_array_array = a; + now = PluginTest.char_array_array[0][0] + "," + + PluginTest.char_array_array[0][1] + "," + + PluginTest.char_array_array[0][2] + "," + + PluginTest.char_array_array[1][0] + "," + + PluginTest.char_array_array[2][0] + "," + + PluginTest.char_array_array[2][1] + "," + + PluginTest.char_array_array[2][2] + "," + + PluginTest.char_array_array[2][3]; + expected = "100,0,102,undefined,120,121,0,123" + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = 100; + a[0][2] = 102; + a[2][0] = 120; + a[2][1] = 121; + a[2][3] = 123; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> String[][] (int to complex)"; + PluginTest.String_array_array = a; + now = PluginTest.String_array_array[0][0] + "," + + PluginTest.String_array_array[0][1] + "," + + PluginTest.String_array_array[0][2] + "," + + PluginTest.String_array_array[1][0] + "," + + PluginTest.String_array_array[2][0] + "," + + PluginTest.String_array_array[2][1] + "," + + PluginTest.String_array_array[2][2] + "," + + PluginTest.String_array_array[2][3]; + expected = "100,null,102,undefined,120,121,null,123"; + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + var a = []; + a[0] = []; + a[1] = []; + a[2] = []; + a[0][0] = 100; + a[0][2] = 102; + a[2][0] = 120; + a[2][1] = 121; + a[2][3] = 123; + + // + // a = [[00, , 02] // normal + // [] // empty + // [20, 21, , 23]] // length = element0.length + 1 + // + + row = document.createElement("tr"); + type = "Array -> String"; + PluginTest.String_type = a; + now = PluginTest.String_type; + expected = "100,,102,,120,121,,123"; + addResult (type, a, expected, now, row); + check(now, expected, "string", row); + } catch (e) { + error(type, a, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "JSObject -> JSObject"; + setto = window; + PluginTest.JSObject_type = setto; + now = PluginTest.JSObject_type; + addResult (type, setto, "[object Window]", now, row); + check(now, "[object Window]", "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "JSObject -> String"; + setto = window; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "[object Window]", now, row); + check(now, "[object Window]", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Java Object -> Java Object"; + PluginTest.Float_type = 1.111; + orig_hash = PluginTest.Float_type.hashCode(); + PluginTest.Object_type = PluginTest.Float_type; + new_hash = PluginTest.Object_type.hashCode(); + addResult (type, "hashcode=" + orig_hash, orig_hash, new_hash, row); + check(new_hash, orig_hash, "number", row); + } catch (e) { + error(type, "", e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "Java Object -> String"; + setto = new PluginTest.Packages.DummyObject("Test object"); + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, "Test object", now, row); + check(now, "Test object", "string", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + + try { + row = document.createElement("tr"); + type = "null -> Java Object (String)"; + + // Assuming the set tests have passed, we know that object is non-null after this + PluginTest.String_type = "Not Null"; + + setto = null; + PluginTest.String_type = setto; + now = PluginTest.String_type; + addResult (type, setto, null, now, row); + check(now, null, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); + +/* + // NULL -> primitive tests are disabled for now due to ambiguity. + // Section 2.2 here: http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/ + // States that null to primitive is not allowed, yet, section 2.3.7 claims it is.. + + try { + row = document.createElement("tr"); + type = "null -> byte"; + + // Assuming the set tests have passed, we know that object is non-null after this + PluginTest.byte_type = "100"; + + setto = null; + PluginTest.byte_type = setto; + now = PluginTest.byte_type; + addResult (type, setto, null, now, row); + check(now, null, "object", row); + } catch (e) { + error(type, setto, e, row); + } + tblBody.appendChild(row); +*/ + +} + + +
--- a/ports/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Sat Jan 16 04:25:58 2010 +0000 +++ b/ports/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Sat Jan 16 04:30:59 2010 +0000 @@ -249,7 +249,23 @@ } bool os::is_allocatable(size_t bytes) { - ShouldNotCallThis(); +#ifdef AMD64 + // unused on amd64? + return true; +#else + + if (bytes < 2 * G) { + return true; + } + + char* addr = reserve_memory(bytes, NULL); + + if (addr != NULL) { + release_memory(addr, bytes); + } + + return addr != NULL; +#endif // AMD64 } ///////////////////////////////////////////////////////////////////////////////