From 6916986de6c0a24ec23fa7b18dd01e25f7f269a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xerxes=20R=C3=A5nby?= Date: Mon, 19 Jul 2010 11:24:11 +0200 Subject: openjdk-6-6b18: add pre1.8.1 releasebranch fixes up to 13 Jul 2010. fixes origin from http://icedtea.classpath.org/hg/release/icedtea6-1.8/shortlog --- .../icedtea1.8-pre1.8.1-releasebranch-fixes.patch | 3430 ++++++++++++++++++++ recipes/openjdk/openjdk-6-release-6b18.inc | 1 + recipes/openjdk/openjdk-6_6b18-1.8.bb | 2 +- 3 files changed, 3432 insertions(+), 1 deletion(-) create mode 100644 recipes/openjdk/openjdk-6-6b18-1.8/icedtea1.8-pre1.8.1-releasebranch-fixes.patch diff --git a/recipes/openjdk/openjdk-6-6b18-1.8/icedtea1.8-pre1.8.1-releasebranch-fixes.patch b/recipes/openjdk/openjdk-6-6b18-1.8/icedtea1.8-pre1.8.1-releasebranch-fixes.patch new file mode 100644 index 0000000000..96f00c9f39 --- /dev/null +++ b/recipes/openjdk/openjdk-6-6b18-1.8/icedtea1.8-pre1.8.1-releasebranch-fixes.patch @@ -0,0 +1,3430 @@ +diff -r a0120629678b ChangeLog +--- a/ChangeLog Wed Apr 14 12:21:03 2010 +0200 ++++ b/ChangeLog Fri Jul 16 14:30:37 2010 +0200 +@@ -1,3 +1,227 @@ ++2010-07-13 Mark Wielaard ++ ++ Reported by William Cohen ++ * tapset/hotspot.stp.in (object_alloc): size is arg4, not arg3. ++ ++2010-07-14 Deepak Bhole ++ ++ * plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java: Add a new ++ processedIds list to track which instances have been instantiated. ++ (okToProcess): Register width as priority only after handle is acquired. ++ Process resize messages only after tag and handle are processed. ++ (notifyWorkerIsFree): Add instance id to processedIds list if the worked ++ being free'd is an init worker. ++ (getFreeWorker): Create new normal worked only if worker count is less ++ than MAX_WORKERS - PRIORITY_WORKERS. ++ (dumpWorkerStatus): New method. Useful when debugging -- prints status of ++ all workers. ++ * plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java ++ (toString): New method. Returns the string representation of the worker ++ instance at call time. ++ ++2010-07-13 Matthias Klose ++ ++ * acinclude.m4 (IT_CHECK_PLUGIN_DEPENDENCIES): Don't require libxul ++ libraries. ++ (IT_CHECK_XULRUNNER_VERSION): Use pkgconfig --modversion as version. ++ ++2010-07-13 Deepak Bhole ++ ++ * plugin/icedteanp/IcedTeaJavaRequestProcessor.h: Set timeout to 120 ++ seconds (previous commit mistakenly changed it to 10). ++ * plugin/icedteanp/IcedTeaPluginUtils.h: Print debug info only in debug ++ mode. ++ ++2010-06-14 Deepak Bhole ++ ++ * plugin/icedteanp/IcedTeaJavaRequestProcessor.cc: Use variadic macro ++ for debug message printing. ++ * plugin/icedteanp/IcedTeaJavaRequestProcessor.h: Same. ++ * plugin/icedteanp/IcedTeaNPPlugin.cc: Same. ++ * plugin/icedteanp/IcedTeaPluginRequestProcessor.cc: Same. ++ * plugin/icedteanp/IcedTeaPluginUtils.cc: Same. ++ * plugin/icedteanp/IcedTeaPluginUtils.h: Same. ++ * plugin/icedteanp/IcedTeaScriptablePluginObject.cc: Same. ++ ++2010-07-12 Jon VanAlten ++ * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java ++ * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioLine.java ++ * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java ++ * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java: ++ Eliminate spurious exception throwing from open, close, read, write, ++ drain, and flush calls on closed lines. ++ Use isOpen() API call instead of instance variable where appropriate. ++ ++2010-07-08 Man Lung Wong ++ ++ * netx/net/sourceforge/jnlp/Parser.java: ++ (getRootNode): Used BufferedInputStream instead of InputStream to ++ have mark and reset method available. Passed the encoding to the ++ constructor of InputStreamReader, such that the stream will now ++ be parsed with the encoding the jnlp file is in. ++ (getEncoding): A new method which checks the first four bytes of input ++ and determines what the files encoding is. ++ ++2010-06-24 Omair Majid ++ ++ * netx/net/sourceforge/jnlp/SecurityDesc.java: Fix comments. ++ * netx/net/sourceforge/jnlp/JNLPClassLoader.java ++ (activateJars): Always call activateNative. ++ (activateNative): Search for native code anywhere in the jar. ++ ++2010-06-29 Omair Majid ++ ++ * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java ++ nativeDirectories: New variable. Contains a list of directories that ++ contain native libraries. ++ (getInstance): Tell other classloaders about the native directory. ++ (getNativeDir): Add the new native directory to nativeDirectories. ++ (addNativeDirectory): New function. ++ (getNativeDirectories): New function. ++ (findLibrary): Look in all the native directories for the native library. ++ ++2010-06-29 Omair Majid ++ ++ * netx/net/sourceforge/jnlp/services/XSingleInstanceService.java ++ (startListeningServer): Mark the thread as a daemon so the JVM can ++ shutdown if there are no other non-daemon thread running. ++ ++2010-06-29 Omair Majid ++ ++ * netx/net/sourceforge/jnlp/cache/CacheUtil.java ++ (urlToPath): Call FileUtils.sanitizePath. ++ (fixPath): Moved to... ++ * netx/net/sourceforge/jnlp/util/FileUtils.java ++ (sanitizePath): New function. Moved from CacheUtil.java ++ (sanitizeFileName): Use a blacklisting approach rather than a whitelisting ++ approach: should work better with non ascii filenames. ++ ++2010-07-08 Omair Majid ++ ++ * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java: ++ (reFrame): Pass the panel to the constructor, dont set it yourself. ++ (PluginAppletViewer): Set the panel to be the passed in object and only ++ then add it to the list of all panels. ++ ++2010-07-08 Omair Majid ++ ++ PR icedtea/460 ++ * plugin/icedteanp/java/netscape/security/ForbiddenTargetException.java: ++ New file. Some applets, for legacy support, expect this class to be ++ present. ++ ++2010-06-14 Andrew John Hughes ++ ++ Don't print out the return value of pthread_self ++ which is a pthread_t. pthread_t is an opaque type ++ and we don't know what it actually is (it varies ++ from system to system; recent versions of Linux ++ use an unsigned long int). ++ * plugin/icedteanp/IcedTeaPluginUtils.h: ++ (PLUGIN_DEBUG_0ARG(str)): Don't print the thread_t. ++ (PLUGIN_DEBUG_1ARG(str,arg1)): Likewise. ++ (PLUGIN_DEBUG_2ARG(str,arg1,arg2)): Likewise. ++ (PLUGIN_DEBUG_3ARG(str,arg1,arg2,arg3)): Likewise. ++ (PLUGIN_DEBUG_4ARG(str,arg1,arg2,arg3,arg4)): Likewise. ++ (PLUGIN_DEBUG_5ARG(str,arg1,arg2,arg3,arg4,arg5)): Likewise. ++ ++2010-06-14 Deepak Bhole ++ ++ * plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java: Fix bug ++ causing 100% CPU usage (rhbz# 592553). ++ ++2010-06-14 Omair Majid ++ ++ PR icedtea/488 ++ * plugin/icedteanp/IcedTeaPluginUtils.h: Bug #488. Fix bug due to ++ incorrect assumption that 'A' > 'a'. ++ ++2010-06-14 Omair Majid ++ ++ PR icedtea/480 ++ * plugin/icedteanp/IcedTeaNPPlugin.cc: Use getproperty NPAPI call instead ++ of evaluate, to get page URL. ++ ++2010-05-07 Deepak Bhole ++ ++ PR icedtea/436: ++ * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java ++ (handleMessage): Don't print stack trace on InterruptedException. ++ (appletClose): Kill misbehaving applets that don't shut down properly. ++ ++2010-05-07 Deepak Bhole ++ ++ * netx/net/sourceforge/jnlp/Launcher.java ++ (setContextClassLoaderForAllThreads): Change to set context CL only for ++ given threadgroup. ++ (launchApplication): Supply threadgroup to ++ setContextClassLoaderForAllThreads. ++ (createApplet): Same. ++ ++2010-05-07 Gary Benson ++ ++ * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java: ++ Removed a stray semicolon. ++ ++2010-05-06 Deepak Bhole ++ ++ * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java: ++ Add imports missed in last commit. ++ ++2010-05-06 Deepak Bhole ++ ++ * rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java ++ (checkPermission): Allow Runtime and Security permission (for ++ putProvider.SunJCE) if initiated for an https connection. ++ (inTrustedCallChain): New method. Returns if given class/method is ++ in the call chain, and everything upto there is trusted. ++ ++2010-05-05 Gary Benson ++ ++ PR icedtea/481 ++ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp ++ (SharkTopLevelBlock::improve_virtual_call): Disable an ++ optimization that cannot currently be supported. ++ ++2010-04-30 Gary Benson ++ ++ PR icedtea/324 ++ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp ++ (SharkTopLevelBlock::do_aload): Cope with cases where ++ the array's type is unknown. ++ (SharkTopLevelBlock::do_astore): Likewise. ++ ++2010-04-28 Andrew John Hughes ++ ++ PR icedtea/476 ++ * Makefile.am: ++ Add patch when SystemTap is enabled to support ++ building with GCC 4.5. ++ * patches/systemtap-gcc-4.5.patch: ++ Add cast to NULL (doesn't apply to DTrace due ++ to differences between SystemTap and DTrace macros). ++ ++2010-04-24 Matthias Klose ++ ++ * Makefile.am (check-langtools, check-jdk): Allow overwriting -samevm ++ with the environment variable ICEDTEA_JTREG_OTHERVM. ++ ++2010-04-22 Xerxes RÄnby ++ ++ * ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp ++ (SharkNativeWrapper::initialize): Shark calling static jni ++ methods jclass argument fix. ++ ++2010-04-04 Nobuhiro Iwamatsu ++ ++ * acinclude.m4 (IT_SET_ARCH_SETTINGS): Fix Hitachi SH settings. ++ ++2010-04-21 Deepak Bhole ++ ++ * plugin/icedteanp/IcedTeaNPPlugin.cc ++ (plugin_filter_environment): Increment malloc size by one to account for ++ NULL terminator. Bug# 474. ++ + 2010-04-12 Andrew John Hughes + + PR icedtea/373 +diff -r a0120629678b Makefile.am +--- a/Makefile.am Wed Apr 14 12:21:03 2010 +0200 ++++ b/Makefile.am Fri Jul 16 14:30:37 2010 +0200 +@@ -374,7 +374,8 @@ + endif + + if ENABLE_SYSTEMTAP +-ICEDTEA_PATCHES += patches/icedtea-systemtap.patch ++ICEDTEA_PATCHES += patches/icedtea-systemtap.patch \ ++ patches/systemtap-gcc-4.5.patch + endif + + if ENABLE_NSS +@@ -2024,7 +2025,8 @@ + mkdir -p test/langtools/JTwork test/langtools/JTreport + $(ICEDTEA_BOOT_DIR)/bin/java -jar test/jtreg.jar -v1 -a -ignore:quiet \ + -w:test/langtools/JTwork -r:test/langtools/JTreport \ +- -s -jdk:`pwd`/$(BUILD_OUTPUT_DIR)/j2sdk-image \ ++ $${ICEDTEA_JTREG_OTHERVM:--samevm} \ ++ -jdk:`pwd`/$(BUILD_OUTPUT_DIR)/j2sdk-image \ + $(ICEDTEA_JTREG_OPTIONS) \ + `pwd`/openjdk/langtools/test \ + | tee test/$@.log +@@ -2033,7 +2035,8 @@ + mkdir -p test/jdk/JTwork test/jdk/JTreport + $(ICEDTEA_BOOT_DIR)/bin/java -jar test/jtreg.jar -v1 -a -ignore:quiet \ + -w:test/jdk/JTwork -r:test/jdk/JTreport \ +- -s -jdk:`pwd`/$(BUILD_OUTPUT_DIR)/j2sdk-image \ ++ $${ICEDTEA_JTREG_OTHERVM:--samevm} \ ++ -jdk:`pwd`/$(BUILD_OUTPUT_DIR)/j2sdk-image \ + -exclude:$(abs_top_srcdir)/test/jtreg/excludelist.jdk.jtx \ + $(ICEDTEA_JTREG_OPTIONS) \ + `pwd`/openjdk/jdk/test \ +diff -r a0120629678b acinclude.m4 +--- a/acinclude.m4 Wed Apr 14 12:21:03 2010 +0200 ++++ b/acinclude.m4 Fri Jul 16 14:30:37 2010 +0200 +@@ -85,7 +85,7 @@ + CROSS_TARGET_ARCH=s390x + ARCHFLAG="-m64" + ;; +- sh*-*-*) ++ sh*) + BUILD_ARCH_DIR=sh + INSTALL_ARCH_DIR=sh + JRE_ARCH_DIR=sh +@@ -1461,15 +1461,7 @@ + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + +- +- if $PKG_CONFIG --atleast-version 1.9.2 libxul 2>&AS_MESSAGE_LOG_FD ; then +- xullibs=libxul +- else +- xullibs="libxul libxul-unstable" +- fi +- +- PKG_CHECK_MODULES(MOZILLA, \ +- mozilla-plugin ${xullibs}) ++ PKG_CHECK_MODULES(MOZILLA, mozilla-plugin) + + AC_SUBST(MOZILLA_CFLAGS) + AC_SUBST(MOZILLA_LIBS) +@@ -1482,52 +1474,13 @@ + AC_REQUIRE([IT_CHECK_PLUGIN_DEPENDENCIES]) + if test "x${enable_plugin}" = "xyes" + then +- AC_LANG_PUSH([C++]) +- OLDCPPFLAGS="$CPPFLAGS" +- CPPFLAGS="$CPPFLAGS $MOZILLA_CFLAGS" +- +- AC_CACHE_CHECK([for xulrunner version], [xulrunner_cv_collapsed_version], +- [AC_RUN_IFELSE( +- [AC_LANG_PROGRAM([[ +-#include +-#include +-#include +-#include +-#include +-]],[[ +-int version = 0; +-const char* token = NULL; +-int power=6; +-FILE *datafile; +- +-datafile = fopen ("conftest.vdata", "w"); +-if (!datafile) return 1; +- +-// 32 chars is more than enough to hold version +-char* mozilla_version = (char*) malloc(32*sizeof(char)); +-snprintf(mozilla_version, 32, "%s", MOZILLA_VERSION); +- +-token = strtok(mozilla_version, "."); +-while (token) +-{ +- version += atoi(token)*(pow(10, power)); +- power -=2; +- token = strtok(NULL, "."); +-} +- +-fprintf (datafile, "%d\n", version); +-free(mozilla_version); +-if (fclose(datafile)) return 1; +- +-return EXIT_SUCCESS; +-]])], +- [xulrunner_cv_collapsed_version="$(cat conftest.vdata)"], +- [AC_MSG_FAILURE([cannot determine xulrunner version])])], +- [xulrunner_cv_collapsed_version="190000"]) +- +- CPPFLAGS="$OLDCPPFLAGS" +- AC_LANG_POP([C++]) +- ++ AC_CACHE_CHECK([for xulrunner version], [xulrunner_cv_collapsed_version],[ ++ if pkg-config --modversion libxul >/dev/null 2>&1 ++ then ++ xulrunner_cv_collapsed_version=`pkg-config --modversion libxul | awk -F. '{power=6; v=0; for (i=1; i <= NF; i++) {v += $i * 10 ^ power; power -=2}; print v}'` ++ else ++ AC_MSG_FAILURE([cannot determine xulrunner version]) ++ fi]) + AC_SUBST(MOZILLA_VERSION_COLLAPSED, $xulrunner_cv_collapsed_version) + fi + ]) +diff -r a0120629678b netx/net/sourceforge/jnlp/Launcher.java +--- a/netx/net/sourceforge/jnlp/Launcher.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/Launcher.java Fri Jul 16 14:30:37 2010 +0200 +@@ -442,7 +442,7 @@ + Method main = mainClass.getDeclaredMethod("main", new Class[] {String[].class} ); + String args[] = file.getApplication().getArguments(); + +- setContextClassLoaderForAllThreads(app.getClassLoader()); ++ setContextClassLoaderForAllThreads(app.getThreadGroup(), app.getClassLoader()); + + if (splashScreen != null) { + if (splashScreen.isSplashScreenValid()) { +@@ -464,30 +464,24 @@ + } + + /** +- * Set the classloader as the context classloader for all threads. This is +- * required to make some applications work. For example, an application that +- * provides a custom Swing LnF may ask the swing thread to load resources +- * from their JNLP, which would only work if the Swing thread knows about +- * the JNLPClassLoader. ++ * Set the classloader as the context classloader for all threads in ++ * the given threadgroup. This is required to make some applications ++ * work. For example, an application that provides a custom Swing LnF ++ * may ask the swing thread to load resources from their JNLP, which ++ * would only work if the Swing thread knows about the JNLPClassLoader. + * ++ * @param tg The threadgroup for which the context classloader should be set + * @param classLoader the classloader to set as the context classloader + */ +- private void setContextClassLoaderForAllThreads(ClassLoader classLoader) { +- ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); +- ThreadGroup root; +- +- root = Thread.currentThread().getThreadGroup(); +- while (root.getParent() != null) { +- root = root.getParent(); +- } ++ private void setContextClassLoaderForAllThreads(ThreadGroup tg, ClassLoader classLoader) { + + /* be prepared for change in thread size */ +- int threadCountGuess = threadBean.getThreadCount(); ++ int threadCountGuess = tg.activeCount(); + Thread[] threads; + do { + threadCountGuess = threadCountGuess * 2; + threads = new Thread[threadCountGuess]; +- root.enumerate(threads, true); ++ tg.enumerate(threads, true); + } while (threads[threadCountGuess-1] != null); + + +@@ -595,7 +589,7 @@ + group.setApplication(appletInstance); + loader.setApplication(appletInstance); + +- setContextClassLoaderForAllThreads(appletInstance.getClassLoader()); ++ setContextClassLoaderForAllThreads(appletInstance.getThreadGroup(), appletInstance.getClassLoader()); + + return appletInstance; + } +diff -r a0120629678b netx/net/sourceforge/jnlp/Parser.java +--- a/netx/net/sourceforge/jnlp/Parser.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/Parser.java Fri Jul 16 14:30:37 2010 +0200 +@@ -1169,11 +1169,15 @@ + Node jnlpNode = getChildNode(document, "jnlp"); // skip comments + */ + ++ //A BufferedInputStream is used to allow marking and reseting ++ //of a stream. ++ BufferedInputStream bs = new BufferedInputStream(input); ++ + /* NANO */ + final XMLElement xml = new XMLElement(); + final PipedInputStream pin = new PipedInputStream(); + final PipedOutputStream pout = new PipedOutputStream(pin); +- final InputStreamReader isr = new InputStreamReader(input); ++ final InputStreamReader isr = new InputStreamReader(bs, getEncoding(bs)); + // Clean the jnlp xml file of all comments before passing + // it to the parser. + new Thread( +@@ -1196,7 +1200,69 @@ + throw new ParseException(R("PBadXML"), ex); + } + } ++ ++ /** ++ * Returns the name of the encoding used in this InputStream. ++ * ++ * @param input the InputStream ++ * @return a String representation of encoding ++ */ ++ private static String getEncoding(InputStream input) throws IOException{ ++ //Fixme: This only recognizes UTF-8, UTF-16, and ++ //UTF-32, which is enough to parse the prolog portion of xml to ++ //find out the exact encoding (if it exists). The reason being ++ //there could be other encodings, such as ISO 8859 which is 8-bits ++ //but it supports latin characters. ++ //So what needs to be done is to parse the prolog and retrieve ++ //the exact encoding from it. + ++ int[] s = new int[4]; ++ String encoding = "UTF-8"; ++ ++ //Determine what the first four bytes are and store ++ //them into an int array. ++ input.mark(4); ++ for (int i = 0; i < 4; i++) { ++ s[i] = input.read(); ++ } ++ input.reset(); ++ ++ //Set the encoding base on what the first four bytes of the ++ //inputstream turn out to be (following the information from ++ //www.w3.org/TR/REC-xml/#sec-guessing). ++ if (s[0] == 255) { ++ if (s[1] == 254) { ++ if (s[2] != 0 || s[3] != 0) { ++ encoding = "UnicodeLittle"; ++ } else { ++ encoding = "X-UTF-32LE-BOM"; ++ } ++ } ++ } else if (s[0] == 254 && s[1] == 255 && (s[2] != 0 || ++ s[3] != 0)) { ++ encoding = "UTF-16"; ++ ++ } else if (s[0] == 0 && s[1] == 0 && s[2] == 254 && ++ s[3] == 255) { ++ encoding = "X-UTF-32BE-BOM"; ++ ++ } else if (s[0] == 0 && s[1] == 0 && s[2] == 0 && ++ s[3] == 60) { ++ encoding = "UTF-32BE"; ++ ++ } else if (s[0] == 60 && s[1] == 0 && s[2] == 0 && ++ s[3] == 0) { ++ encoding = "UTF-32LE"; ++ ++ } else if (s[0] == 0 && s[1] == 60 && s[2] == 0 && ++ s[3] == 63) { ++ encoding = "UTF-16BE"; ++ } else if (s[0] == 60 && s[1] == 0 && s[2] == 63 && ++ s[3] == 0) { ++ encoding = "UTF-16LE"; ++ } ++ ++ return encoding; ++ } + } + +- +diff -r a0120629678b netx/net/sourceforge/jnlp/SecurityDesc.java +--- a/netx/net/sourceforge/jnlp/SecurityDesc.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/SecurityDesc.java Fri Jul 16 14:30:37 2010 +0200 +@@ -31,12 +31,9 @@ + */ + public class SecurityDesc { + +- // todo: make sure classloader's native code support checks +- // the security permissions +- +- // shouldn't need to verify that native code only runs in +- // trusted environment because the parser and/or classloader +- // should kick it. ++ /* ++ * We do not verify security here, the classloader deals with security ++ */ + + /** All permissions. */ + public static final Object ALL_PERMISSIONS = "All"; +diff -r a0120629678b netx/net/sourceforge/jnlp/cache/CacheUtil.java +--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java Fri Jul 16 14:30:37 2010 +0200 +@@ -26,6 +26,7 @@ + + import net.sourceforge.jnlp.*; + import net.sourceforge.jnlp.runtime.*; ++import net.sourceforge.jnlp.util.FileUtils; + + /** + * Provides static methods to interact with the cache, download +@@ -300,23 +301,9 @@ + path.append(File.separatorChar); + path.append(location.getPath().replace('/', File.separatorChar)); + +- return new File(JNLPRuntime.getBaseDir(), fixPath(path.toString())); ++ return new File(JNLPRuntime.getBaseDir(), FileUtils.sanitizePath(path.toString())); + } + +- /** +- * Clean up a string by removing characters that can't appear in +- * a local file name. +- */ +- private static String fixPath(String path) { +- char badChars[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' }; +- +- for (int i=0; i < badChars.length; i++) +- if (badChars[i] != File.separatorChar) +- if (-1 != path.indexOf(badChars[i])) +- path = path.replace(badChars[i], 'X'); +- +- return path; +- } + + /** + * Waits until the resources are downloaded, while showing a +diff -r a0120629678b netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java +--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Fri Jul 16 14:30:37 2010 +0200 +@@ -32,6 +32,7 @@ + import java.security.Permissions; + import java.security.PrivilegedAction; + import java.util.ArrayList; ++import java.util.Collections; + import java.util.Enumeration; + import java.util.HashMap; + import java.util.LinkedList; +@@ -80,12 +81,12 @@ + /** map from JNLPFile url to shared classloader */ + private static Map urlToLoader = new HashMap(); // never garbage collected! + +- /** number of times a classloader with native code is created */ +- private static int nativeCounter = 0; +- + /** the directory for native code */ + private File nativeDir = null; // if set, some native code exists + ++ /** a list of directories that contain native libraries */ ++ private List nativeDirectories = Collections.synchronizedList(new LinkedList()); ++ + /** security context */ + private AccessControlContext acc = AccessController.getContext(); + +@@ -240,18 +241,22 @@ + // loader for this unique key. Check. + JNLPClassLoader extLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey); + +- if (extLoader != null) { ++ if (extLoader != null && extLoader != loader) { + for (URL u : loader.getURLs()) + extLoader.addURL(u); ++ for (File nativeDirectory: loader.getNativeDirectories()) ++ extLoader.addNativeDirectory(nativeDirectory); + + loader = extLoader; + } + + // loader is now current + ext. But we also need to think of + // the baseLoader +- if (baseLoader != null) { ++ if (baseLoader != null && baseLoader != loader) { + for (URL u : loader.getURLs()) + baseLoader.addURL(u); ++ for (File nativeDirectory: loader.getNativeDirectories()) ++ baseLoader.addNativeDirectory(nativeDirectory); + + loader = baseLoader; + } +@@ -642,8 +647,8 @@ + ex.printStackTrace(); + } + +- if (jar.isNative()) +- activateNative(jar); ++ // some programs place a native library in any jar ++ activateNative(jar); + } + + return null; +@@ -654,9 +659,9 @@ + } + + /** +- * Enable the native code contained in a JAR by copying the +- * native files into the filesystem. Called in the security +- * context of the classloader. ++ * Search for and enable any native code contained in a JAR by copying the ++ * native files into the filesystem. Called in the security context of the ++ * classloader. + */ + protected void activateNative(JARDesc jar) { + if (JNLPRuntime.isDebug()) +@@ -669,17 +674,33 @@ + if (nativeDir == null) + nativeDir = getNativeDir(); + ++ String[] librarySuffixes = { ".so", ".dylib", ".jnilib", ".framework", ".dll" }; ++ + try { + JarFile jarFile = new JarFile(localFile, false); +- Enumeration entries = jarFile.entries(); ++ Enumeration entries = jarFile.entries(); + + while (entries.hasMoreElements()) { +- JarEntry e = (JarEntry) entries.nextElement(); ++ JarEntry e = entries.nextElement(); + +- if (e.isDirectory() || e.getName().indexOf('/') != -1) ++ if (e.isDirectory()) { + continue; ++ } + +- File outFile = new File(nativeDir, e.getName()); ++ String name = new File(e.getName()).getName(); ++ boolean isLibrary = false; ++ ++ for (String suffix: librarySuffixes) { ++ if (name.endsWith(suffix)) { ++ isLibrary = true; ++ break; ++ } ++ } ++ if (!isLibrary) { ++ continue; ++ } ++ ++ File outFile = new File(nativeDir, name); + + CacheUtil.streamCopy(jarFile.getInputStream(e), + new FileOutputStream(outFile)); +@@ -703,29 +724,47 @@ + + if (!nativeDir.mkdirs()) + return null; +- else ++ else { ++ // add this new native directory to the search path ++ addNativeDirectory(nativeDir); + return nativeDir; ++ } ++ } ++ ++ /** ++ * Adds the {@link File} to the search path of this {@link JNLPClassLoader} ++ * when trying to find a native library ++ */ ++ protected void addNativeDirectory(File nativeDirectory) { ++ nativeDirectories.add(nativeDirectory); ++ } ++ ++ /** ++ * Returns a list of all directories in the search path of the current classloader ++ * when it tires to find a native library. ++ * @return a list of directories in the search path for native libraries ++ */ ++ protected List getNativeDirectories() { ++ return nativeDirectories; + } + + /** + * Return the absolute path to the native library. + */ + protected String findLibrary(String lib) { +- if (nativeDir == null) +- return null; +- + String syslib = System.mapLibraryName(lib); + +- File target = new File(nativeDir, syslib); +- if (target.exists()) +- return target.toString(); +- else { +- String result = super.findLibrary(lib); +- if (result != null) +- return result; ++ for (File dir: getNativeDirectories()) { ++ File target = new File(dir, syslib); ++ if (target.exists()) ++ return target.toString(); ++ } + +- return findLibraryExt(lib); +- } ++ String result = super.findLibrary(lib); ++ if (result != null) ++ return result; ++ ++ return findLibraryExt(lib); + } + + /** +diff -r a0120629678b netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java +--- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Fri Jul 16 14:30:37 2010 +0200 +@@ -23,10 +23,12 @@ + import java.awt.event.WindowEvent; + import java.lang.ref.WeakReference; + import java.net.SocketPermission; ++import java.security.AllPermission; + import java.security.AccessControlException; + import java.security.AccessController; + import java.security.Permission; + import java.security.PrivilegedAction; ++import java.security.SecurityPermission; + import java.util.PropertyPermission; + + import javax.swing.JWindow; +@@ -395,6 +397,24 @@ + // Everything else is denied + throw se; + ++ } else if (perm instanceof SecurityPermission) { ++ ++ // JCE's initialization requires putProviderProperty permission ++ if (perm.equals(new SecurityPermission("putProviderProperty.SunJCE"))) { ++ if (inTrustedCallChain("com.sun.crypto.provider.SunJCE", "run")) { ++ return; ++ } ++ } ++ ++ } else if (perm instanceof RuntimePermission) { ++ ++ // KeyGenerator's init method requires internal spec access ++ if (perm.equals(new SecurityPermission("accessClassInPackage.sun.security.internal.spec"))) { ++ if (inTrustedCallChain("javax.crypto.KeyGenerator", "init")) { ++ return; ++ } ++ } ++ + } else { + tmpPerm = perm; + } +@@ -419,6 +439,34 @@ + } + } + ++ /** ++ * Returns weather the given class and method are in the current stack, ++ * and whether or not everything upto then is trusted ++ * ++ * @param className The name of the class to look for in the stack ++ * @param methodName The name of the method for the given class to look for in the stack ++ * @return Weather or not class::method() are in the chain, and everything upto there is trusted ++ */ ++ private boolean inTrustedCallChain(String className, String methodName) { ++ ++ StackTraceElement[] stack = Thread.currentThread().getStackTrace(); ++ ++ for (int i=0; i < stack.length; i++) { ++ ++ // Everything up to the desired class/method must be trusted ++ if (!stack[i].getClass().getProtectionDomain().implies(new AllPermission())) { ++ return false; ++ } ++ ++ if (stack[i].getClassName().equals(className) && ++ stack[i].getMethodName().equals(methodName)) { ++ return true; ++ } ++ } ++ ++ return false; ++ } ++ + /** + * Asks the user whether or not to grant permission. + * @param perm the permission to be granted +diff -r a0120629678b netx/net/sourceforge/jnlp/services/XSingleInstanceService.java +--- a/netx/net/sourceforge/jnlp/services/XSingleInstanceService.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/services/XSingleInstanceService.java Fri Jul 16 14:30:37 2010 +0200 +@@ -145,14 +145,21 @@ + } + + /** +- * Start the listening server to accept arguments from new isntances of ++ * Start the listening server to accept arguments from new instances of + * applications + * + * @param lockFile ++ * the {@link SingleInstanceLock} that the server should use + */ + private void startListeningServer(SingleInstanceLock lockFile) { + SingleInstanceServer server = new SingleInstanceServer(lockFile); +- new Thread(server).start(); ++ Thread serverThread = new Thread(server); ++ /* ++ * mark as daemon so the JVM can shutdown if the server is the only ++ * thread running ++ */ ++ serverThread.setDaemon(true); ++ serverThread.start(); + } + + /** +diff -r a0120629678b netx/net/sourceforge/jnlp/util/FileUtils.java +--- a/netx/net/sourceforge/jnlp/util/FileUtils.java Wed Apr 14 12:21:03 2010 +0200 ++++ b/netx/net/sourceforge/jnlp/util/FileUtils.java Fri Jul 16 14:30:37 2010 +0200 +@@ -14,35 +14,58 @@ + // License along with this library; if not, write to the Free Software + // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +- + package net.sourceforge.jnlp.util; + ++import java.io.File; ++ + /** +- * This class contains a few file-related utility functions. ++ * This class contains a few file-related utility functions. + * + * @author Omair Majid + */ + +-public class FileUtils { ++public final class FileUtils { + +- ++ /** ++ * list of characters not allowed in filenames ++ */ ++ private static final char INVALID_CHARS[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' }; ++ ++ private static final char SANITIZED_CHAR = '_'; ++ ++ /** ++ * Clean up a string by removing characters that can't appear in a local ++ * file name. ++ * ++ * @param path ++ * the path to sanitize ++ * @return a sanitized version of the input which is suitable for using as a ++ * file path ++ */ ++ public static String sanitizePath(String path) { ++ ++ for (int i = 0; i < INVALID_CHARS.length; i++) ++ if (INVALID_CHARS[i] != File.separatorChar) ++ if (-1 != path.indexOf(INVALID_CHARS[i])) ++ path = path.replace(INVALID_CHARS[i], SANITIZED_CHAR); ++ ++ return path; ++ } ++ + /** + * Given an input, return a sanitized form of the input suitable for use as + * a file/directory name +- * ++ * + * @param input + * @return a sanitized version of the input + */ +- public static String sanitizeFileName(String input) { ++ public static String sanitizeFileName(String filename) { + +- /* +- * FIXME +- * +- * Assuming safe characters are 'a-z','A-Z','0-9', '_', '.' +- */ ++ for (int i = 0; i < INVALID_CHARS.length; i++) ++ if (-1 != filename.indexOf(INVALID_CHARS[i])) ++ filename = filename.replace(INVALID_CHARS[i], SANITIZED_CHAR); + +- String sanitizedName = input.replaceAll("[^a-zA-Z0-9.]", "_"); +- return sanitizedName; ++ return filename; + } +- ++ + } +diff -r a0120629678b patches/systemtap-gcc-4.5.patch +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/patches/systemtap-gcc-4.5.patch Fri Jul 16 14:30:37 2010 +0200 +@@ -0,0 +1,11 @@ ++--- openjdk.orig/hotspot/src/share/vm/prims/jni.cpp 2010-04-28 08:51:29.000000000 +0100 +++++ openjdk/hotspot/src/share/vm/prims/jni.cpp 2010-04-28 09:29:22.000000000 +0100 ++@@ -2723,7 +2723,7 @@ ++ ++ if (!directBufferSupportInitializeEnded) { ++ if (!initializeDirectBufferSupport(env, thread)) { ++- DTRACE_PROBE1(hotspot_jni, NewDirectByteBuffer__return, NULL); +++ DTRACE_PROBE1(hotspot_jni, NewDirectByteBuffer__return, (uintptr_t) NULL); ++ return NULL; ++ } ++ } +diff -r a0120629678b plugin/icedteanp/IcedTeaJavaRequestProcessor.cc +--- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Wed Apr 14 12:21:03 2010 +0200 ++++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc Fri Jul 16 14:30:37 2010 +0200 +@@ -179,7 +179,7 @@ + + JavaRequestProcessor::JavaRequestProcessor() + { +- PLUGIN_DEBUG_0ARG("JavaRequestProcessor constructor\n"); ++ PLUGIN_DEBUG("JavaRequestProcessor constructor\n"); + + // caller frees this + result = new JavaResultData(); +@@ -200,7 +200,7 @@ + + JavaRequestProcessor::~JavaRequestProcessor() + { +- PLUGIN_DEBUG_0ARG("JavaRequestProcessor::~JavaRequestProcessor\n"); ++ PLUGIN_DEBUG("JavaRequestProcessor::~JavaRequestProcessor\n"); + + if (result) + { +@@ -271,7 +271,7 @@ + result->error_msg->append("Error: Timed out when waiting for response"); + + // Report error +- PLUGIN_DEBUG_1ARG("Error: Timed out when waiting for response to %s\n", message.c_str()); ++ PLUGIN_DEBUG("Error: Timed out when waiting for response to %s\n", message.c_str()); + } + + java_to_plugin_bus->unSubscribe(this); +@@ -847,12 +847,12 @@ + + if (NPVARIANT_IS_VOID(variant)) + { +- PLUGIN_DEBUG_1ARG("VOID %d\n", variant); ++ PLUGIN_DEBUG("VOID %d\n", variant); + id->append("0"); + return; // no need to go further + } else if (NPVARIANT_IS_NULL(variant)) + { +- PLUGIN_DEBUG_1ARG("NULL\n", variant); ++ PLUGIN_DEBUG("NULL\n", variant); + id->append("0"); + return; // no need to go further + } else if (NPVARIANT_IS_BOOLEAN(variant)) +@@ -894,18 +894,18 @@ + NPObject* obj = NPVARIANT_TO_OBJECT(variant); + if (IcedTeaScriptableJavaPackageObject::is_valid_java_object(obj)) + { +- PLUGIN_DEBUG_0ARG("NPObject is a Java object\n"); ++ PLUGIN_DEBUG("NPObject is a Java object\n"); + alreadyCreated = true; + } else + { +- PLUGIN_DEBUG_0ARG("NPObject is not a Java object\n"); ++ PLUGIN_DEBUG("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? + + // Is it an array? + if (IcedTeaPluginUtilities::isObjectJSArray(instance, obj)) { +- PLUGIN_DEBUG_0ARG("NPObject is an array\n"); ++ PLUGIN_DEBUG("NPObject is an array\n"); + + std::string array_id = std::string(); + std::string java_array_type = std::string(); +diff -r a0120629678b plugin/icedteanp/IcedTeaNPPlugin.cc +--- a/plugin/icedteanp/IcedTeaNPPlugin.cc Wed Apr 14 12:21:03 2010 +0200 ++++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Fri Jul 16 14:30:37 2010 +0200 +@@ -262,7 +262,7 @@ + int16_t argc, char* argn[], char* argv[], + NPSavedData* saved) + { +- PLUGIN_DEBUG_0ARG("ITNP_New\n"); ++ PLUGIN_DEBUG("ITNP_New\n"); + + static NPObject *window_ptr; + NPIdentifier identifier; +@@ -275,7 +275,7 @@ + } + browser_functions.getproperty(instance, window_ptr, identifier, &member_ptr); + +- PLUGIN_DEBUG_1ARG("Got variant %p\n", &member_ptr); ++ PLUGIN_DEBUG("Got variant %p\n", &member_ptr); + + + NPError np_error = NPERR_NO_ERROR; +@@ -395,12 +395,12 @@ + documentbase = NULL; + + // store an identifier for this plugin +- PLUGIN_DEBUG_2ARG("Mapping id %d and instance %p\n", instance_counter, instance); ++ PLUGIN_DEBUG("Mapping id %d and instance %p\n", instance_counter, instance); + g_hash_table_insert(instance_to_id_map, instance, GINT_TO_POINTER(instance_counter)); + g_hash_table_insert(id_to_instance_map, GINT_TO_POINTER(instance_counter), instance); + instance_counter++; + +- PLUGIN_DEBUG_0ARG ("ITNP_New return\n"); ++ PLUGIN_DEBUG ("ITNP_New return\n"); + + return np_error; + } +@@ -415,16 +415,16 @@ + GMutex *vm_start_mutex = g_mutex_new(); + g_mutex_lock(vm_start_mutex); + +- PLUGIN_DEBUG_0ARG("Checking JVM status...\n"); ++ PLUGIN_DEBUG("Checking JVM status...\n"); + + // If the jvm is already up, do nothing + if (jvm_up) + { +- PLUGIN_DEBUG_0ARG("JVM is up. Returning.\n"); ++ PLUGIN_DEBUG("JVM is up. Returning.\n"); + return; + } + +- PLUGIN_DEBUG_0ARG("No JVM is running. Attempting to start one...\n"); ++ PLUGIN_DEBUG("No JVM is running. Attempting to start one...\n"); + + NPError np_error = NPERR_NO_ERROR; + ITNPPluginData* data = NULL; +@@ -447,14 +447,14 @@ + // clean up any older pip + unlink (in_pipe_name); + +- PLUGIN_DEBUG_1ARG ("ITNP_New: creating input fifo: %s\n", in_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: creating input fifo: %s\n", in_pipe_name); + if (mkfifo (in_pipe_name, 0600) == -1 && errno != EEXIST) + { + PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno)); + np_error = NPERR_GENERIC_ERROR; + goto cleanup_in_pipe_name; + } +- PLUGIN_DEBUG_1ARG ("ITNP_New: created input fifo: %s\n", in_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: created input fifo: %s\n", in_pipe_name); + + // Create plugin-to-appletviewer pipe which we refer to as the + // output pipe. +@@ -473,14 +473,14 @@ + // clean up any older pip + unlink (out_pipe_name); + +- PLUGIN_DEBUG_1ARG ("ITNP_New: creating output fifo: %s\n", out_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: creating output fifo: %s\n", out_pipe_name); + if (mkfifo (out_pipe_name, 0600) == -1 && errno != EEXIST) + { + PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno)); + np_error = NPERR_GENERIC_ERROR; + goto cleanup_out_pipe_name; + } +- PLUGIN_DEBUG_1ARG ("ITNP_New: created output fifo: %s\n", out_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: created output fifo: %s\n", out_pipe_name); + + // Start a separate appletviewer process for each applet, even if + // there are multiple applets in the same page. We may need to +@@ -571,9 +571,9 @@ + + // cleanup_out_pipe: + // Delete output pipe. +- PLUGIN_DEBUG_1ARG ("ITNP_New: deleting input fifo: %s\n", in_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: deleting input fifo: %s\n", in_pipe_name); + unlink (out_pipe_name); +- PLUGIN_DEBUG_1ARG ("ITNP_New: deleted input fifo: %s\n", in_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: deleted input fifo: %s\n", in_pipe_name); + + cleanup_out_pipe_name: + g_free (out_pipe_name); +@@ -581,9 +581,9 @@ + + // cleanup_in_pipe: + // Delete input pipe. +- PLUGIN_DEBUG_1ARG ("ITNP_New: deleting output fifo: %s\n", out_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: deleting output fifo: %s\n", out_pipe_name); + unlink (in_pipe_name); +- PLUGIN_DEBUG_1ARG ("ITNP_New: deleted output fifo: %s\n", out_pipe_name); ++ PLUGIN_DEBUG ("ITNP_New: deleted output fifo: %s\n", out_pipe_name); + + cleanup_in_pipe_name: + g_free (in_pipe_name); +@@ -599,7 +599,7 @@ + NPError + ITNP_GetValue (NPP instance, NPPVariable variable, void* value) + { +- PLUGIN_DEBUG_0ARG ("ITNP_GetValue\n"); ++ PLUGIN_DEBUG ("ITNP_GetValue\n"); + + NPError np_error = NPERR_NO_ERROR; + +@@ -608,7 +608,7 @@ + // This plugin needs XEmbed support. + case NPPVpluginNeedsXEmbed: + { +- PLUGIN_DEBUG_0ARG ("ITNP_GetValue: returning TRUE for NeedsXEmbed.\n"); ++ PLUGIN_DEBUG ("ITNP_GetValue: returning TRUE for NeedsXEmbed.\n"); + bool* bool_value = (bool*) value; + *bool_value = true; + } +@@ -624,7 +624,7 @@ + break; + } + +- PLUGIN_DEBUG_0ARG ("ITNP_GetValue return\n"); ++ PLUGIN_DEBUG ("ITNP_GetValue return\n"); + + return np_error; + } +@@ -632,7 +632,7 @@ + NPError + ITNP_Destroy (NPP instance, NPSavedData** save) + { +- PLUGIN_DEBUG_1ARG ("ITNP_Destroy %p\n", instance); ++ PLUGIN_DEBUG ("ITNP_Destroy %p\n", instance); + + ITNPPluginData* data = (ITNPPluginData*) instance->pdata; + +@@ -649,7 +649,7 @@ + + IcedTeaPluginUtilities::invalidateInstance(instance); + +- PLUGIN_DEBUG_0ARG ("ITNP_Destroy return\n"); ++ PLUGIN_DEBUG ("ITNP_Destroy return\n"); + + return NPERR_NO_ERROR; + } +@@ -657,7 +657,7 @@ + NPError + ITNP_SetWindow (NPP instance, NPWindow* window) + { +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow\n"); + + if (instance == NULL) + { +@@ -679,7 +679,7 @@ + // Simply return if we receive a NULL window. + if ((window == NULL) || (window->window == NULL)) + { +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: got NULL window.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: got NULL window.\n"); + + return NPERR_NO_ERROR; + } +@@ -690,7 +690,7 @@ + if (data->window_handle == window->window) + { + // The parent window is the same as in previous calls. +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: window already exists.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: window already exists.\n"); + + // Critical region. Read data->appletviewer_mutex and send + // a message to the appletviewer. +@@ -704,7 +704,7 @@ + // SetWindow call. + if (window->width != data->window_width) + { +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: window width changed.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: window width changed.\n"); + // The width of the plugin window has changed. + + // Store the new width. +@@ -714,7 +714,7 @@ + + if (window->height != data->window_height) + { +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: window height changed.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: window height changed.\n"); + // The height of the plugin window has changed. + + // Store the new height. +@@ -736,7 +736,7 @@ + else + { + // The appletviewer is not running. +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: appletviewer is not running.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: appletviewer is not running.\n"); + } + + g_mutex_unlock (data->appletviewer_mutex); +@@ -745,12 +745,12 @@ + { + // The parent window has changed. This branch does run but + // doing nothing in response seems to be sufficient. +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: parent window changed.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: parent window changed.\n"); + } + } + else + { +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow: setting window.\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow: setting window.\n"); + + // Critical region. Send messages to appletviewer. + g_mutex_lock (data->appletviewer_mutex); +@@ -774,7 +774,7 @@ + data->window_handle = window->window; + } + +- PLUGIN_DEBUG_0ARG ("ITNP_SetWindow return\n"); ++ PLUGIN_DEBUG ("ITNP_SetWindow return\n"); + + return NPERR_NO_ERROR; + } +@@ -783,9 +783,9 @@ + ITNP_NewStream (NPP instance, NPMIMEType type, NPStream* stream, + NPBool seekable, uint16_t* stype) + { +- PLUGIN_DEBUG_0ARG ("ITNP_NewStream\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_NewStream return\n"); ++ PLUGIN_DEBUG ("ITNP_NewStream\n"); ++ ++ PLUGIN_DEBUG ("ITNP_NewStream return\n"); + + return NPERR_NO_ERROR; + } +@@ -793,17 +793,17 @@ + void + ITNP_StreamAsFile (NPP instance, NPStream* stream, const char* filename) + { +- PLUGIN_DEBUG_0ARG ("ITNP_StreamAsFile\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_StreamAsFile return\n"); ++ PLUGIN_DEBUG ("ITNP_StreamAsFile\n"); ++ ++ PLUGIN_DEBUG ("ITNP_StreamAsFile return\n"); + } + + NPError + ITNP_DestroyStream (NPP instance, NPStream* stream, NPReason reason) + { +- PLUGIN_DEBUG_0ARG ("ITNP_DestroyStream\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_DestroyStream return\n"); ++ PLUGIN_DEBUG ("ITNP_DestroyStream\n"); ++ ++ PLUGIN_DEBUG ("ITNP_DestroyStream return\n"); + + return NPERR_NO_ERROR; + } +@@ -811,9 +811,9 @@ + int32_t + ITNP_WriteReady (NPP instance, NPStream* stream) + { +- PLUGIN_DEBUG_0ARG ("ITNP_WriteReady\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_WriteReady return\n"); ++ PLUGIN_DEBUG ("ITNP_WriteReady\n"); ++ ++ PLUGIN_DEBUG ("ITNP_WriteReady return\n"); + + return 0; + } +@@ -822,9 +822,9 @@ + ITNP_Write (NPP instance, NPStream* stream, int32_t offset, int32_t len, + void* buffer) + { +- PLUGIN_DEBUG_0ARG ("ITNP_Write\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_Write return\n"); ++ PLUGIN_DEBUG ("ITNP_Write\n"); ++ ++ PLUGIN_DEBUG ("ITNP_Write return\n"); + + return 0; + } +@@ -832,17 +832,17 @@ + void + ITNP_Print (NPP instance, NPPrint* platformPrint) + { +- PLUGIN_DEBUG_0ARG ("ITNP_Print\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_Print return\n"); ++ PLUGIN_DEBUG ("ITNP_Print\n"); ++ ++ PLUGIN_DEBUG ("ITNP_Print return\n"); + } + + int16_t + ITNP_HandleEvent (NPP instance, void* event) + { +- PLUGIN_DEBUG_0ARG ("ITNP_HandleEvent\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_HandleEvent return\n"); ++ PLUGIN_DEBUG ("ITNP_HandleEvent\n"); ++ ++ PLUGIN_DEBUG ("ITNP_HandleEvent return\n"); + + return 0; + } +@@ -851,9 +851,9 @@ + ITNP_URLNotify (NPP instance, const char* url, NPReason reason, + void* notifyData) + { +- PLUGIN_DEBUG_0ARG ("ITNP_URLNotify\n"); +- +- PLUGIN_DEBUG_0ARG ("ITNP_URLNotify return\n"); ++ PLUGIN_DEBUG ("ITNP_URLNotify\n"); ++ ++ PLUGIN_DEBUG ("ITNP_URLNotify return\n"); + } + + NPError +@@ -924,7 +924,7 @@ + static void + plugin_data_new (ITNPPluginData** data) + { +- PLUGIN_DEBUG_0ARG ("plugin_data_new\n"); ++ PLUGIN_DEBUG ("plugin_data_new\n"); + + *data = (ITNPPluginData*) + (*browser_functions.memalloc) (sizeof (struct ITNPPluginData)); +@@ -933,7 +933,7 @@ + if (*data) + memset (*data, 0, sizeof (struct ITNPPluginData)); + +- PLUGIN_DEBUG_0ARG ("plugin_data_new return\n"); ++ PLUGIN_DEBUG ("plugin_data_new return\n"); + } + + +@@ -948,7 +948,7 @@ + static gchar* + plugin_get_documentbase (NPP instance) + { +- PLUGIN_DEBUG_0ARG ("plugin_get_documentbase\n"); ++ PLUGIN_DEBUG ("plugin_get_documentbase\n"); + + nsIPluginInstance* xpcom_instance = NULL; + nsIPluginInstancePeer* peer = NULL; +@@ -1000,16 +1000,16 @@ + NS_RELEASE (peer); + + cleanup_done: +- PLUGIN_DEBUG_0ARG ("plugin_get_documentbase return\n"); +- +- PLUGIN_DEBUG_1ARG("plugin_get_documentbase returning: %s\n", documentbase_copy); ++ PLUGIN_DEBUG ("plugin_get_documentbase return\n"); ++ ++ PLUGIN_DEBUG("plugin_get_documentbase returning: %s\n", documentbase_copy); + return documentbase_copy; + } + #else + static gchar* + plugin_get_documentbase (NPP instance) + { +- PLUGIN_DEBUG_0ARG ("plugin_get_documentbase\n"); ++ PLUGIN_DEBUG ("plugin_get_documentbase\n"); + + char const* documentbase = NULL; + gchar* documentbase_copy = NULL; +@@ -1021,30 +1021,26 @@ + // Additionally, since it is insecure, we cannot use it for making + // security decisions. + NPObject* window; +- NPString script = NPString(); +- std::string script_str = std::string(); +- NPVariant* location = new NPVariant(); +- std::string location_str = std::string(); +- + browser_functions.getvalue(instance, NPNVWindowNPObject, &window); +- script_str += "window.location.href"; +-#if MOZILLA_VERSION_COLLAPSED < 1090200 +- script.utf8characters = script_str.c_str(); +- script.utf8length = script_str.size(); +-#else +- script.UTF8Characters = script_str.c_str(); +- script.UTF8Length = script_str.size(); +-#endif +- browser_functions.evaluate(instance, window, &script, location); ++ ++ NPVariant location; ++ NPIdentifier location_id = browser_functions.getstringidentifier("location"); ++ browser_functions.getproperty(instance, window, location_id, &location); ++ ++ NPVariant href; ++ NPIdentifier href_id = browser_functions.getstringidentifier("href"); ++ browser_functions.getproperty(instance, NPVARIANT_TO_OBJECT(location), ++ href_id, &href); + + // Strip everything after the last "/" + #if MOZILLA_VERSION_COLLAPSED < 1090200 +- gchar** parts = g_strsplit (NPVARIANT_TO_STRING(*location).utf8characters, "/", -1); ++ gchar** parts = g_strsplit (NPVARIANT_TO_STRING(href).utf8characters, "/", -1); + #else +- gchar** parts = g_strsplit (NPVARIANT_TO_STRING(*location).UTF8Characters, "/", -1); ++ gchar** parts = g_strsplit (NPVARIANT_TO_STRING(href).UTF8Characters, "/", -1); + #endif + guint parts_sz = g_strv_length (parts); + ++ std::string location_str; + for (int i=0; i < parts_sz - 1; i++) + { + location_str += parts[i]; +@@ -1054,9 +1050,11 @@ + documentbase_copy = g_strdup (location_str.c_str()); + + // Release references. ++ browser_functions.releasevariantvalue(&href); ++ browser_functions.releasevariantvalue(&location); + cleanup_done: +- PLUGIN_DEBUG_0ARG ("plugin_get_documentbase return\n"); +- PLUGIN_DEBUG_1ARG("plugin_get_documentbase returning: %s\n", documentbase_copy); ++ PLUGIN_DEBUG ("plugin_get_documentbase return\n"); ++ PLUGIN_DEBUG("plugin_get_documentbase returning: %s\n", documentbase_copy); + + return documentbase_copy; + } +@@ -1069,7 +1067,7 @@ + { + GtkWidget* dialog = NULL; + +- PLUGIN_DEBUG_0ARG ("plugin_display_failure_dialog\n"); ++ PLUGIN_DEBUG ("plugin_display_failure_dialog\n"); + + dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, +@@ -1081,7 +1079,7 @@ + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + +- PLUGIN_DEBUG_0ARG ("plugin_display_failure_dialog return\n"); ++ PLUGIN_DEBUG ("plugin_display_failure_dialog return\n"); + } + + +@@ -1095,7 +1093,7 @@ + GIOCondition condition, + gpointer plugin_data) + { +- PLUGIN_DEBUG_0ARG ("plugin_in_pipe_callback\n"); ++ PLUGIN_DEBUG ("plugin_in_pipe_callback\n"); + + gboolean keep_installed = TRUE; + +@@ -1130,18 +1128,18 @@ + + if (condition & (G_IO_ERR | G_IO_HUP)) + { +- PLUGIN_DEBUG_0ARG ("appletviewer has stopped.\n"); ++ PLUGIN_DEBUG ("appletviewer has stopped.\n"); + keep_installed = FALSE; + } + +- PLUGIN_DEBUG_0ARG ("plugin_in_pipe_callback return\n"); ++ PLUGIN_DEBUG ("plugin_in_pipe_callback return\n"); + + return keep_installed; + } + + void consume_message(gchar* message) { + +- PLUGIN_DEBUG_1ARG (" PIPE: plugin read: %s\n", message); ++ PLUGIN_DEBUG (" PIPE: plugin read: %s\n", message); + + if (g_str_has_prefix (message, "instance")) + { +@@ -1156,7 +1154,7 @@ + + if (instance_id > 0 && !instance) + { +- PLUGIN_DEBUG_2ARG("Instance %d is not active. Refusing to consume message \"%s\"\n", instance_id, message); ++ PLUGIN_DEBUG("Instance %d is not active. Refusing to consume message \"%s\"\n", instance_id, message); + return; + } + else if (instance) +@@ -1170,8 +1168,8 @@ + gchar* decoded_url = (gchar*) calloc(strlen(parts[3]) + 1, sizeof(gchar)); + IcedTeaPluginUtilities::decodeURL(parts[3], &decoded_url); + +- PLUGIN_DEBUG_1ARG ("plugin_in_pipe_callback: opening URL %s\n", decoded_url); +- PLUGIN_DEBUG_1ARG ("plugin_in_pipe_callback: URL target %s\n", parts[4]); ++ PLUGIN_DEBUG ("plugin_in_pipe_callback: opening URL %s\n", decoded_url); ++ PLUGIN_DEBUG ("plugin_in_pipe_callback: URL target %s\n", parts[4]); + + NPError np_error = + (*browser_functions.geturl) (data->owner, decoded_url, parts[4]); +@@ -1193,7 +1191,7 @@ + + // join the rest + gchar* status_message = g_strjoinv(" ", parts); +- PLUGIN_DEBUG_1ARG ("plugin_in_pipe_callback: setting status %s\n", status_message); ++ PLUGIN_DEBUG ("plugin_in_pipe_callback: setting status %s\n", status_message); + (*browser_functions.status) (data->owner, status_message); + + g_free(status_message); +@@ -1229,7 +1227,7 @@ + + gchar* decoded_url = (gchar*) calloc(strlen(parts[4]) + 1, sizeof(gchar)); + IcedTeaPluginUtilities::decodeURL(parts[4], &decoded_url); +- PLUGIN_DEBUG_5ARG("parts[0]=%s, parts[1]=%s, reference, parts[3]=%s, parts[4]=%s -- decoded_url=%s\n", parts[0], parts[1], parts[3], parts[4], decoded_url); ++ PLUGIN_DEBUG("parts[0]=%s, parts[1]=%s, reference, parts[3]=%s, parts[4]=%s -- decoded_url=%s\n", parts[0], parts[1], parts[3], parts[4], decoded_url); + + gchar* proxy_info; + +@@ -1243,7 +1241,7 @@ + proxy_info = g_strconcat (proxy_info, proxy, NULL); + } + +- PLUGIN_DEBUG_1ARG("Proxy info: %s\n", proxy_info); ++ PLUGIN_DEBUG("Proxy info: %s\n", proxy_info); + plugin_send_message_to_appletviewer(proxy_info); + + g_free(decoded_url); +@@ -1269,7 +1267,7 @@ + cookie_info = g_strconcat (cookie_info, cookie_string, NULL); + } + +- PLUGIN_DEBUG_1ARG("Cookie info: %s\n", cookie_info); ++ PLUGIN_DEBUG("Cookie info: %s\n", cookie_info); + plugin_send_message_to_appletviewer(cookie_info); + + g_free(decoded_url); +@@ -1294,7 +1292,7 @@ + { + int id = GPOINTER_TO_INT(g_hash_table_lookup(instance_to_id_map, + instance)); +- PLUGIN_DEBUG_2ARG("Returning id %d for instance %p\n", id, instance); ++ PLUGIN_DEBUG("Returning id %d for instance %p\n", id, instance); + return id; + } + +@@ -1329,7 +1327,7 @@ + + // if there is no proxy found, return immediately + if (!info) { +- PLUGIN_DEBUG_1ARG("%s does not need a proxy\n", siteAddr); ++ PLUGIN_DEBUG("%s does not need a proxy\n", siteAddr); + return NPERR_GENERIC_ERROR; + } + +@@ -1367,7 +1365,7 @@ + + *len = strlen(*proxy); + +- PLUGIN_DEBUG_2ARG("Proxy info for %s: %s\n", siteAddr, *proxy); ++ PLUGIN_DEBUG("Proxy info for %s: %s\n", siteAddr, *proxy); + + #else + +@@ -1400,13 +1398,13 @@ + GIOCondition condition, + gpointer plugin_data) + { +- PLUGIN_DEBUG_0ARG ("plugin_out_pipe_callback\n"); ++ PLUGIN_DEBUG ("plugin_out_pipe_callback\n"); + + ITNPPluginData* data = (ITNPPluginData*) plugin_data; + +- PLUGIN_DEBUG_0ARG ("plugin_out_pipe_callback: appletviewer has stopped.\n"); +- +- PLUGIN_DEBUG_0ARG ("plugin_out_pipe_callback return\n"); ++ PLUGIN_DEBUG ("plugin_out_pipe_callback: appletviewer has stopped.\n"); ++ ++ PLUGIN_DEBUG ("plugin_out_pipe_callback return\n"); + + return FALSE; + } +@@ -1449,12 +1447,12 @@ + + if (path_new == NULL || strlen (path_new) == 0) + { +- PLUGIN_DEBUG_0ARG("Unset LD_LIBRARY_PATH\n"); ++ PLUGIN_DEBUG("Unset LD_LIBRARY_PATH\n"); + return NULL; + } + else + { +- PLUGIN_DEBUG_1ARG ("Set LD_LIBRARY_PATH: %s\n", path_new); ++ PLUGIN_DEBUG ("Set LD_LIBRARY_PATH: %s\n", path_new); + return path_new; + } + } +@@ -1464,7 +1462,7 @@ + plugin_filter_environment(void) + { + gchar **var_names = g_listenv(); +- gchar **new_env = (gchar**) malloc(sizeof(gchar*) * g_strv_length (var_names)); ++ gchar **new_env = (gchar**) malloc(sizeof(gchar*) * (g_strv_length (var_names) + 1)); + int i_var, i_env; + + for (i_var = 0, i_env = 0; var_names[i_var] != NULL; i_var++) +@@ -1486,7 +1484,7 @@ + static NPError + plugin_test_appletviewer () + { +- PLUGIN_DEBUG_1ARG ("plugin_test_appletviewer: %s\n", appletviewer_executable); ++ PLUGIN_DEBUG ("plugin_test_appletviewer: %s\n", appletviewer_executable); + NPError error = NPERR_NO_ERROR; + + gchar* command_line[3] = { NULL, NULL, NULL }; +@@ -1523,14 +1521,14 @@ + g_free (command_line[2]); + command_line[2] = NULL; + +- PLUGIN_DEBUG_0ARG ("plugin_test_appletviewer return\n"); ++ PLUGIN_DEBUG ("plugin_test_appletviewer return\n"); + return error; + } + + static NPError + plugin_start_appletviewer (ITNPPluginData* data) + { +- PLUGIN_DEBUG_0ARG ("plugin_start_appletviewer\n"); ++ PLUGIN_DEBUG ("plugin_start_appletviewer\n"); + NPError error = NPERR_NO_ERROR; + + gchar** command_line; +@@ -1599,12 +1597,12 @@ + + if (appletviewer_pid) + { +- PLUGIN_DEBUG_1ARG("Initialized VM with pid=%d\n", appletviewer_pid); ++ PLUGIN_DEBUG("Initialized VM with pid=%d\n", appletviewer_pid); + appletviewer_watch_id = g_child_watch_add(appletviewer_pid, (GChildWatchFunc) appletviewer_monitor, (gpointer) appletviewer_pid); + } + + +- PLUGIN_DEBUG_0ARG ("plugin_start_appletviewer return\n"); ++ PLUGIN_DEBUG ("plugin_start_appletviewer return\n"); + return error; + } + +@@ -1613,7 +1611,7 @@ + static gchar* + plugin_create_applet_tag (int16_t argc, char* argn[], char* argv[]) + { +- PLUGIN_DEBUG_0ARG ("plugin_create_applet_tag\n"); ++ PLUGIN_DEBUG ("plugin_create_applet_tag\n"); + + gchar* applet_tag = g_strdup ("pdata; + +@@ -1914,7 +1912,7 @@ + (*browser_functions.memfree) (tofree); + tofree = NULL; + +- PLUGIN_DEBUG_0ARG ("plugin_data_destroy return\n"); ++ PLUGIN_DEBUG ("plugin_data_destroy return\n"); + } + + // FACTORY FUNCTIONS +@@ -1931,7 +1929,7 @@ + NPError + NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) + { +- PLUGIN_DEBUG_0ARG ("NP_Initialize\n"); ++ PLUGIN_DEBUG ("NP_Initialize\n"); + + if (initialized) + return NPERR_NO_ERROR; +@@ -2145,7 +2143,7 @@ + + appletviewer_executable = g_strdup_printf ("%s/../../bin/java", + dirname (filename)); +- PLUGIN_DEBUG_4ARG(".so is located at: %s and the link points to: %s. Executing java from dir %s to run %s\n", info.dli_fname, filename, dirname (filename), appletviewer_executable); ++ PLUGIN_DEBUG(".so is located at: %s and the link points to: %s. Executing java from dir %s to run %s\n", info.dli_fname, filename, dirname (filename), appletviewer_executable); + if (!appletviewer_executable) + { + PLUGIN_ERROR ("Failed to create appletviewer executable name."); +@@ -2169,9 +2167,9 @@ + + plugin_instance_mutex = g_mutex_new (); + +- PLUGIN_DEBUG_1ARG ("NP_Initialize: using %s\n", appletviewer_executable); +- +- PLUGIN_DEBUG_0ARG ("NP_Initialize return\n"); ++ PLUGIN_DEBUG ("NP_Initialize: using %s\n", appletviewer_executable); ++ ++ PLUGIN_DEBUG ("NP_Initialize return\n"); + + plugin_req_proc = new PluginRequestProcessor(); + java_req_proc = new JavaMessageSender(); +@@ -2218,9 +2216,9 @@ + char* + NP_GetMIMEDescription () + { +- PLUGIN_DEBUG_0ARG ("NP_GetMIMEDescription\n"); +- +- PLUGIN_DEBUG_0ARG ("NP_GetMIMEDescription return\n"); ++ PLUGIN_DEBUG ("NP_GetMIMEDescription\n"); ++ ++ PLUGIN_DEBUG ("NP_GetMIMEDescription return\n"); + + return (char*) PLUGIN_MIME_DESC; + } +@@ -2230,7 +2228,7 @@ + NPError + NP_GetValue (void* future, NPPVariable variable, void* value) + { +- PLUGIN_DEBUG_0ARG ("NP_GetValue\n"); ++ PLUGIN_DEBUG ("NP_GetValue\n"); + + NPError result = NPERR_NO_ERROR; + gchar** char_value = (gchar**) value; +@@ -2238,12 +2236,12 @@ + switch (variable) + { + case NPPVpluginNameString: +- PLUGIN_DEBUG_0ARG ("NP_GetValue: returning plugin name.\n"); ++ PLUGIN_DEBUG ("NP_GetValue: returning plugi