JDK-6661232 : Can't dynamically set applet's width and height in Firefox 3
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-02-09
  • Updated: 2010-09-08
  • Resolved: 2008-06-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u10 b13Fixed
Due to the conversion from the OJI to the NPRuntime as the scripting interface for the new Java Plug-In in Firefox 3, and due to the fact that the OJI apparently had special-case handling for this, we can not dynamically set the size of applets in Firefox 3 with the new plug-in. 

In the NPRuntime, the browser queries our scriptable NPObject whenever it tries to access a field or method. If our NPObject indicates that it does have this field or method, then the browser delegates its handling to us. This allows plugins to override the handling of properties in the DOM hierarchy and is apparently standard, longstanding behavior.

The browser queries our scriptable NPObject (which also mirrors the applet tag in the DOM hierarchy) to see whether it has fields like "width" and "height". Unfortunately due to the fact that java.awt.Applet implements ImageObserver, ImageObserver's WIDTH and HEIGHT static final fields are visible to the JavaScript engine, we claim that we have them, and this prevents our being able to set them in the DOM since we don't want to override the browser's behavior when changing them. Currently we raise a JSException because the width and height are final fields and therefore can not be set.

SUGGESTED FIX http://sa.sfbay.sun.com/projects/deployment_data/6u10/6661232.0 testcase: http://j2se.east.sun.com/deployment/www/tests/1.6.0_10/6661232

EVALUATION Explicitly declare that we do not have either the "width" or "height" field on the applet object, so that we do not accidentally override the handling of these when manipulating the DOM object for the applet.