Closed Bug 294833 Opened 20 years ago Closed 13 years ago

liveconnect never returns from a javascript to applet to javascript call [@ JSJ_HashTableAdd]

Categories

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

1.7 Branch
x86
Windows 2000
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: emerson.pardo, Unassigned)

References

()

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

I have an applet that calls a javascript that recalls a function to initialize
the applet with some data. That works fine at Firefox with Java Plugin 1.4.x,
but doesn't work with Java Plugin 1.5.0. Works fine with Internet Explorer 6 and
Opera 7.54 with Java 1.5.0.

The simplified code to test it is below:

--------------Applet code--------------
package com.q10.applet;

import netscape.javascript.*;

public class LifeCycleTest extends java.applet.Applet
{
   
   public void init()
   {
      System.out.println("init...");

      JSObject w = JSObject.getWindow(this);
      w.call("init", null);
   }

   public void destroy()
   {
      System.out.println("destroy...");
   }

   public void start()
   {
      System.out.println("start...");
   }
   
   public synchronized void callMe()
   {
      System.out.println("javascript called this!");
   }
   
}
--------------Html with javascript code--------------
<HTML>
<HEAD>
   <TITLE>Test</TITLE>
   <script language="JavaScript">
        // this function is called from applet
   	function init()
   	{
   		alert('click here!');
                // this  call the function callMe in the applet above
   		document.principal.callMe();
   	}
   </script>
</HEAD>
<BODY background="255,255,255"> 

<APPLET codebase="." code="com.q10.applet.LifeCycleTest" archive="teste.jar" 
		  width=480 height=350 name=principal id=principal MAYSCRIPT>
</applet>
</body>
</html>
-----------------------------------------------------

Reproducible: Always

Steps to Reproduce:
1. Compile the java code and generate a "teste.jar" file
2. Load the html page that reference the "teste.jar"
3. Wait from the alert box, click it.
4. Open the java console and wait...

or...

1. Load the html page from http://www.finansite.com.br/temp/teste.html
2. Wait from the alert box, click it.
3. Open the java console and wait...

Actual Results:  
At step 4 (or 3 at second alternative) nothing happens and, sometimes, after
some minutes, my Firefox crashed (I don't know if this is associated with the
liveconnet. BTW, I give you the talkback crash ids below).

Expected Results:  
Print the message "javascript called this!" at java console.

Talkback crash IDs:

TB5971834W
TB5971550Y

Java plugin version:

Java Plug-in 1.5.0_02
Using JRE version 1.5.0_02 Java HotSpot(TM) Client VM

Firefox versions tested: 1.0.4 and 1.0.3 .
No crash on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050519 Firefox/1.0+

but the applet does not work

Error: [Exception... "'Permission denied to get property XULElement.accessKey'
when calling method: [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://www.finansite.com.br/temp/teste.html :: init :: line 8"  data: no]
Source File: http://www.finansite.com.br/temp/teste.html
Line: 8
Now, at home, the applet at http://www.finansite.com.br/temp/teste.html works on
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Firefox/1.0.4
(Debian package 1.0.4-1). I can see the alert box and click it, but I couldn't
find the java console to look for messages.

Since you get a "Permission denied" error, can your settings for javascript been
disabled?
-> Live Connect
Assignee: nobody → live-connect
Component: General → Java: Live Connect
Keywords: crash
Product: Firefox → Core
QA Contact: general → pschwartau
Version: unspecified → 1.7 Branch
(In reply to comment #2)
> Since you get a "Permission denied" error, can your settings for javascript been
> disabled?

That is from a clean profile. Which means that all Firefox settings are at the
defaults. Also note that the error can be viewed in the JavaScript console.

Firefox did cash I have some TB reports TB5980668X and TB5980561M but they might
be for bug 294630. As I had other tabs open in the background.
I've modified the init method to this:

   public void init()
   {
      System.out.println("build: 2");
      System.out.println("init...");

      String[] args = {};
      JSObject w = JSObject.getWindow(this);
      w.call("init", args);
   }

Can you test the url again? The liveconnect is still never returning from the
callMe method and the string "javascript called this!" is never printed on Java
Console from plugin.

I've never got that error in the JavaScript Console.

And, again, all works fine at Opera and IE with the Sun Java Plugin.
(In reply to comment #6)
>
> It looks like TB5980668X is for this bug.

This means that bug was confirmed? How can I help you with this issue?
This bug will be confirmed? I've had to develop another solution for one client
without applets because this bug and I have another clients that use similar
solutions.

Do you need some other test cases? How can I help you?
I've tested this on recent release 1.0.6 (Mozilla/5.0 (Windows; U; Windows NT
5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6) and this yet didn't work...
Emerson,

You should probably test with a *real* new build... believe it or not, the 1.0.x
series uses code from May 2004 or so.  The nightly builds from the trunk are
currently versioned "1.0+" and branded "Deer Park".

Try one of those instead:
http://www.mozilla.org/developer/#builds
Devin,

Now I did the test on "Deer Park Alpha 2" (Mozilla/5.0 (Windows; U; Windows NT
5.0; en-US; rv:1.8b4) Gecko/20050720 Firefox/1.0+) and the behaviour was the
same. :-(

(In reply to comment #10)
> Emerson,
> 
> You should probably test with a *real* new build... believe it or not, the 1.0.x
> series uses code from May 2004 or so.  The nightly builds from the trunk are
> currently versioned "1.0+" and branded "Deer Park".
> 
> Try one of those instead:
> http://www.mozilla.org/developer/#builds

Testing other pages with "Deer Park" that rely on liveconnect.

Remembering that this works fine with Internet Explover and MS JVM or Sun JVM
(the same used on Firefox). We will have to recommend our clients do not use
Firefox with this solution if this don't get fixed, what I think will be a great
negative advertising for Firefox.

At http://www.bicbanco.com.br there are two applets on the right side on the
page: a graphic and a table. The lines on table are links that calls graphic to
be updated. This call is made through javascript (liveconnect). I get this
exception:

java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation.access$300(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation$CallMethodThread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
	at sun.plugin.liveconnect.PrivilegedCallMethodAction.run(Unknown Source)
	... 6 more
Caused by: java.security.AccessControlException: access denied
(java.net.SocketPermission finansite2.estadao.com.br:80 connect,resolve)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at com.q10.applet.conexao.ConServlet.enviaComando(ConServlet.java:76)
	at com.q10.applet.modelo.ModeloGrafico.busca(ModeloGrafico.java:318)
	at com.q10.applet.modelo.ModeloGrafico.atualizaDados(ModeloGrafico.java:188)
	at com.q10.applet.modelo.ModeloApplet.atualiza(ModeloApplet.java:56)
	at com.q10.applet.grafico.GraficoBase.btClicked(GraficoBase.java:627)
	at com.q10.applet.grafico.GraficoBase.atualizaGrafico(GraficoBase.java:548)
	at com.q10.applet.Base.atualizaGrafico(Base.java:112)
	... 16 more
Hello,

Even never confirmed, seems that with Deer Park Alpha2 (Mozilla/5.0 (Windows; U;
Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050816 Firefox/1.0+) this bug was fixed.

A colateral effect is that the page test (and any other with an applet) is
loading very slowly.
WFM'd per reporter's comment.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
Ok, something gets wrong and this test applet doesn't work again (since the fix worked on Alpha Park, the code was not included at release version?). But, it doesn't crash FF anymore, so I'm downgrading the severity...

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Java Plug-in 1.5.0_06
Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM

I think this is strongly related to this #bug 254285.
Severity: critical → major
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Depends on: 254285
Sorry, 

where is write "worked on Alpha Park" must be "worked on Deer Park Alpha2".
I've got a more detailed error on javascript console on new SeaMonkey[1] with JRE 1.5[2]:


Error: [Exception... "'Permission denied to get property XULElement.accessKey' when calling method: [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: http://www.finansite.com.br/temp/teste.html :: init :: line 7"  data: no]
Source File: http://www.finansite.com.br/temp/teste.html
Line: 7


[1] Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0
[2] Java Plug-in 1.5.0_06 Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
I've been working on a workaround for this bug and Firefox[1] crashed. I've sent this incident: TB14585584X

In my tentative workaround the javascript doesn't call the applet, only applet makes a call to javascript.

[1] Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Incident ID: 14585584
Stack Signature	0x00000000 d234e4a9
Product ID	Firefox15
Build ID	2005111116
Trigger Time	2006-01-31 05:52:14.0
Platform	Win32
Operating System	Windows NT 5.0 build 2195
Module	
URL visited	http://finansite2.estadao.com.br/applets2/ciabcache/banrisul-teste.htm
User Comments	this is a workaround I'm trying to build for the bug 294833
Since Last Crash	150625 sec
Total Uptime	150625 sec
Trigger Reason	Access violation
Source File, Line No.	N/A
Stack Trace 	
0x00000000
JSJ_HashTableAdd  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/jsj_hash.c, line 278]
new_class_descriptor  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/jsj_class.c, line 398]
jsj_GetJavaClassDescriptor  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/jsj_class.c, line 488]
jsj_WrapJavaObject  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/jsj_JavaObject.c, line 190]
jsj_ConvertJavaObjectToJSValue  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/jsj_convert.c, line 804]
nsCLiveconnect::Call  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/js/src/liveconnect/nsCLiveconnect.cpp, line 545]
jpioji.dll + 0x3c10 (0x6d443c10)
jpinscp.dll + 0x7f6f (0x6d427f6f)
jpinscp.dll + 0x8605 (0x6d428605)
nsEventQueueImpl::PostSynchronousEvent  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/xpcom/threads/nsEventQueue.cpp, line 324]
nsJVMManager::PostEvent  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/modules/oji/src/nsJVMManager.cpp, line 345]
jpioji.dll + 0x1bd3 (0x6d441bd3)
jpinscp.dll + 0x396d (0x6d42396d)
USER32.dll + 0x3158f (0x77e4158f)
USER32.dll + 0x2afa1 (0x77e3afa1)
USER32.dll + 0x17e2d (0x77e27e2d)
PluginWndProc  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/modules/plugin/base/src/nsPluginNativeWindowWin.cpp, line 322]
USER32.dll + 0x3158f (0x77e4158f)
USER32.dll + 0x31dc9 (0x77e41dc9)
USER32.dll + 0x31e7e (0x77e41e7e)
nsAppStartup::Run  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/toolkit/components/startup/src/nsAppStartup.cpp, line 151]
main  [c:/builds/tinderbox/Fx-Mozilla1.8/WINNT_5.2_Depend/mozilla/browser/app/nsBrowserApp.cpp, line 61]
KERNEL32.dll + 0x28989 (0x7c598989)


278                       if ((*ht->valueCompare)(he->value, value, arg)) {

105 JSJ_NewHashTable(JSUint32 n, JSJHashFunction keyHash,
106                 JSJHashComparator keyCompare, JSJHashComparator valueCompare,
107                 JSJHashAllocOps *allocOps, void *allocPriv)

745             JSJ_NewHashTable(64, jsj_HashJavaObject, jsj_JavaObjectComparator,
746                             NULL, NULL, NULL);
Summary: liveconnect never returns from a javascript to applet to javascript call → liveconnect never returns from a javascript to applet to javascript call [@ JSJ_HashTableAdd]
the code is broken, i suppose we could implement a fallback behavior of just doing value==value....
Product: Core → Core Graveyard
Crash Signature: [@ JSJ_HashTableAdd]
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: 19 years ago13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: