Closed
Bug 657230
Opened 14 years ago
Closed 14 years ago
value of java applet parameter "id" mingled with id of applet
Categories
(Core Graveyard :: Plug-ins, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: fsefrna, Unassigned)
Details
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Paramerer "id" as read in an applet by getParameter() has value of "id" attribute of the applet.
Reproducible: Always
Steps to Reproduce:
1. the html code:
<applet id='abcd' code=Applet.class archive=applet.jar>
<param name=id value='1234'>
</applet>
2. the java applet code:
getParameter("id")
Actual Results:
'abcd'
Expected Results:
'1234'
Thi si new in FF 4, FF 3.6 behaves correctly.
Updated•14 years ago
|
Version: unspecified → 4.0 Branch
import java.applet.*;
public class TestApplet extends Applet{
public void init() {
System.out.println("id = " + getParameter("id"));
}
}
How to compile this? Can you attach a prepared .jar file of this? I am not familiar with compiling Java, but I have JRE 6 installed, I could then test it. Thanks
1/ save as TestApplet.java
2/ run "javac TestApplet.java"
Modify the opening part of the tag to <applet id='abcd' code='TestApplet.class'>
Comment 5•14 years ago
|
||
Works For Me (result 1234).
Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Mozilla/5.0 (X11; Linux x86_64; rv:5.0a2) Gecko/20110523 Firefox/5.0a2
Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110523 Firefox/6.0a1
Strange, I get no output. Not in the page and not in the terminal. The applet object is loaded in the page, but it is empty.
Even tried appletviewer TestApplet.class. There I get errors like this:
> run
run sun.applet.Main TestApplet.class
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
The application exited
Ok, here comes a complete test case:
TestApplet.java:
public class TestApplet extends java.applet.Applet{
public void paint(java.awt.Graphics g) {
g.drawString("id = " + getParameter("id"), 20,20);
}
}
(compiled by jdk1.6's javac into TestApplet.java)
test.html:
<body>
<applet id='abcd' code='TestApplet.class'>
<param name=id value='1234'>
</applet>
</body>
Output of the page:
id = abcd
instead of
id = 1234
Works as expected in FF 3.6. Bug in FF 4.0
Thanks, the updated applet source worked now, it displayed in the page. However, I got "id = 1234" too...
I also updated the html file to use Strict standards mode, but no change. What is your Java version? I have jre1.6u25.
However, I feel there may be a problem. When I changed the parameter name, e.g.:
<param name='idz' value='1234'>
and left the applet code unchanged, it really retrieved 'abcd' from the parent <applet> id. There may be some problem/race because the id from param shadows id from applet and maybe it does not always win (take precedence).
| Reporter | ||
Comment 10•14 years ago
|
||
Oh, I've upgraded my Java to 1.6_25 and the problem doesn't occur any more!
It's strange that it didn't happen with Java 1.6_23 in FF 3.6 but only with FF 4.0.
Anyways, I'm happy now, thanks.
Comment 11•14 years ago
|
||
Yes, it is interesting. But as I read the HTML spec, handling of <param> values is quite undefined, and it is the job of the plugin. So it is questionable, what Firefox can do about this.
If you are the developer of the site where you found this problem, I would recommend renaming the id parameter. The problem could return anytime.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: General → Plug-ins
Product: Firefox → Core
QA Contact: general → plugins
Resolution: --- → WORKSFORME
Version: 4.0 Branch → 2.0 Branch
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•