Closed Bug 254285 Opened 20 years ago Closed 7 years ago

javascript calling java applet with liveconnect does not work.

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: nicolaseven, Unassigned)

References

()

Details

Attachments

(1 file)

1.05 KB, application/octet-stream
Details
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1

When changing the fields on the webpage, the java applet is not updated. The
called methods appear as not found in the javascript console. The problem
appears when mozilla is first opened, and after browsing some other page (I
could not reproduce this), the problem disappears.

Reproducible: Sometimes
Steps to Reproduce:
1. open url.
2. change, for example the text size using the form.
Actual Results:  
nothing. an error is logged in the javascript console.

Expected Results:  
the text size on the applet should have changed.

Java(TM) Plug-in: Version 1.4.2_03
Using JRE version 1.4.2_03 Java HotSpot(TM) Client VM

(Sun virtual machine)
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040803
Firefox/0.9.1+

WFM
yes, it also works for me on windows, but not on linux.
j2sdk1.4.2_01-b06.
firefox version  - PR, (debian package and stock download both) as well as RC1
(debian package). 
I have the same problems with these browsers reporting "element.xyz is not a
function", where xyz is a public method of a java applet. 
Works in firefox 0.8 windows and linux. Also works fine in mozilla 1.8a4. 
Sample page:
http://scazdl.org/~robertz/test.html

Steps to reproduce error: visit page, click the "try me", check out the
javascript console.
Confirming in Firefox 1.0.

What is more, even a simple javascript:alert(java) reports that "java is not
defined", while it should say something like "[JavaPackage java]". The same
problem exists with the more general javascript:alert(Packages).

I'm using Firefox 1.0 (pl-PL) on Gentoo Linux, JRE Java Plug-in Blackdown-1.4.1-01

In Mozilla-trunk this works ok.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to comment #4)

OMG. Sorry. Ignore the last comment. This should be still an unconfirmed bug. I
deeply apologize...
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041126 Firefox/1.0
Java(TM) Plug-in Blackdown-1.4.2-01

I can confirm this for one of the banks I use

URL: www.uob.com.sg/pages/personalinternetbanking.html

Steps to reproduce:

1. open URL.

Actual Results:
Nothing. The following error is logged in the javascript console:

Error: appletobj.start is not a function
Source File: https://uniservices3.uobgroup.com/CLO/jsp/customer/pub_clologin.jsp
Line: 64

Expected Results:
The login applet should load, allowing the user to enter his PIN for internet
banking authentication.

Same results with Mozilla 1.7.3, the latest nightly build and Mozilla 1.8a5.

However, *Mozilla 1.8a4* works perfectly.


Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

I can confirm this bug in Firefox 1.0 on Windows 2000 with the Java
Plug-in: Version 1.4.2_03

In Mozilla 1.7.5 everything works: when I dump the applet object's
key-value pairs using:

 for (key in applet_obj) {
   document.write(key + "=" + applet_obj[key]);
 }

I see the wrappers for all of the applet's public Java methods, for example,
the first one is:

notifyAll=
function notifyAll() {
    [native code]
}

the wrapper for the java.lang.Object.notifyAll() method.  There are 207
such methods.

In Firefox I don't see any of these, and get the same "is not a
function" errors in the console as previously described when I try and
call the methods.
May be related to bug 275641
This bug also fails to work on the following page

http://www.diracdelta.co.uk/science/source/e/n/engine%20radiated%20noise/source.html

It works fine in IE and I am sure it worked in Mozilla 1.4 but does not work in
FF1.0 or Mozilla 1.8b {Build ID: 2005021614}
Attached file test case
Same here, but in version 1.0.3 ( Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
rv:1.7.7) Gecko/20050424 Firefox/1.0.3 ) even the calling of public applet
methods in the same window is NOT working if you are not reloaad the document
with applet first.

Attached is an example.
Build the sources, then copy test.jar to html dir and open applet.html, then
click on "open" link - you will get JavaScript error. Reload window, click on
that link - everything works fine.

Open frameset.html in browser, then click on "Open" link in right frame -
Javascript error, refresh LEFT frame with applet, click on the link in RIGHT
frame - everything works fine.
 In Firefox 1.0.3 and 1.0.4 on Windows XP Pro, with Sun's J2SE5.0 plugin,
javascript seems to now be able to access an Applet public methods. IE 6 with
the same plugin can. Steps to reproduce:

-- testApplet.html --
<html>
<head>
<title>Test page</title>
<script type="text/javascript">
function doAlert() {
document.theApplet.doAlert();
}
</script>
</head>
<body>
  <!--[if !IE]> -->
  <object classid="java:AppletTest.class" name="theApplet"></object>
  <!--<![endif]-->
<object	name="theApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93">
 <param name="code" value="AppletTest" />
</object>
<p><a href="javascript:doAlert();">Call the applet</a></p>
</body>
</html>

-- AppletTest.java --
import java.applet.Applet;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

public class AppletTest extends Applet {
    public void doAlert() {
        JOptionPane.showMessageDialog(new JLabel("Here it is"), null);
    }
}

 Save testApplet.html and the compiled AppletTest.class in Apache's htdocs, and
browse to testApplet.html. It works in IE but not Firefox.

 See also http://forum.java.sun.com/thread.jspa?messageID=3592086&#3592086

Thanks,
Graham King.
 The second line should be
'javascript seems to *not* be able to access an Applet's public methods. IE 6 with'

 Apologies.
 After further investigation it seems that Firefox does not recognise an applet
in an <object> tag in a way that it can be scripted. It seems to think it is a
NodeList (using alert(document.theApplet) ).
 The <applet> tag works fine. Which means I'm probably off topic for this bug.
Apologies.
Blocks: 294833
I think this bug is related to bugs 294833 and 301494...
I've got this detailed error on javascript console on new SeaMonkey[1] with JRE 1.5[2]:

Error: [Exception... "'Permission denied to get property XULElement.accessKey' when calling method: [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: https://uniservices3.uobgroup.com/CLO/jsp/customer/pub_clologin.jsp :: initApplet :: line 57"  data: no]
Source File: https://uniservices3.uobgroup.com/CLO/jsp/customer/pub_clologin.jsp
Line: 57

[1] Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060130
SeaMonkey/1.0
[2] Java Plug-in 1.5.0_06 Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
(In reply to comment #14)
> I think this bug is related to bugs 294833 and 301494...

I don't think so. It seems to be a duplicate of 254075, though this incarnation has more info and examples.
Assignee: bross2 → nobody
The HTML <applet> element and related java functionality was removed from Gecko in Bug 1279218. Marking related bugs as invalid.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: