Closed
Bug 451882
Opened 17 years ago
Closed 15 years ago
Resizing Java Applet with Javascript on OSX breaks Applet rendering
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: bugzilla.mozilla, Unassigned)
References
()
Details
(Whiteboard: [CLOSEME 2010-11-01])
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Changing the DOM size of an applet does not cause the Java Applet to reflect the new size.
Manually calling the java setSize(x,y) method does not fix the problem.
Reproducible: Always
Steps to Reproduce:
1. Visit a page with an Applet
2. Resize Applet with Javascript
3. Watch.
Actual Results:
Either the applet will still be rendering at its original size or the clipping boundary of the applet will be messed up so that the new size is being rendered but only the previous area of the applet is visible.
Expected Results:
The Applet should resize correctly to render the entirity of the new size.
This is not just a firefox problem, it lies in the plugin used to support Java applets on OSX, and thus also affects Opera and other browsers (but not Safari).
A termperamental workaround can be achieved by resizing one axis, notifying java, then resizing the other axis.
Here are a bunch of relevant links:
More verbose description
http://blog.marcuscobden.co.uk/2008/08/case-of-bad-cropping.html
Test Case
http://marcuscobden.co.uk/stuff/2008-07/applet/
Java Embedding Plugin Bug
http://sourceforge.net/tracker/index.php?func=detail&aid=2030298&group_id=107955&atid=649116
Opps, I should add that I tested this in minefield tonight (23-08-2008) (3.1a2pre) and saw the same behaviour.
The OS version is Mac OSX 10.5.4 (Leopard) but it should be duplicatable on Tiger too.
Here are some messages from the Java console which might answer a few questions:
Java Plug-in 1.5.0
Using JRE version 1.5.0_13 Java HotSpot(TM) Client VM
MRJ Plugin for Mac OS X v1.0.1
Comment 2•17 years ago
|
||
Marcus,
1- Your markup code has errors. Please fix them so that we can safely eliminate sources of errors.
2- Change
<object id="applet" width='100px' height='100px'
codebase='bin/' classid="java:TestApplet.class"
type="application/x-java-applet" >
into
<object id="applet" width="100" height="100"
codebase="bin/" classid="java:TestApplet.class"
type="application/x-java-applet">
Note the extra blank space in type value.
Note that this will avoid resorting to a few parseInt() here and there.
3- If the form is not submitted to the server, then don't use it: a form should be used only if some data is to be submitted to the server.
In your webpage, you can just use (radio, checkbox, command) buttons without a wrapping form.
4- I would avoid resorting to setAttribute and getAttribute as they are buggy in other browsers. a.width and a.height can be used instead
DOM 2 HTML object attributes:
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177
5- Did you try JRE 1.6.0_0x for your OS? 1.5.0_13 is not the latest..
Making the above changes may not fix your problem but it will eliminate sources of errors.
Regards, Gérard
Comment 3•17 years ago
|
||
One other thing. If notifyJava is a global variable, then best is to declare it as such. Also, I would avoid using the same identifier in the function argument as this certainly can cause source of confusion (or even conflicts): it makes code reviewing more difficult.
> 2- Change
> <object id="applet" width='100px' height='100px'
> codebase='bin/' classid="java:TestApplet.class"
> type="application/x-java-applet" >
>
> into
>
> <object id="applet" width="100" height="100"
> codebase="bin/" classid="java:TestApplet.class"
> type="application/x-java-applet">
Done. I think I primarily had the parseInts because I was worried about passing strings to the Java resize code, but on testing it now it doesn't seem to have made a difference (a.resize() is a Liveconnect call to thr Java API).
> 3- If the form is not submitted to the server, then don't use it
Done. Sorry I was mainly using it to get at the current choices, but it turns out manual ID lookups are just as concise in this case.
I added in the radio & check options last night, before that it was just 8 different buttons ;)
> 4- I would avoid resorting to setAttribute and getAttribute as they are buggy
> in other browsers. a.width and a.height can be used instead
Done.
> 5- Did you try JRE 1.6.0_0x for your OS? 1.5.0_13 is not the latest..
Unfortunately 1.6 is not available on my hardware, Apple have only published it for 64bit machines, and alas my early Macbook is only Core Duo not Core 2 Duo and doesn't run in 64 bit.
Sorry about the global variable confusion, that was just me forgetting to use 'var' before the assignment.
I've updated the code at the previous location, and made sure it passes the W3C validator this time.
Marcus
Comment 5•17 years ago
|
||
Almost perfect...
function resizeClick(event) {
var notifyJava = document.getElementById('chk_notify_java').checked;
Here, notifyJava is local, not a global variable.
Later you reuse the same identifier. It makes code reviewing, understanding, maintenance a bit more difficult to untangle.
------------
Can you try
function resizeX (boolNotifyJava) {
var a = document.getElementById("applet");
a.log("JS: Setting HTML attributes");
a.width = newWidth;
if (boolNotifyJava) {
a.log("JS: Calling Java Resize Method");
a.resize(newWidth, a.height);
};
}
Also, what happens if you do
a.resize(a.width, a.height);
------------
I would change
<input type="checkbox" name="notify_java" id="chk_notify_java"/><label for="notify_java">Notify Java of change</label><br />
<input type="submit" value="Resize" onclick="resizeClick()"/>
into
<input type="checkbox" name="chk_notify_java" id="chk_notify_java" /><label for="chk_notify_java">Notify Java of change</label><br />
<input type="button" value="Resize" onclick="resizeClick();" />
Anyway... these are small tuning details. Unfortunately, I can not help any further as I do not have or use a Mac OS X.
Regards, Gérard
Comment 6•17 years ago
|
||
We used to have LiveConnect examples and tests for <applet>s and <object>s here:
http://www.mozilla.org/quality/browser/front-end/testcases/oji/
(I know because I upgraded each and all of them in bug 360039)
and after their migration to
http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/
none of them works because the class path and codebase path changed.
I'll ask that this be changed..
--------------
In your webpage, what happens if you use
type="application/java"
instead of
type="application/x-java-applet"
and if you add
data="TestApplet.class"
Comment 7•17 years ago
|
||
> none of them works because the class path and codebase path changed.
>
> I'll ask that this be changed..
Correction. Forget that. They work now! Can you try them, the first being
http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/objtest1.html
Right, I tested out the first 10 (let me know if you want the others tested too).
The first failure is on page 5 (http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/objtest5.html)
Test cases #2 and #3 fail to load and the following stack trace is printed to the console twice.
Image: (http://marcuscobden.co.uk/stuff/2008-07/applet/test-5.png)
load: class JitterText.class not found.
java.lang.ClassNotFoundException: JitterText.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:168)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:599)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:723)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1870)
at jep.AppletFramePanel.createApplet(AppletFramePanel.java:189)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:652)
at sun.applet.AppletPanel.run(AppletPanel.java:326)
at jep.AppletFramePanel.run(AppletFramePanel.java:176)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:271)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:44)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:158)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:155)
... 11 more
The next failure is on page 7, 3 of the applets don't render any more than black squares.
(http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/objtest7.html)
Image: (http://marcuscobden.co.uk/stuff/2008-07/applet/test-7.png)
Culprits:
Object height="75%" within a <p> with a specified height of 400px
Object height="50%" within a <p> with a specified height of 400px
Object height="25%" within a <p> with a specified height of 400px
Finally on page 10 only the original object renders correctly, all the others cut off the text to some extent.
(http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/objtest10.html)
Image: (http://marcuscobden.co.uk/stuff/2008-07/applet/test-10.png)
I also tested http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/javatojstests.html
I'll test the other liveconnect ones tomorrow perhaps.
Tests 1-6,8,10 fail with the same error
Error: testcases[tc] is undefined
Source File: http://www-archive.mozilla.org/quality/browser/front-end/testcases/oji/browser.js Line: 104
Reporter | ||
Comment 10•17 years ago
|
||
Also I updated the test case code again with your suggestions, thanks.
Just calling a.resize(a.width, a.height); doesn't appear to do anything.
The log messages note the call but the rendering doesn't change. I'd imagine the java discards it as it would have no effect
I'm on an image spree tonight, here are a few screenshots:
Before (original applet):
http://marcuscobden.co.uk/stuff/2008-07/applet/before.png
After x and y resize (without notify)
http://marcuscobden.co.uk/stuff/2008-07/applet/after-notify.png
After x and y resize (with notify)
http://marcuscobden.co.uk/stuff/2008-07/applet/after+notify.png
NB: With both 'after' states, the applet does not render this until it is fully scrolled into view.
While it is not all visible, odd things happen, inconsistently.
http://marcuscobden.co.uk/stuff/2008-07/applet/after-odd.png
Comment 11•15 years ago
|
||
This is a mass search for bugs which are in the Firefox General component, are
UNCO, have not been changed for 500 days and have an unspecified version.
Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
Comment 12•15 years ago
|
||
No reply from reporter, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•