diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/NetxPanel.java | 15 | ||||
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 30 |
3 files changed, 24 insertions, 35 deletions
@@ -1,5 +1,19 @@ 2013-04-25 Adam Domurad <[email protected]> + Fix a dead-lock that can cause (namely) Firefox to hang. + * netx/net/sourceforge/jnlp/NetxPanel.java + (appletAlive): Remove flag. + (isAlive): Remove getter. + (initialized): New, explicit initialization flag. + (isInitialized): New, getter. + (runLoader): Set initialization flag when done (whether errored or not). + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java + (waitForAppletInit): Wait on initialization flag from NetxPanel. + (handleMessage): Remove redundant waiting for init. Respond properly to + GetJavaObject in case of error/time-out. + +2013-04-25 Adam Domurad <[email protected]> + * tests/netx/unit/net/sourceforge/jnlp/AsyncCallTest.java: Unit tests for AsyncCall test extension. diff --git a/netx/net/sourceforge/jnlp/NetxPanel.java b/netx/net/sourceforge/jnlp/NetxPanel.java index b8e2388..da15d0f 100644 --- a/netx/net/sourceforge/jnlp/NetxPanel.java +++ b/netx/net/sourceforge/jnlp/NetxPanel.java @@ -39,7 +39,7 @@ import sun.awt.SunToolkit; /** * This panel calls into netx to run an applet, and pipes the display - * into a panel from gcjwebplugin. + * into a panel from the icedtea-web browser plugin. * * @author Francis Kung <[email protected]> */ @@ -48,7 +48,7 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { private PluginBridge bridge = null; private AppletInstance appInst = null; private SplashController splashController; - private boolean appletAlive; + private volatile boolean initialized; // We use this so that we can create exactly one thread group // for all panels with the same uKey. @@ -70,6 +70,7 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { super(documentURL, params.getUnderlyingHashtable()); this.parameters = params; + this.initialized = false; String uniqueKey = params.getUniqueKey(getCodeBase()); synchronized(TGMapMutex) { @@ -78,7 +79,6 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { uKeyToTG.put(uniqueKey, tg); } } - this.appletAlive = true; } @Override @@ -124,7 +124,6 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { validate(); } } catch (Exception e) { - this.appletAlive = false; status = APPLET_ERROR; e.printStackTrace(); replaceSplash(SplashUtils.getErrorSplashScreen(getWidth(), getHeight(), e)); @@ -133,6 +132,7 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { // so that the applet's event listeners are signaled. // Once PluginAppletViewer.AppletEventListener is signaled PluginAppletViewer can properly stop waiting // in PluginAppletViewer.waitForAppletInit + this.initialized = true; dispatchAppletEvent(APPLET_LOADING_COMPLETED, null); } } @@ -170,8 +170,8 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { return appInst.getClassLoader(); } - public boolean isAlive() { - return handler != null && handler.isAlive() && this.appletAlive; + public boolean isInitialized() { + return initialized; } public ThreadGroup getThreadGroup() { @@ -191,9 +191,6 @@ public class NetxPanel extends AppletViewerPanel implements SplashController { } } - - - public void setAppletViewerFrame(SplashController framePanel) { splashController=framePanel; } diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index 8423c5d..d07d0c2 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -652,8 +652,7 @@ public class PluginAppletViewer extends XEmbeddedFrame panelLock.lock(); try { - while (panel.getApplet() == null && - panel.isAlive() && + while (!panel.isInitialized() && maxTimeToSleep > 0) { PluginDebug.debug("Waiting for applet panel ", panel, " to initialize..."); maxTimeToSleep -= waitTillTimeout(panelLock, panelLive, maxTimeToSleep); @@ -731,37 +730,16 @@ public class PluginAppletViewer extends XEmbeddedFrame // object should belong to? Object o; - // First, wait for panel to instantiate - // Next, wait for panel to come alive - long maxTimeToSleep = APPLET_TIMEOUT; - panelLock.lock(); - try { - while (panel == null || !panel.isAlive()) { - maxTimeToSleep -= waitTillTimeout(panelLock, panelLive, - maxTimeToSleep); - - /* we already waited till timeout, give up here directly, - * instead of waiting 180s again in below waitForAppletInit() - */ - if(maxTimeToSleep < 0) { - streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization timed out"); - return; - } - } - } - finally { - panelLock.unlock(); - } - // Wait for the panel to initialize // (happens in a separate thread) waitForAppletInit(panel); - PluginDebug.debug(panel, " -- ", panel.getApplet(), " -- ", panel.isAlive()); + PluginDebug.debug(panel, " -- ", panel.getApplet(), " -- initialized: ", panel.isInitialized()); // Still null? if (panel.getApplet() == null) { - streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization timed out"); + streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization failed"); + streamhandler.write("context 0 reference " + reference + " Error"); return; } |