[RFC] Introduce PAV.isStatusActive() for static JSObject.getWindow()

Thomas Meyer thomas at m3y3r.de
Tue Jan 10 00:27:55 PST 2012


Check in static JSObject.getWindow() if the PAV containing the applet is
usable by the user.

diff -r 7d090bfa3819 plugin/icedteanp/java/netscape/javascript/JSObject.java
--- a/plugin/icedteanp/java/netscape/javascript/JSObject.java	Tue Dec 13 12:45:36 2011 +0100
+++ b/plugin/icedteanp/java/netscape/javascript/JSObject.java	Tue Jan 10 09:20:54 2012 +0100
@@ -242,10 +242,14 @@
      */
     public static JSObject getWindow(Applet applet) {
         PluginDebug.debug("JSObject.getWindow");
+        PluginAppletViewer pav = (PluginAppletViewer) applet.getAppletContext();
+
+        if(!pav.isStatusActive())
+            throw new IllegalArgumentException("PAV is not usable/inactive");
+
         // FIXME: handle long case as well.
         long internal = 0;
-        internal = ((PluginAppletViewer)
-                    applet.getAppletContext()).getWindow();
+        internal = pav.getWindow();
         PluginDebug.debug("GOT IT: ", internal);
         return new JSObject(internal);
     }
diff -r 7d090bfa3819 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Tue Dec 13 12:45:36 2011 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Tue Jan 10 09:20:54 2012 +0100
@@ -675,6 +675,16 @@
         PluginDebug.debug("Applet panel ", panel, " initialized");
     }
 
+    /**
+     * Is this PAV usable by the user
+     *
+     * @return true, when usable by the user
+     */
+    public boolean isStatusActive() {
+
+        return status.get(identifier).equals(PAV_INIT_STATUS.REFRAME_COMPLETE);
+    }
+
     public void handleMessage(int reference, String message) {
         if (message.startsWith("width")) {
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120110/e4f27d40/attachment.bin 


More information about the distro-pkg-dev mailing list