Sorry took me a while to get back to this. Here is the StackTrace:
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxFunction_send (Culerity::CulerityException)
com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:526:in run'
net/sourceforge/htmlunit/corejs/javascript/Context.java:537:incall'
net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in call'
com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:456:incallFunction'
com/gargoylesoftware/htmlunit/html/HtmlPage.java:893:in executeJavaScriptFunctionIfPossible'
com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:155:inexecuteEventListeners'
com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:208:in executeBubblingListeners'
com/gargoylesoftware/htmlunit/javascript/host/Node.java:645:infireEvent'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:887:in run'
net/sourceforge/htmlunit/corejs/javascript/Context.java:537:incall'
net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in call'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:892:infireEvent'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:1248:in click'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:1212:inclick'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:1179:in `click'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The alert '/' is trigered as exactly done in real browsers, you can ignore the error reported happens with IE simulation only, not with FF:
[main] ERROR com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter - runtimeError
: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost/htmlunit/jquery.js] line=[3078] lineSource=[null] lineOffset=[0]
Please re-open if you have a functional issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here a modified version of the ajax call which should show an alert message on completion. One more thing to note maybe is that i run HTML Unit as a Firefox 3 browser.
[JavaScript Job Thread 1] ERROR com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl - Job run failed with unexpected RuntimeException: The content cannot be null
java.lang.IllegalArgumentException: The content cannot be null
at org.apache.commons.httpclient.methods.StringRequestEntity.<init>(StringRequestEntity.java:93)
at com.gargoylesoftware.htmlunit.HttpWebConnection.makeHttpMethod(HttpWebConnection.java:255)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:97)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi thanks for looking into this. I tested the latest svn build today. The exception is gone, but the data i send with the PUT, is gone too. I changed my example script to reproduce the effect. To check the send parameters you need some kind of backend though. When I click the link in my Browser (Firefox 3.6b4) the backend receives the parameter test=best. If I click the link through HtmlUnit no parameters are send.
+1 for fixing this!
Can you provide the stacktrace as well as a minimal example (ie the html code)?
Sorry took me a while to get back to this. Here is the StackTrace:
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxFunction_send (Culerity::CulerityException)
com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:526:in
run' net/sourceforge/htmlunit/corejs/javascript/Context.java:537:in
call'net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in
call' com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:456:in
callFunction'com/gargoylesoftware/htmlunit/html/HtmlPage.java:893:in
executeJavaScriptFunctionIfPossible' com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:155:in
executeEventListeners'com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:208:in
executeBubblingListeners' com/gargoylesoftware/htmlunit/javascript/host/Node.java:645:in
fireEvent'com/gargoylesoftware/htmlunit/html/HtmlElement.java:887:in
run' net/sourceforge/htmlunit/corejs/javascript/Context.java:537:in
call'net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in
call' com/gargoylesoftware/htmlunit/html/HtmlElement.java:892:in
fireEvent'com/gargoylesoftware/htmlunit/html/HtmlElement.java:1248:in
click' com/gargoylesoftware/htmlunit/html/HtmlElement.java:1212:in
click'com/gargoylesoftware/htmlunit/html/HtmlElement.java:1179:in `click'
And here is a minimal html file to reproduce this:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
</head>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#click_me").bind('click', function(){
$.ajax({url: "/",type: "PUT",data: "test"});
});
});
</script>
<body>
ClickMe
</body>
</html>
Hello,
The alert '/' is trigered as exactly done in real browsers, you can ignore the error reported happens with IE simulation only, not with FF:
[main] ERROR com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter - runtimeError
: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost/htmlunit/jquery.js] line=[3078] lineSource=[null] lineOffset=[0]
Please re-open if you have a functional issue.
Hi asashour is your comment related to the above issue? Because I don't see what this has to do with alert.
Hi,
Oh, since I was offline which I verified thi case, I used a 'patched' jquery .js, which made the 'alert'.
Anyhow, your test case does not trigger anything in real IE, can you modify it so that an expected result does not occur in HtmlUnit?
Sorry, took me a while again to get back.
Here a modified version of the ajax call which should show an alert message on completion. One more thing to note maybe is that i run HTML Unit as a Firefox 3 browser.
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#click_me").bind('click', function(){
$.ajax({url: "test.html",type: "PUT", complete: function () {
alert("hi");
}
});
return false;
});
});
</script>
ClickMe
</body>
</html>
[JavaScript Job Thread 1] ERROR com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl - Job run failed with unexpected RuntimeException: The content cannot be null
java.lang.IllegalArgumentException: The content cannot be null
at org.apache.commons.httpclient.methods.StringRequestEntity.<init>(StringRequestEntity.java:93)
at com.gargoylesoftware.htmlunit.HttpWebConnection.makeHttpMethod(HttpWebConnection.java:255)
at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:97)
Thanks for reporting, fixed in SVN.
Please wait after 'clicking' to get the 'alert', have a look at http://htmlunit.sourceforge.net/faq.html#AJAXDoesNotWork
Hi thanks for looking into this. I tested the latest svn build today. The exception is gone, but the data i send with the PUT, is gone too. I changed my example script to reproduce the effect. To check the send parameters you need some kind of backend though. When I click the link in my Browser (Firefox 3.6b4) the backend receives the parameter test=best. If I click the link through HtmlUnit no parameters are send.
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#click_me").bind('click', function(){
$.ajax({url: "test.html",type: "PUT", data: "test=best", complete: function () {
alert("hi");
}
});
return false;
});
});
</script>
ClickMe
</body>
</html>
Re-opening as per user's comment.
Aha, now I see the empty body.
There is a local fix, to be committed soon.
Thanks for reporting, fixed in SVN, please get latest snapshot from http://build.canoo.com/htmlunit/artifacts, and advise if you still have an issue
Works like a charme. Thank you!