Using LiveConnect to call document.writeln from a Java applet causes a hang



12 years ago
7 years ago


(Reporter: heycam, Unassigned)



Firefox Tracking Flags

(Not tracked)




(2 attachments)



12 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070508 Iceweasel/ (Debian-
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a5pre) Gecko/20070522 Minefield/3.0a5pre

If I write a simple applet that calls document.writeln using JSObject, the browser will hang.

This is my applet code:

import javax.swing.JApplet;
import netscape.javascript.JSObject;

public class A extends JApplet {
    public void start() {
        JSObject window = JSObject.getWindow(this);
        JSObject document = (JSObject) window.getMember("document");"writeln", new Object[] { "hello there" });

Reproducible: Always

Steps to Reproduce:
1. Open .

Actual Results:  
Browser hangs.

Expected Results:  
Instead of hanging, the text "hello there" should replace the current document.
Component: General → Java: Live Connect
Product: Firefox → Core
QA Contact: general → live-connect
Version: unspecified → Trunk


12 years ago
Keywords: qawanted

Comment 1

12 years ago
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a7pre) Gecko/2007071605 Minefield/3.0a7pre

I'm testing on Windows XP, but this is what I experienced: the first time I loaded the page I got a really hard hang. My whole system froze and I couldn't even move my mouse. The page did finally load, though, and "hello there" was written. On subsequent page loads I didn't hang at all. After I restarted Firefox and tried again, I didn't hang either, so I think this may have just been the JVM loading.

However, I did experience a "hang" in the sense that the page never finished loading after "hello there" was written. The throbber kept going and the Stop button wasn't deactivated.

Do you hang every time you load the page or just on the first load? Also, what exactly do you mean by "hang"?
Keywords: qawanted

Comment 2

12 years ago
Hi Adam.

By "hang" I mean Firefox stopped responding (toolbar buttons don't "raise" when the mouse is moved over them, nothing responds to clicks, the window doesn't repaint etc.).  I've had the page open for about 10 minutes now and it is still hung.

I've attached the output of pressing Ctrl+\ at the terminal (dump of Java threads running), though it's maybe not useful.  You can see that the "thread applet-A.class" thread is stuck in one of Sun's LiveConnect classes, but it could well be that it has called back into Mozilla code.  What's the easiest way for me to get a stack trace of Mozilla code?

Comment 3

12 years ago
Created attachment 272573 [details]
Java thread dump while Mozilla is hung.

Comment 4

12 years ago
After having another look at that Java thread dump, I see that the "main" thread is doing plugin closing stuff, presumably because the document.write has removed the applet from the document.  Might there be a deadlock somewhere?

Comment 5

12 years ago
You could attach gdb to the hung process, but you won't get a useful stack unless you're using a debug build or a system-built version with a debug package.

Comment 6

12 years ago
Created attachment 272607 [details]
gdb backtrace while Mozilla is hung.

This is the gdb backtrace after I did a 'cvs up' and recompiled with debugging info.  It seems a SIGSEGV happens while in the Sun's Java plugin code.


9 years ago
Component: Java: Live Connect → Java: Live Connect
Product: Core → Core Graveyard

Comment 7

7 years ago
Firefox code moved from custom Liveconnect code to the NPAPI/NPRuntime bridge a while back. Mass-closing the bugs in the liveconnect component which are likely invalid. If you believe that this bug is still relevant to modern versions of Firefox, please reopen it and move it the "Core" product, component "Plug-Ins".
Last Resolved: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.