Mercurial > hg > release > icedtea-web-1.4
changeset 725:1d648cbb2555
Ensure that PluginAppletViewer is resized in case of error.
author | Adam Domurad <adomurad@redhat.com> |
---|---|
date | Thu, 02 May 2013 12:28:10 -0400 |
parents | 15b3aaef3a81 |
children | 0d6213db4fc7 |
files | ChangeLog plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java plugin/icedteanp/java/sun/applet/PluginAppletViewer.java |
diffstat | 3 files changed, 44 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu May 02 11:43:13 2013 -0400 +++ b/ChangeLog Thu May 02 12:28:10 2013 -0400 @@ -27,6 +27,16 @@ 2013-05-02 Adam Domurad <adomurad@redhat.com> + Ensure that PluginAppletviewer is resized in case of error. + This fixes most of the cases of the error splash screen + not appearing. + * plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java + (createPanel): Resize earlier, before erroring out. + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java + (PluginAppletViewer): Set size, remove fixme. + +2013-05-02 Adam Domurad <adomurad@redhat.com> + * plugin/icedteanp/IcedTeaNPPlugin.cc: Remove only occurence of LEGACY_XULRUNNERAPI
--- a/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java Thu May 02 11:43:13 2013 -0400 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java Thu May 02 12:28:10 2013 -0400 @@ -112,13 +112,14 @@ }, "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,30 +134,6 @@ 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. - */ - try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - panel.getParent().setSize(params.getWidth(), params.getHeight()); - } - }); - } catch (InvocationTargetException ite) { - // Not being able to resize is non-fatal - PluginDebug.debug("Unable to resize panel: "); - ite.printStackTrace(); - } catch (InterruptedException ie) { - // Not being able to resize is non-fatal - PluginDebug.debug("Unable to resize panel: "); - ie.printStackTrace(); - } - panel.removeSplash(); AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc); @@ -165,10 +142,32 @@ return panel; } - public boolean isStandalone() { - return false; + /* 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(width, height); + } + }); + } catch (InvocationTargetException e) { + // Not being able to resize is non-fatal + PluginDebug.debug("Unable to resize panel: "); + e.printStackTrace(); + } catch (InterruptedException e) { + // Not being able to resize is non-fatal + PluginDebug.debug("Unable to resize panel: "); + e.printStackTrace(); + } } - /** * Send the initial set of events to the appletviewer event queue. * On start-up the current behaviour is to load the applet and call
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Thu May 02 11:43:13 2013 -0400 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Thu May 02 12:28:10 2013 -0400 @@ -188,11 +188,7 @@ 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 @@ 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 @@ appletsLock.unlock(); PluginDebug.debug(panel, " framed"); - return appletFrame; + return appletFrame; } /** @@ -332,7 +329,6 @@ return -1; } } - private static class AppletEventListener implements AppletListener { final Frame frame;