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

Thomas Meyer thomas at m3y3r.de
Tue Jan 31 09:52:14 PST 2012


Am Donnerstag, den 26.01.2012, 16:18 -0500 schrieb Deepak Bhole:
> * 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,

Hi Deepak,

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

I wasn't aware of, that this method could be used here! I added below
extra check, because of PR852. I did run into the situation that the
instance was not active any more, but the called to getWindow() still
happened with an reference this inactive instance.
I think by fixing PR852, this extra check is not needed any more.

mfg
thomas

> 
> 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