[icedtea-web] RFC: Patch to correct classloader sharing rules
Dr Andrew John Hughes
ahughes at redhat.com
Mon Mar 28 10:27:24 PDT 2011
On 12:30 Mon 28 Mar , Deepak Bhole wrote:
> * Dr Andrew John Hughes <ahughes at redhat.com> [2011-03-25 20:43]:
> > On 19:43 Fri 25 Mar , Deepak Bhole wrote:
> > > Hi,
> > >
> > > Omair found a page earlier that specifies some rules on plugin classloader
> > > sharing. Currently we share it based on site address -- attached patch fixes
> > > that to do it as per the proprietary plugin rules:
> > > http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html
> > >
> > > ChangeLog:
> > > 2011-03-25 Deepak Bhole <dbhole at redhat.com>
> > >
> > > * netx/net/sourceforge/jnlp/PluginBridge.java
> > > (PluginBridge): Construct unique key based on a combination of codebase,
> > > cache_archive, java_archive, and archive. This automatically ensures are
> > > loaders are shared only when appropriate.
> > >
> > > Cheers,
> > > Deepak
> > AFAICS, atts is a hashtable with generic types so the casts don't need to be there.
> Doh! Didn't even think to check for generics.. just went with old habit
> of casting :/ Fixed now.
> > Some of the lines seem too long. I guess there isn't much that can be done
> > with the URL, but the later comments and the String assignments could certainly
> > be split.
> Fixed as well. New patch okay?
Looks good, thanks. Please commit.
> diff -r 92486f15be36 netx/net/sourceforge/jnlp/PluginBridge.java
> --- a/netx/net/sourceforge/jnlp/PluginBridge.java Thu Mar 24 09:34:51 2011 -0400
> +++ b/netx/net/sourceforge/jnlp/PluginBridge.java Mon Mar 28 12:27:24 2011 -0400
> @@ -132,10 +132,33 @@
> security = null;
> - // Plugin needs to share classloaders so that applet instances from
> - // same page can communicate (there are applets known to require
> - // such communication for proper functionality)
> - this.uniqueKey = documentBase.toString();
> + /* According to http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html,
> + * classloaders are shared iff these properties match:
> + * codebase, cache_archive, java_archive, archive
> + *
> + * To achieve this, we create the uniquekey based on those 4 values,
> + * always in the same order. The initial "<NAME>=" parts ensure a
> + * bad tag cannot trick the loader into getting shared with another.
> + */
> + // Firefox sometimes skips the codebase if it is default -- ".",
> + // so set it that way if absent
> + String codebaseAttr = atts.get("codebase") != null ?
> + atts.get("codebase") : ".";
> + String cache_archiveAttr = atts.get("cache_archive") != null ?
> + atts.get("cache_archive") : "";
> + String java_archiveAttr = atts.get("java_archive") != null ?
> + atts.get("java_archive") : "";
> + String archiveAttr = atts.get("archive") != null ?
> + atts.get("archive") : "";
> + this.uniqueKey = "codebase=" + codebaseAttr +
> + "cache_archive=" + cache_archiveAttr +
> + "java_archive=" + java_archiveAttr +
> + "archive=" + archiveAttr;
> usePack = false;
> useVersion = false;
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and IcedTea
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37
More information about the distro-pkg-dev