Closed Bug 388277 Opened 17 years ago Closed 13 years ago

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

Categories

(Core Graveyard :: Java: Live Connect, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: heycam, Unassigned)

References

()

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070508 Iceweasel/2.0.0.4 (Debian-2.0.0.4-1)
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");
        document.call("writeln", new Object[] { "hello there" });
    }
}


Reproducible: Always

Steps to Reproduce:
1. Open http://mcc.id.au/temp/2007/LiveConnectDocumentWriteln/a.html .

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
Keywords: qawanted
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
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?
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?
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.
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.
Product: Core → Core Graveyard
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".
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: