Closed Bug 441815 Opened 17 years ago Closed 13 years ago

Race condition in first JavaScript-to-Java call against initially invisible applet

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kbrussel, Unassigned)

Details

Attachments

(1 file)

In Firefox 3 there is a race condition in the situation where an applet hosted by the new NPRuntime Java Plug-In is initially invisible, then is made visible, and then a JavaScript-to-Java call is made against it. The two attached test cases illustrate the problem. Use JDK 6 Update 10 (currently http://jdk6.dev.java.net/6u10ea.html) to reproduce. Run javac -classpath .../jre/lib/pluginjar *.jara to compile the Java sources. index-bug.html and the associated TestAppletBug.java demonstrate the problem; the div containing the applet is made visible from JavaScript and immediately afterward the applet is looked up and a call is made against it. This results in an exception from the JavaScript interpreter: ----- message = document.getElementById("testApplet").runTest is not a function fileName = http://j2se.east.sun.com/deployment/www/tests/1.6.0_10/6670162/index-bug.html lineNumber = 17 stack = runTest()@http://j2se.east.sun.com/deployment/www/tests/1.6.0_10/6670162/index-bug.html:17 @http://j2se.east.sun.com/deployment/www/tests/1.6.0_10/6670162/index-bug.html:9 name = TypeError ----- Note that the Java Plug-In does not receive any callback or notification about the attempted invocation of the runTest method. The exception originates in the JavaScript interpreter. This problem doesn't happen with the old OJI-based Java Plug-In. index.html and the associated TestApplet.java work correctly. In this case setTimeout() is used to return control to the browser between the point where the applet is made visible and when the first JavaScript-to-Java call is made.
I think you want jst, not me (djst) :)
Ah, I finally understand why people sometimes add me instead of jst: if you type jst@mozilla.com, I'm added because that's the closest match (djst@mozilla.com). Is there an alias set up for jst@mozilla.com -> jst@mozilla.org? Sorry for the off-topic bugspam.
Is this still an issue ?
Flags: needinfo?(kbrussel)
I don't know; I left Sun over three years ago. Did you try the test case?
Flags: needinfo?(kbrussel)
The test cases work for me in jre6/7. We now flush layout before trying to instantiate a plugin in response to a synchronous request -- the issue before was likely that the pending layout change raced against the attempt to spawn the plugin.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: