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

Deepak Bhole dbhole at redhat.com
Thu Jan 26 13:18:34 PST 2012


* Thomas Meyer <thomas at m3y3r.de> [2012-01-10 03:29]:
> Check in static JSObject.getWindow() if the PAV containing the applet is
> usable by the user.
> 

Hi Thomas,

Rather than relying on PluginAppletViewer.status, what about using
applet.isActive()? Or did you turn into issues with that approach?

Cheers,
Deepak

> 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")) {
>  
> 





More information about the distro-pkg-dev mailing list