ports/java/openjdk6/files/plugin.patch
Jung-uk Kim 3f8405abd2 - Update IcedTea6 web support to 1.9.2.
- Add a patch to fix browser plugin crash[1].

Submitted by:	Barbara (barbara dot xxx1975 at libero dot it)[1]
2010-11-24 23:35:32 +00:00

402 lines
12 KiB
Diff

$FreeBSD$
Applied patches from IcedTea6-1.9.2:
patches/hotspot/original/update-bootclasspath.patch
patches/icedtea-demo-swingapplet.patch
patches/extensions/netx.patch
patches/extensions/netx-umask.patch
patches/extensions/liveconnect.patch
Note: patches/hotspot/original/update-bootclasspath.patch was applied without
rhino support.
--- hotspot/src/share/vm/runtime/os.cpp.orig 2010-06-21 17:12:21.000000000 -0400
+++ hotspot/src/share/vm/runtime/os.cpp 2010-09-09 16:24:52.000000000 -0400
@@ -884,6 +884,8 @@
"%/lib/jsse.jar:"
"%/lib/jce.jar:"
"%/lib/charsets.jar:"
+ "%/lib/netx.jar:"
+ "%/lib/plugin.jar:"
"%/classes";
char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep);
if (sysclasspath == NULL) return false;
--- jdk/make/docs/NON_CORE_PKGS.gmk.orig 2010-06-21 17:15:08.000000000 -0400
+++ jdk/make/docs/NON_CORE_PKGS.gmk 2010-09-09 16:26:01.000000000 -0400
@@ -84,6 +84,10 @@
SMARTCARDIO_PKGS = javax.smartcardio
+JNLP_PKGS = javax.jnlp
+
+JAVASCRIPT_PKGS = netscape.javascript
+
# non-core packages in rt.jar
NON_CORE_PKGS = $(DOMAPI_PKGS) \
$(MGMT_PKGS) \
@@ -91,4 +95,6 @@
$(JGSS_PKGS) \
$(OLD_JSSE_PKGS) \
$(HTTPSERVER_PKGS) \
- $(SMARTCARDIO_PKGS)
+ $(SMARTCARDIO_PKGS) \
+ $(JNLP_PKGS) \
+ $(JAVASCRIPT_PKGS)
--- jdk/make/launchers/Makefile.orig 2010-06-21 17:15:08.000000000 -0400
+++ jdk/make/launchers/Makefile 2010-09-09 16:25:05.000000000 -0400
@@ -67,6 +67,7 @@
$(call make-launcher, javadoc, com.sun.tools.javadoc.Main, , )
$(call make-launcher, javah, com.sun.tools.javah.Main, , )
$(call make-launcher, javap, sun.tools.javap.Main, , )
+$(call make-launcher, javaws, net.sourceforge.jnlp.runtime.Boot, , )
$(call make-launcher, jconsole, sun.tools.jconsole.JConsole, \
-J-Djconsole.showOutputViewer, )
$(call make-launcher, jdb, com.sun.tools.example.debug.tty.TTY, , )
--- jdk/make/launchers/Makefile.launcher.orig 2010-06-21 17:15:08.000000000 -0400
+++ jdk/make/launchers/Makefile.launcher 2010-09-09 16:25:12.000000000 -0400
@@ -148,6 +148,16 @@
endif
endif
+# pluginappletviewer only
+ifeq ($(PROGRAM), pluginappletviewer)
+ OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
+endif
+
+# javaws only
+ifeq ($(PROGRAM), javaws)
+ OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
+endif
+
# GUI tools
ifeq ($(GUI_TOOL),true)
ifneq ($(PLATFORM), windows)
--- jdk/make/mkdemo/jfc/SwingApplet/Makefile.orig 2010-06-21 17:15:08.000000000 -0400
+++ jdk/make/mkdemo/jfc/SwingApplet/Makefile 2010-09-09 16:24:23.000000000 -0400
@@ -33,7 +33,7 @@
include $(BUILDDIR)/common/Defs.gmk
DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME)
-DEMO_TOPFILES = ./README.txt
+DEMO_TOPFILES = ./README.txt ./SwingApplet.html
DEMO_MAINCLASS = $(DEMONAME)
DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME)
--- jdk/make/sun/Makefile.orig 2010-06-21 17:15:08.000000000 -0400
+++ jdk/make/sun/Makefile 2010-09-09 16:26:01.000000000 -0400
@@ -66,6 +66,7 @@
$(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
jawt text nio launcher management $(ORG_SUBDIR) \
+ plugin \
native2ascii serialver tools jconsole
all build clean clobber::
--- jdk/make/sun/plugin/Makefile.orig 2010-09-09 16:26:01.000000000 -0400
+++ jdk/make/sun/plugin/Makefile 2010-09-09 16:26:01.000000000 -0400
@@ -0,0 +1,53 @@
+#
+# Copyright 1995-2005 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# Makefile for pluginappletviewer wrapper.
+#
+
+BUILDDIR = ../..
+PACKAGE = sun.applet
+PRODUCT = sun
+PROGRAM = pluginappletviewer
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files to compile.
+#
+AUTO_FILES_JAVA_DIRS = sun/applet
+
+ifneq ($(PLATFORM), windows)
+ #
+ # Anything with a GUI needs X11 to be linked in.
+ #
+ OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
+endif # PLATFORM
+
+#
+# Rules
+#
+JAVA_ARGS = { "sun.applet.PluginMain" }
+include $(BUILDDIR)/common/Program.gmk
+
--- jdk/src/share/bin/java.c.orig 2010-06-21 17:15:10.000000000 -0400
+++ jdk/src/share/bin/java.c 2010-09-09 16:25:12.000000000 -0400
@@ -56,6 +56,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include <jni.h>
#include <jvm.h>
@@ -69,6 +70,8 @@
#define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
#endif
+#define MAXMASK 4095 /* Same as octal 07777 */
+
/*
* The following environment variable is used to influence the behavior
* of the jre exec'd through the SelectVersion routine. The command line
@@ -184,6 +187,10 @@
int JNICALL JavaMain(void * args); /* entry point */
+/* umask things */
+static int FindUMask(int *, char ***, int *);
+static int VerifyMask(char *, int*);
+
struct JavaMainArgs {
int argc;
char ** argv;
@@ -307,6 +314,26 @@
SetClassPath(s);
#endif
+#ifdef USE_UMASK
+ /* Set umask */
+ int mask;
+ // Check to see if we can find a umask on the command line.
+ if (FindUMask(&argc, &argv, &mask) < 0)
+ {
+ // We didn't find a umask, so fall back to the default one.
+ char * defaultMask = (char *) JLI_MemAlloc(5 * sizeof(char));
+ strcpy(defaultMask, USE_UMASK);
+ int converted;
+ VerifyMask(defaultMask, &converted);
+ JLI_MemFree(defaultMask);
+ umask(converted); /* from sys/stat.h */
+ }
+ else
+ {
+ umask(mask);
+ }
+#endif
+
/*
* Parse command line options; if the return value of
* ParseArguments is false, the program should exit.
@@ -2017,3 +2044,87 @@
}
DoSplashSetFileJarName(file_name, jar_name);
}
+
+/**
+ * Searches argv to find any parameters that start with "-umask=".
+ * Sets maskToSet with the mask if a -umask is found, and if the mask
+ * supplied is valid. Returns 1 if a valid mask was found and set,
+ * -1 otherwise.
+ */
+int FindUMask(int *pargc, char *** pargv, int *maskToSet)
+{
+ int found_mask = -1;
+
+ // our handles to the original list
+ int argc = *pargc;
+ char **argv = *pargv;
+
+ // the new set
+ int nargc = argc;
+ char ** nargv = (char **) JLI_MemAlloc((nargc + 1) * sizeof(char *));
+
+ // set the original set to the new set
+ *pargv = nargv;
+ *pargc = nargc;
+
+ char *maskString = (char *) JLI_MemAlloc(6 * sizeof(char *));
+ int i;
+ for (i = 0; i < argc; i++)
+ {
+ char *arg = argv[i];
+ if (strncmp(arg, "-umask=",7) == 0)
+ {
+ strncpy(maskString, arg+7, 5);
+
+ if (VerifyMask(maskString, maskToSet) < 0)
+ {
+ printf("Invalid umask %s, application stopped.\n", maskString);
+ exit(1);
+ }
+
+ found_mask = 1;
+ nargc--;
+ (*pargc)--;
+ }
+ else
+ {
+ *nargv++ = arg;
+ }
+ }
+
+ JLI_MemFree(maskString);
+
+ return found_mask;
+}
+
+/**
+ * Takes an octal mask in string form, and converts it to
+ * decimal form in convertedMask. The decimal form can then be
+ * easily passed to umask(). Returns 1 if the mask is valid, -1 otherwise.
+ */
+int VerifyMask(char * maskString, int * convertedMask)
+{
+ // Borrowed from coreutils modechange.c
+ if ('0' <= *maskString && *maskString < '8')
+ {
+ unsigned int decimal_mode = 0;
+
+ do {
+ decimal_mode = 8 * decimal_mode + *maskString++ - '0';
+ } while ('0' <= *maskString && *maskString < '8');
+
+ if (decimal_mode > MAXMASK)
+ return -1;
+ else if (*maskString)
+ return -1;
+ else
+ *convertedMask = decimal_mode;
+
+ return 1;
+ }
+ else
+ {
+ return -1;
+ }
+
+}
--- jdk/src/share/classes/sun/applet/AppletViewerPanel.java.orig 2010-06-21 17:15:27.000000000 -0400
+++ jdk/src/share/classes/sun/applet/AppletViewerPanel.java 2010-09-09 16:25:06.000000000 -0400
@@ -42,25 +42,25 @@
*
* @author Arthur van Hoff
*/
-class AppletViewerPanel extends AppletPanel {
+public class AppletViewerPanel extends AppletPanel {
/* Are we debugging? */
- static boolean debug = false;
+ protected static boolean debug = false;
/**
* The document url.
*/
- URL documentURL;
+ protected URL documentURL;
/**
* The base url.
*/
- URL baseURL;
+ protected URL baseURL;
/**
* The attributes of the applet.
*/
- Hashtable atts;
+ protected Hashtable atts;
/*
* JDK 1.1 serialVersionUID
@@ -70,7 +70,7 @@
/**
* Construct an applet viewer and start the applet.
*/
- AppletViewerPanel(URL documentURL, Hashtable atts) {
+ protected AppletViewerPanel(URL documentURL, Hashtable atts) {
this.documentURL = documentURL;
this.atts = atts;
@@ -202,12 +202,12 @@
return (AppletContext)getParent();
}
- static void debug(String s) {
+ protected static void debug(String s) {
if(debug)
System.err.println("AppletViewerPanel:::" + s);
}
- static void debug(String s, Throwable t) {
+ protected static void debug(String s, Throwable t) {
if(debug) {
t.printStackTrace();
debug(s);
--- jdk/src/share/classes/sun/applet/AppletPanel.java.orig 2010-06-21 17:15:27.000000000 -0400
+++ jdk/src/share/classes/sun/applet/AppletPanel.java 2010-09-09 16:25:06.000000000 -0400
@@ -68,7 +68,7 @@
/**
* The applet (if loaded).
*/
- Applet applet;
+ protected Applet applet;
/**
* Applet will allow initialization. Should be
@@ -117,7 +117,7 @@
/**
* The thread for the applet.
*/
- Thread handler;
+ protected Thread handler;
/**
@@ -162,7 +162,8 @@
* Creates a thread to run the applet. This method is called
* each time an applet is loaded and reloaded.
*/
- synchronized void createAppletThread() {
+ //Overridden by NetxPanel.
+ protected synchronized void createAppletThread() {
// Create a thread group for the applet, and start a new
// thread to load the applet.
String nm = "applet-" + getCode();
@@ -306,7 +307,7 @@
/**
* Get an event from the queue.
*/
- synchronized AppletEvent getNextEvent() throws InterruptedException {
+ protected synchronized AppletEvent getNextEvent() throws InterruptedException {
while (queue == null || queue.isEmpty()) {
wait();
}
@@ -695,7 +696,8 @@
* applet event processing so that it can be gracefully interrupted from
* things like HotJava.
*/
- private void runLoader() {
+ //Overridden by NetxPanel.
+ protected void runLoader() {
if (status != APPLET_DISPOSE) {
showAppletStatus("notdisposed");
return;