Firefox on Mac issue
"Joseph Merzdov" <[email protected]> Thu, 15 Nov 2007 10:50:57 -0500
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Message-ID | <hsOdnR7T35V196HanZ2dnUVZ_q6mnZ2d__47671.7813908637$1195142144$gmane$org@mozilla.org> |
Hello,
The problem we have is that JSObject used in LiveConnect stops working in
Firefox on
MAC if it does not get called from JavaScript directly.
The sample below illustrates this problem.
There is an applet that have "test1()" method being called from JavaScript.
"testJSObject()" method prints results of toString() method of JSObject.
If "testJSObject()" gets called from "test1()" method directly then
"toString()" returns a valid non-null value.
If "testJSObject()" gets called from another thread then "toString()"
returns null value starting from some point.
Moreover, "toString()" does not work if "testJSObject()" is called using
javax.swing.SwingUtilities.invokeAndWait or invokeLater methods
on AWT event dispatching thread that in fact is the same as thread where
"test1()" is called.
As a result, the Common DOM API based on JSObject does not work either.
This happens to all versions of Firefox under MAC. Firefox on Windows,
Safari on MAC and IE works fine.
I have the following enviroment:
============================================================================
MAC OS 10.4.9
Firefox 2.0.0.9
Java Plug-in 1.5.0
JRE 1.5.0_07
Here is Java console log for the sample below:
============================================================================
THREAD: AWT-EventQueue-6 JSObject: [object HTMLDocument]
THREAD: AWT-EventQueue-6 JSObject: [object HTMLDocument]
THREAD: Thread-8 JSObject: [object HTMLDocument]
THREAD: Thread-8 JSObject: [object HTMLDocument]
THREAD: AWT-EventQueue-6 JSObject: [object HTMLDocument]
THREAD: Thread-8 JSObject: null
THREAD: Thread-8 JSObject: null
THREAD: Thread-8 JSObject: null
THREAD: Thread-8 JSObject: null
THREAD: Thread-8 JSObject: null
Here is the sample:
============================================================================
import netscape.javascript.*;
public class test extends JApplet
{
public void testJSObject()
{
JSObject win = JSObject.getWindow(this);
if (win == null)
{
System.err.println("Unable to obtain Window object");
}
else
{
JSObject doc = (JSObject)win.getMember("document");
if (doc == null)
{
System.err.println("Unable to obtain Document object");
}
else
{
System.err.println("THREAD: " +
Thread.currentThread().getName() + " JSObject: " + doc);
}
}
}
public void test1()
{
testJSObject();
testJSObject();
Thread t = new Thread()
{
public void run()
{
testJSObject();
testJSObject();
testJSObject();
try
{
Thread.sleep(100);
testJSObject();
testJSObject();
}
catch (Exception ex)
{
}
testJSObject();
testJSObject();
}
};
t.start();
try
{
Thread.sleep(100);
}
catch (Exception ex)
{
}
testJSObject();
}
}
--------------------
Thank you very much for you time!