[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-develop
Subject:    [HtmlUnit] [ htmlunit-Bugs-2799550 ] ActiveX-related regression from 1.x to 2.x
From:       SourceForge.net <noreply () sourceforge ! net>
Date:       2012-01-14 13:30:57
Message-ID: E1Rm3hE-0003No-C7 () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Bugs item #2799550, was opened at 2009-06-01 10:01
Message generated for change (Comment added) made by rbri
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=2799550&group_id=47038

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
> Status: Closed
> Resolution: Out of Date
Priority: 5
Private: No
Submitted By: JP  (j--p)
Assigned to: Ahmed Ashour (asashour)
Summary: ActiveX-related regression from 1.x to 2.x

Initial Comment:
This is a duplicate of Issue #2698240, which was closed before I could provide a test \
case. I have now attached a test case. 

I have not attached the ActiveX control in question as it may be proprietary to my \
client and it is not necessary to demonstrate the issue. The issue is that although \
the ActiveX control is not executed, the javascript parser fails gracefully under \
1.14 (provided an <object> tag is encountered prior to the "new ActiveXObject()" \
javascript call), whereas under 2.4 or 2.5 the parser blows up. Whether or not this \
is considered "correct" behavior, I would greatly appreciate at least an option to \
enable the 1.14 style behavior in 2.x. This issue is preventing us from moving our \
product from htmlunit 1.14 to htmlunit 2.x. Any help would be greatly appreciated.

When the attached test program is run using htmlunit 1.14 the output is:

Status code: 200
Status message: OK
Response: <html>
<head>
<!--OBJECT ID="FDSDM" CLASSID="CLSID:D208F40C-1220-4407-9004-9862E7E70970" \
CODEBASE="FDSDM.CAB#version=1,0,0,33" name="FDSDM"> </OBJECT-->
<OBJECT> 
</OBJECT>
<script language="JavaScript" type="text/javascript">
<!--
function init() {
   var fds = new ActiveXObject("FDSDM.FDSDMAx");
}
-->
</script>
</head>
<body onload="init()">
Hello world
</body>
</html>

When it is run using htmlunit 2.5 the output is: 

Exception in thread "main" ======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.WrappedException]
com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.Exception: \
Automation server can't create object (script in \
file:/home/jmpeters/dev/sutro/www/www/files/cooley/issue.html from (7, 54) to (13, \
10)#10)  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
  at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
  at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:584)
	at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1237)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:183)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:449)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371)
	at com.cooley.authentication.ActiveXIssue.main(ActiveXIssue.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped \
java.lang.Exception: Automation server can't create object (script in \
file:/home/jmpeters/dev/sutro/www/www/files/cooley/issue.html from (7, 54) to (13, \
10)#10)  at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
  at com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject.jsConstructor(ActiveXObject.java:127)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
	at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:419)
  at net.sourceforge.htmlunit.corejs.javascript.BaseFunction.construct(BaseFunction.java:338)
  at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3377)
  at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
  at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
  at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
  at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
  at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                
	... 23 more
Caused by: java.lang.Exception: Automation server can't create object
	... 42 more
WrappedException: net.sourceforge.htmlunit.corejs.javascript.WrappedException: \
Wrapped java.lang.Exception: Automation server can't create object (script in \
file:/home/jmpeters/dev/sutro/www/www/files/cooley/issue.html from (7, 54) to (13, \
10)#10)  at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
  at com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject.jsConstructor(ActiveXObject.java:127)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
	at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:419)
  at net.sourceforge.htmlunit.corejs.javascript.BaseFunction.construct(BaseFunction.java:338)
  at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3377)
  at script.init(script in \
file:/home/jmpeters/dev/sutro/www/www/files/cooley/issue.html from (7, 54) to (13, \
10):10)  at script(onload event for HtmlBody[<body onload="init()">] in \
file:/home/jmpeters/dev/sutro/www/www/files/cooley/issue.html)  at \
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
  at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
  at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
  at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
  at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
  at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
  at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:584)
	at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1237)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:183)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:449)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371)
	at com.cooley.authentication.ActiveXIssue.main(ActiveXIssue.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.Exception: Automation server can't create object
	... 42 more
Inside wrapped exception:
java.lang.Exception: Automation server can't create object
	at com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject.jsConstructor(ActiveXObject.java:127)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
	at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:419)
  at net.sourceforge.htmlunit.corejs.javascript.BaseFunction.construct(BaseFunction.java:338)
  at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3377)
  at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
  at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
  at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
  at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
  at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
  at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
  at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
  at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
  at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:584)
	at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
  at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1237)
  at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:183)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:449)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371)
	at com.cooley.authentication.ActiveXIssue.main(ActiveXIssue.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
== CALLING JAVASCRIPT ==
function () {
	[native code, arity=0]
}

======= EXCEPTION END ========


----------------------------------------------------------------------

> Comment By: RBRi (rbri)
Date: 2012-01-14 05:30

Message:
Sorry, but i close this issue now.

We are in 2012 and there was no activity on this for more than 2 year.
Please open a new issue if you still have problem that need to be fixed.

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2009-06-08 01:16

Message:
I don't understand the need for a special option to ignore errors from
ActiveX but:
- we need to allow easier customization
- we probably need a way to disable ActiveX as it is possible in IE's
security settings

----------------------------------------------------------------------

Comment By: Ahmed Ashour (asashour)
Date: 2009-06-04 19:57

Message:
    - To have an option for disabling throwing only ActiveX doesn't make
sence to me, because if you enable JS in real browser, it will throw an
error on enountering 'activex' objects.
    - Why cannot you use webClient.setThrowExceptionOnScriptError(false)?
    - What is the issue you have with Jacob? Can you have the example in
[1] running?
    - HtmlUnit 1.x is not the reference, real browsers are.


[1] http://htmlunit.sourceforge.net/activeX-howto.html

----------------------------------------------------------------------

Comment By: JP  (j--p)
Date: 2009-06-01 16:41

Message:
I see that I should have been more clear in my report. Although the html
file I attached does not specify a "relevant object" as you say, even when
it *does* specify a relevant object -- for instance, when the relevant
object is not commented out (see the html source for reference), and is
accompanied by the actual ActiveX control, and is served not from the
filesystem but from an IIS web server -- even then the symptoms are exactly
the same: the htmlunit 1.x code fails gracefully, and the htmlunit 2.x code
fails with exceptions. Regarding jacob, I am aware of the jacob support and
the new WebClient.setActiveXNative() method, and I tried and failed to get
that to work, despite following all of the steps with the jacob library and
dll. That also failed with similar exceptions. However, getting the ActiveX
control to work is not the focus of this bug. In fact, I don't care if
ActiveX works. What I want to be able to do is to disable ActiveX support
without also disabling javascript. I want the javascript parser to fail
gracefully on invocations of "new ActiveXObject()" without throwing
exceptions and without disabling other non-ActiveX-related javascript. In
other words, I'm fine if my htmlunit implementation cannot handle ActiveX
so long as appearances of "new ActiveXObject()" within <script> regions of
HTML don't blow up with exceptions. What I am describing is exactly the
behavior of htmlunit 1.x. Please let me know if that explanation was not
clear. 

----------------------------------------------------------------------

Comment By: Ahmed Ashour (asashour)
Date: 2009-06-01 13:20

Message:
Reopening, as the case is partially fixed in SVN.

What remains is supporting 'external' ActiveX objects.

----------------------------------------------------------------------

Comment By: Ahmed Ashour (asashour)
Date: 2009-06-01 13:12

Message:
<object classid=""> is now supported.

You have to use Jacob as mentioned in
http://htmlunit.sourceforge.net/activeX-howto.html

Please let us know if you need anything else

----------------------------------------------------------------------

Comment By: Ahmed Ashour (asashour)
Date: 2009-06-01 10:27

Message:
Hi,

As you know, "new ActiveXObject("FDSDM.FDSDMAx");" fails with IE if you
don't specify relevant <object>, and HtmlUnit will not ignore that, because
the reference is simulation of real browsers.

But, you can disable JavaScript with
"webClient.setJavaScriptEnabled(false);"

On the other hand, I will investigate defining new ActiveX using <object>,
again to simulate IE behavior.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=2799550&group_id=47038

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic