JSObject's call() method throws exception for Mozilla

RESOLVED INCOMPLETE

Status

Core Graveyard
Java: Live Connect
RESOLVED INCOMPLETE
12 years ago
7 years ago

People

(Reporter: priya.arbole, Unassigned)

Tracking

1.8 Branch
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Build Identifier: 

Problem description : 
With Mozilla browser when I try to invoke the JSObjects call method 
it throws following exception 

SEVERE: Stack Trace - netscape.javascript.JSException 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
at java.lang.reflect.Constructor.newInstance(Unknown Source) 
at sun.plugin.liveconnect.PrivilegedConstructObjectAction.run(Unknown Source) 
at java.security.AccessController.doPrivileged(Native Method) 
at sun.plugin.liveconnect.SecureInvocation$1.run(Unknown Source) 
at java.security.AccessController.doPrivileged(Native Method) 
at sun.plugin.liveconnect.SecureInvocation.ConstructObject(Unknown Source) 
at sun.plugin.services.WPlatformService.waitEvent(Native Method) 
at sun.plugin.services.WPlatformService.waitEvent(Unknown Source) 
at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source) 

Following is what I have done in my applet. 
I have passed a DOM html page in sText as shown below to CallJavaScript 

String sText = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'xhtml1-transitional.dtd'><html mlns:ims0='http://www.imsproject.org/xsd/imscp_rootv1p1p2'><head><META http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Test Page </title><script type='text/javascript' langauge='javascript'>\t\t\t\t\t\tfunction callMe(sText){\t\t\t\t\t\t\talert(" in CallMe");\t\t\t\t\t\t}\t\t\t\t\t\t\tfunction callMeNS(sText) {\t\t\t\t\t\t\talert("in CallMeNS");\t\t\t\t\t\t}/script></head><body><table><tr><td>WELCOME</td></tr></table></body></html>"; 

then I constructed a String array to be passed as second argument to the CallJavaScript function 

String sParam[] = {"window.top.frames[\"frmTest\"].callMe(\"" + sText + "\");"}; 

this is my call javascript function call 
CallJavaScript("callMe", sParam); 

Below is the CallJavaScript function which throws an exception 

/** 
* Note : This method calls javascript function on the client side. 
* @param functionName - JavaScript function to be called 
* @param parameters - List of Parameters to the JavaScript Function 
*/ 
public void CallJavaScript(String functionName, String parameters []) { 
this.functionName = functionName; 
this.parameters = parameters; 
try { 
if (oSession.sGetValue("browser").toString().equals("IE")) { 
JSObject win = JSObject.getWindow(this); 
win.call(functionName, parameters); 
} else { 
JSObject win = JSObject.getWindow(this); 
win.call("callMeNS", parameters); }} 
catch (netscape.javascript.JSException e) { 
e.printStackTrace(); } 
catch (Exception excep) { 
excep.printStackTrace(); } } } 

Actually I am trying to pass a html snippet to a Javascript function via JSObject. 
If the browser is FireFox then it throws an exception. 
It shows some errors pertaning to the parameterlist passed as second argument to JSObject's call() function. 

Here in the code, the second argument "parameters" produces some JavaScript errors in the browser. 
win.call("callMeNS", parameters); 

My html page is divided in 2 frames,I am trying to invoke a function in one of those frames. 
I can call the function by passing null as argument2 as fuollows 
win.call("callMeNS", null); 
but it gives me exception for the argument list I pass.

Reproducible: Always
Assignee: nobody → live-connect
Component: Error Console → Java: Live Connect
Product: Firefox → Core
QA Contact: javascript.console → pschwartau
Version: unspecified → 1.8 Branch

Updated

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

Comment 1

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".
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.