aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
index a015884..ec4dd47 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
@@ -238,18 +238,23 @@ public class PluginAppletSecurityContext {
long startTime = 0;
- public PluginAppletSecurityContext(int identifier) {
+ /* Package-private constructor that allows for bypassing security manager installation.
+ * This is useful for testing. Note that while the public constructor should be used otherwise,
+ * the security installation can't be bypassed if it has already occurred.*/
+ PluginAppletSecurityContext(int identifier, boolean ensureSecurityContext) {
this.identifier = identifier;
- // We need a security manager.. and since there is a good chance that
- // an applet will be loaded at some point, we should make it the SM
- // that JNLPRuntime will try to install
- if (System.getSecurityManager() == null) {
- JNLPRuntime.initialize(/* isApplication */false);
- JNLPRuntime.setDefaultLaunchHandler(new DefaultLaunchHandler(System.err));
- }
+ if (ensureSecurityContext) {
+ // We need a security manager.. and since there is a good chance that
+ // an applet will be loaded at some point, we should make it the SM
+ // that JNLPRuntime will try to install
+ if (System.getSecurityManager() == null) {
+ JNLPRuntime.initialize(/* isApplication */false);
+ JNLPRuntime.setDefaultLaunchHandler(new DefaultLaunchHandler(System.err));
+ }
- JNLPRuntime.disableExit();
+ JNLPRuntime.disableExit();
+ }
URL u = null;
try {
@@ -261,6 +266,10 @@ public class PluginAppletSecurityContext {
this.classLoaders.put(liveconnectLoader, u);
}
+ public PluginAppletSecurityContext(int identifier) {
+ this(identifier, true);
+ }
+
private static <V> V parseCall(String s, ClassLoader cl, Class<V> c) {
if (c == Integer.class)
return c.cast(new Integer(s));