Closed Bug 83698 Opened 24 years ago Closed 24 years ago

JavaScript to Java won't work unless open Java console first

Categories

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

Sun
Solaris
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: joe.chou, Assigned: joe.chou)

References

Details

(Whiteboard: oji_escalation)

Attachments

(4 files)

After the fix of 82034, JavaScript to Java communication works OK on Windows. But on Unix, without opening Java console first, the communication would not work, and the browser was hung. To reproduced the problem, first make sure the fix of 82034 is in your build, then try the test case attached. If open Java console first, then go to the test page, it will work. But if go to the test page first, and then open Java console, the browser will be hung. To verify if it work or not, when press the print button in the test case, a message should be displayed in Java console, saying that the print was called.
Attached file A simple test case
Assignd to myself.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Depends on: 82034
Let me move this over to the OJI component to match the other bugs you mentioned above -
Component: Live Connect → OJI
QA Contact: pschwartau → shrir
CC Patrick Beard (liveconnect owner) and Chris Karnaze (layout owner), since the patch changes code in the two modules. Can you review the patch (actually Patrick drafted the patch), please? With the patch, test on Linux seemed OK now.
r=beard
Patrick, whom should I ask for sr=, any suggestions?
brendan, would you sr?
Brendan, without this fix, Unix JavaScript to Java will not work unless opening Java console first. Would you sr, please?
Component: OJI → Live Connect
Blocks: 84526
*** Bug 84864 has been marked as a duplicate of this bug. ***
*** Bug 84526 has been marked as a duplicate of this bug. ***
Since this problem also hangs the browser when doing Java to JavaScript communications, made this a priority 2 bug. The patch also resolves the Java to JavaScript problem.
Priority: -- → P2
*** Bug 85010 has been marked as a duplicate of this bug. ***
I got asked to super review this. Can you please tell me whiy this is only a problem in Unix? Is this not a problem on Mac? Does this make initializing the the JVM more eager on Unix? Even if it is not *needed* on other platforms, what is the reason for not doing it anyway on other platforms?
UNIX OJI plugings communicate with an out of process JVM. Windows and Mac OJI plugins are entirely in-process. We discovered that the communication protocol doesn't work unless you eagerly create the JNI environment before instantiating the OJI plugin.
Patrick, does that mean Mac does not have the problem then? We know Windows does not.
sr=jband. Patrick, Thanks for clearing up my questions.
Joe: Please add a comment in the code where it checks for XP_UNIX that briefly explains why that section of code is Unix specific. Just quoting what Patrick wrote is fine. It is good to have this stated clearly in the code for future maintainers.
I'll do that, and I'll add a new attcchment to reflect that. Thanks, John.
Here is some more explanation of the problem, which has been added to the comments of the patch: The proxy JNI needs to be created by the browser. If it is created by someone else (e.g., a plugin), the proxy somehow will not work, and break LiveConnect. Currently, on Unix, when instantiating a Java plugin instance (by calling InstantiateEmbededPlugin() next), Java plugin will create the proxy JNI if it is not created yet. If that happens, Live- Connect will be broken. Before lazy start JVM was implemented, since at this point the browser already created the proxy JNI buring startup, the problem did not happen. But after the lazy start was implemented, at this point the proxy JNI was not created yet, so the Java plugin created the proxy JNI, and broke liveConnect. On Windows, Java plugin just lets the browser create the proxy JNI, and hence does not have such a problem. The work-around: The root cause of the problem is in Java plugin's Unix implementation, and it should let the browser to create the proxy JNI. A seperate bug will be filed against Java plugin. Untill the bug is fixed in Java plugin, as a work-around, make sure the proxy JNI has been created by the browser here, before plugin gets a chance.
Blocks: 56430
Can I get a= from someone, please?
Blocks: 83989
Why the + } else { + return rv; + } ? Could this break plugins (#ifdef XP_UNIX) if OJI is not installed? (Is it better to just continue if the GetService fails?) (I would think we might distribute without OJI in some embedding cases.) It seems like the other code that uses nsIJVMManager outside of oji doesn't fail this way if it doesn't exist. I don't see OJI in http://lxr.mozilla.org/seamonkey/source/embedding/config/basebrowser-unix .
Good catch. If a browser does not have Java plugin, but have other embeded plugins, it will break at the else part. Modified the patch to remove the else statement. Can I get a= now?
Blocks: 77600
a=dbaron for trunk checkin if your reviewer agrees that the change is correct.
No longer blocks: 77600
Patrick and John, any comments to the change?
Patch has been checked into trunk.
Noting high-priority status of this bug in Status Whiteboard.
Whiteboard: oji_escalation
Marked fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
No longer blocks: 56430
I'm going to checkin an XP_OS2 for this fix as well. The OS/2 java plugin is based on the unix java plugin.
Liveconnect qa->pschwartau@netscape.com
QA Contact: shrir → pschwartau
Verified Fixed with Mozilla trunk binary 2001111109 on Linux. 1. I brought up Mozilla 2. I brought up Joe's testcase FIRST. 3. I brought up the Java Console SECOND. 4. Everything worked, and print messages appeared in the Java Console
Status: RESOLVED → VERIFIED
Note: testcase also works with Mozilla trunk 20011113xx on WinNT, although it seems that this was never an issue on Windows -
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: