aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/icedteanp/java/sun/applet/PluginAppletViewer.java')
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletViewer.java70
1 files changed, 52 insertions, 18 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
index b1abf19..8d1630d 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
@@ -82,7 +82,6 @@ import java.awt.print.Printable;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
import java.net.SocketPermission;
import java.net.URI;
import java.net.URL;
@@ -110,11 +109,9 @@ import net.sourceforge.jnlp.PluginParameters;
import net.sourceforge.jnlp.runtime.JNLPClassLoader;
import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel;
import net.sourceforge.jnlp.security.appletextendedsecurity.AppletStartupSecuritySettings;
-import net.sourceforge.jnlp.security.appletextendedsecurity.ExecuteUnsignedApplet;
import net.sourceforge.jnlp.splashscreen.SplashController;
import net.sourceforge.jnlp.splashscreen.SplashPanel;
import net.sourceforge.jnlp.splashscreen.SplashUtils;
-import netscape.javascript.JSObject;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.X11.XEmbeddedFrame;
@@ -250,14 +247,17 @@ public class PluginAppletViewer extends XEmbeddedFrame
windowEventListener = new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent evt) {
destroyApplet(identifier);
}
+ @Override
public void windowIconified(WindowEvent evt) {
appletStop();
}
+ @Override
public void windowDeiconified(WindowEvent evt) {
appletStart();
}
@@ -273,6 +273,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
}
+ @Override
public void replaceSplash(final SplashPanel newSplash) {
if (splashPanel == null) {
return;
@@ -284,6 +285,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
splashPanel.getSplashComponent().setVisible(false);
splashPanel.stopAnimation();
@@ -310,6 +312,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
splashPanel.getSplashComponent().setVisible(false);
splashPanel.stopAnimation();
@@ -356,6 +359,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
this.appletViewer = appletViewer;
}
+ @Override
public void appletStateChanged(AppletEvent evt) {
AppletPanel src = (AppletPanel) evt.getSource();
@@ -387,10 +391,12 @@ public class PluginAppletViewer extends XEmbeddedFrame
// Swing also maintains a Frame list for the AppContext,
// so we will have to rearrange it as well.
//
- if (a != null)
+ if (a != null) {
AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a));
- else
+ }
+ else {
AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext());
+ }
updateStatus(appletViewer.identifier, PAV_INIT_STATUS.INIT_COMPLETE);
@@ -435,8 +441,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
// If there is a key for this status, it means it
// was either initialized before, or destroy has been
// processed. Stop moving further.
- if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null)
+ if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null) {
return;
+ }
// Extract the information from the message
String[] msgParts = new String[4];
@@ -543,8 +550,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
;
// don't bother processing further for inactive applets
- if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE))
+ if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
return;
+ }
applets.get(identifier).handleMessage(reference, message);
}
@@ -640,6 +648,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("Attempting to destroy panel ", identifier);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
pav.appletClose();
}
@@ -685,6 +694,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
waitForAppletInit(panel);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
panel.updateSizeInAtts(height, width);
@@ -774,6 +784,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an audio clip.
*/
+ @Override
public AudioClip getAudioClip(URL url) {
checkConnect(url);
synchronized (audioClips) {
@@ -790,6 +801,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an image.
*/
+ @Override
public Image getImage(URL url) {
return getCachedImage(url);
}
@@ -818,8 +830,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
JNLPClassLoader loader = (JNLPClassLoader) panel.getAppletClassLoader();
URL localURL = null;
- if (loader.resourceAvailableLocally(resourceName))
+ if (loader.resourceAvailableLocally(resourceName)) {
url = loader.getResource(resourceName);
+ }
url = localURL != null ? localURL : url;
}
@@ -853,6 +866,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an applet by name.
*/
+ @Override
public Applet getApplet(String name) {
name = name.toLowerCase();
SocketPermission panelSp =
@@ -883,6 +897,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
* Return an enumeration of all the accessible
* applets on this page.
*/
+ @Override
public Enumeration<Applet> getApplets() {
Vector<Applet> v = new Vector<Applet>();
SocketPermission panelSp =
@@ -904,11 +919,13 @@ public class PluginAppletViewer extends XEmbeddedFrame
return v.elements();
}
+ @Override
public void showDocument(URL url) {
PluginDebug.debug("Showing document...");
showDocument(url, "_self");
}
+ @Override
public void showDocument(URL url, String target) {
// If it is a javascript document, eval on current page.
if ("javascript".equals(url.getProtocol())) {
@@ -930,6 +947,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Show status.
*/
+ @Override
public void showStatus(String status) {
try {
// FIXME: change to postCallRequest
@@ -1124,8 +1142,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait eval request 1");
synchronized (request) {
PluginDebug.debug("wait eval request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait eval request 3");
}
} catch (InterruptedException e) {
@@ -1189,8 +1208,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait call request 1");
synchronized (request) {
PluginDebug.debug("wait call request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait call request 3");
}
} catch (InterruptedException e) {
@@ -1224,8 +1244,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait cookieinfo request 1");
synchronized (request) {
PluginDebug.debug("wait cookieinfo request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait cookieinfo request 3");
}
} catch (InterruptedException e) {
@@ -1256,8 +1277,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait call request 1");
synchronized (request) {
PluginDebug.debug("wait call request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait call request 3");
}
} catch (InterruptedException e) {
@@ -1282,8 +1304,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait finalize request 1");
synchronized (request) {
PluginDebug.debug("wait finalize request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait finalize request 3");
}
} catch (InterruptedException e) {
@@ -1322,6 +1345,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("WRITING 2 DONE");
}
+ @Override
public void setStream(String key, InputStream stream) throws IOException {
// We do nothing.
}
@@ -1402,6 +1426,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
}
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
((AppletViewerPanel)panel).createAppletThread();
return null;
@@ -1413,6 +1438,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
panel.sendEvent(AppletPanel.APPLET_START);
}
+ @Override
public int print(Graphics graphics, PageFormat pf, int pageIndex) {
return Printable.NO_SUCH_PAGE;
}
@@ -1458,13 +1484,15 @@ public class PluginAppletViewer extends XEmbeddedFrame
new Thread(new Runnable() {
@SuppressWarnings("deprecation")
+ @Override
public void run() {
ClassLoader cl = p.applet.getClass().getClassLoader();
// Since we want to deal with JNLPClassLoader, extract it if this
// is a codebase loader
- if (cl instanceof JNLPClassLoader.CodeBaseClassLoader)
+ if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) {
cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader();
+ }
appletShutdown(p);
appletPanels.removeElement(p);
@@ -1474,6 +1502,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
dispose();
}
@@ -1514,10 +1543,12 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
java.security.Permission perm =
url.openConnection().getPermission();
- if (perm != null)
+ if (perm != null) {
security.checkPermission(perm);
- else
+ }
+ else {
security.checkConnect(url.getHost(), url.getPort());
+ }
} catch (java.io.IOException ioe) {
security.checkConnect(url.getHost(), url.getPort());
}
@@ -1531,6 +1562,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
* the parent class's update() just does a couple of checks (both of
* which are accounted for) and then calls paint anyway.
*/
+ @Override
public void paint(Graphics g) {
// If the image or the graphics don't exist, create new ones
@@ -1573,8 +1605,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
long timeout) {
// Can't wait on null. Return 0 indicating no wait happened.
- if (lock == null)
- return 0;
+ if (lock == null) {
+ return 0;
+ }
assert lock.isHeldByCurrentThread();
@@ -1598,6 +1631,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
this.fPanel = fPanel;
}
+ @Override
public void run() {
add("Center", fPanel);
fPanel.setVisible(false);