aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorAdam Domurad <[email protected]>2013-05-02 12:28:10 -0400
committerAdam Domurad <[email protected]>2013-05-02 12:28:10 -0400
commit8ec0bf0612cb8cdb6e3956996ce4a249505dd429 (patch)
tree52523c4d0665349b4e558ed2360d8110238b4d80 /plugin
parent04db48f1281ec6362870a3226e5e37fef208a9a5 (diff)
Ensure that PluginAppletViewer is resized in case of error.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java59
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletViewer.java10
2 files changed, 32 insertions, 37 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java b/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java
index 961df66..e368eca 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java
@@ -112,13 +112,14 @@ class PluginAppletPanelFactory {
}, "NetXPanel initializer");
panelInit.start();
- while(panelInit.isAlive()) {
- try {
- panelInit.join();
- } catch (InterruptedException e) {
- }
+ try {
+ panelInit.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
+ setAppletViewerSize(panel, params.getWidth(), params.getHeight());
+
// Wait for the panel to initialize
PluginAppletViewer.waitForAppletInit(panel);
@@ -133,42 +134,40 @@ class PluginAppletPanelFactory {
PluginDebug.debug("Applet ", a.getClass(), " initialized");
streamhandler.write("instance " + identifier + " reference 0 initialized");
- /* AppletViewerPanel sometimes doesn't set size right initially. This
- * causes the parent frame to be the default (10x10) size.
- *
- * Normally it goes unnoticed since browsers like Firefox make a resize
- * call after init. However some browsers (e.g. Midori) don't.
- *
- * We therefore manually set the parent to the right size.
- */
+ panel.removeSplash();
+
+ AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc);
+ AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, panel.getAppletClassLoader());
+
+ return panel;
+ }
+
+ /* AppletViewerPanel sometimes doesn't set size right initially. This
+ * causes the parent frame to be the default (10x10) size.
+ *
+ * Normally it goes unnoticed since browsers like Firefox make a resize
+ * call after init. However some browsers (e.g. Midori) don't.
+ *
+ * We therefore manually set the parent to the right size.
+ */
+ static private void setAppletViewerSize(final AppletPanel panel,
+ final int width, final int height) {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- panel.getParent().setSize(params.getWidth(), params.getHeight());
+ panel.getParent().setSize(width, height);
}
});
- } catch (InvocationTargetException ite) {
+ } catch (InvocationTargetException e) {
// Not being able to resize is non-fatal
PluginDebug.debug("Unable to resize panel: ");
- ite.printStackTrace();
- } catch (InterruptedException ie) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
// Not being able to resize is non-fatal
PluginDebug.debug("Unable to resize panel: ");
- ie.printStackTrace();
+ e.printStackTrace();
}
-
- panel.removeSplash();
-
- AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc);
- AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, panel.getAppletClassLoader());
-
- return panel;
}
-
- public boolean isStandalone() {
- return false;
- }
-
/**
* Send the initial set of events to the appletviewer event queue.
* On start-up the current behaviour is to load the applet and call
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
index d07d0c2..1f56037 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
@@ -188,11 +188,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
public PluginAppletViewer() {
}
- //FIXME - when multiple applets are on one page, this method is visited simultaneously
- //and then appelts creates in little bit strange manner. This issue is visible with
- //randomly showing/notshowing spalshscreens.
- //See also Launcher.createApplet
- public static PluginAppletViewer framePanel(int identifier,long handle, int width, int height, NetxPanel panel) {
+ public static PluginAppletViewer framePanel(int identifier, long handle, int width, int height, NetxPanel panel) {
PluginDebug.debug("Framing ", panel);
@@ -200,6 +196,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
System.getSecurityManager().checkPermission(new AllPermission());
PluginAppletViewer appletFrame = new PluginAppletViewer(handle, identifier, panel);
+ appletFrame.setSize(width, height);
appletFrame.appletEventListener = new AppletEventListener(appletFrame, appletFrame);
panel.addAppletListener(appletFrame.appletEventListener);
@@ -216,7 +213,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
appletsLock.unlock();
PluginDebug.debug(panel, " framed");
- return appletFrame;
+ return appletFrame;
}
/**
@@ -332,7 +329,6 @@ public class PluginAppletViewer extends XEmbeddedFrame
return -1;
}
}
-
private static class AppletEventListener implements AppletListener {
final Frame frame;