New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception in HTMLUnit #3829

Closed
laDanz opened this Issue Oct 27, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@laDanz

laDanz commented Oct 27, 2017

Somehow this line causes HTMLUnit (version 2.27) to crash hard. JQuery cannot be fully loaded, so further processing on my website is not possible.

body.innerHTML = "<form></form><form></form>";

Could you please wrap it by try/catch or assert?

com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property "innerHTML" of undefined to "

" (http://localhost:8480/static/javascript/jquery-3.2.1.min-ver-9C3A8D5BF79A2B2C25B4D9F99FBF6DB2.js#9761)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:894) ~[htmlunit-2.27.jar:2.27]
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:637) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:518) ~[htmlunit-core-js-2.27.jar:?]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:774) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:750) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:102) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:991) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:366) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HtmlScript$2.execute(HtmlScript.java:247) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:268) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:800) ~[htmlunit-2.27.jar:2.27]
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:756) ~[htmlunit-2.27.jar:2.27]
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1236) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1136) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:226) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:345) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3178) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2141) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:945) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:521) ~[neko-htmlunit-2.27.jar:?]
at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:472) ~[neko-htmlunit-2.27.jar:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:999) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:250) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:192) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:272) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:160) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:522) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:396) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:313) ~[htmlunit-2.27.jar:2.27]
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:668) ~[htmlunit-driver-2.27.jar:?]
at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$8(HtmlUnitDriver.java:655) ~[htmlunit-driver-2.27.jar:?]
at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$0(HtmlUnitDriver.java:412) ~[htmlunit-driver-2.27.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot set property "innerHTML" of undefined to "" (http://localhost:8480/static/javascript/jquery-3.2.1.min-ver-9C3A8D5BF79A2B2C25B4D9F99FBF6DB2.js#9761)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3915) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3899) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3924) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3946) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:3963) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1641) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1265) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:800) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:416) ~[htmlunit-core-js-2.27.jar:?]
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:322) ~[htmlunit-2.27.jar:2.27]
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3264) ~[htmlunit-core-js-2.27.jar:?]
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115) ~[htmlunit-core-js-2.27.jar:?]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:765) ~[htmlunit-2.27.jar:2.27]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:879) ~[htmlunit-2.27.jar:2.27]
... 34 more

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Oct 27, 2017

Member

Somehow

That's the key thing, isn't it? There isn't enough information here to determine the problem, and having jQuery try to mask this doesn't even make sense until the "somehow" is resolved. Nobody else has reported this problem so you'll need to provide more information,

Member

dmethvin commented Oct 27, 2017

Somehow

That's the key thing, isn't it? There isn't enough information here to determine the problem, and having jQuery try to mask this doesn't even make sense until the "somehow" is resolved. Nobody else has reported this problem so you'll need to provide more information,

@laDanz

This comment has been minimized.

Show comment
Hide comment
@laDanz

laDanz Oct 27, 2017

Maybe the error is caused in the line above:

var body = document.implementation.createHTMLDocument( "" ).body;

and more precisely the faulty implementation of this code at the HTMLUnit end?

laDanz commented Oct 27, 2017

Maybe the error is caused in the line above:

var body = document.implementation.createHTMLDocument( "" ).body;

and more precisely the faulty implementation of this code at the HTMLUnit end?

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Nov 1, 2017

Member

We need a test case in order to assess any possible issue, preferably from jsfiddle.net or jsbin.com.

Member

timmywil commented Nov 1, 2017

We need a test case in order to assess any possible issue, preferably from jsfiddle.net or jsbin.com.

@timmywil timmywil added the Needs info label Nov 1, 2017

@timmywil timmywil closed this Nov 6, 2017

@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.