Hi!
When serving this test page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Implement</title>
</head>
<body>
<script>
var script = document.createElement('script');
script.src = 'someexisting.js';
script.async = true;
script.onload = function () {
alert(this.readyState)
};
document.body.appendChild(script);
</script>
</body>
</html>
the alert will only yield "loading" .. i never get a callback with "complete" / "loaded" state for BrowserVersion.INTERNET_EXPLORER
Diff:
Have done some real tests with real browsers. Looks like HtmlUnit calls the onload function the same way as IE11 does.
There was only a minor difference; the readyState returns undefined in your sample. This is fixed now for HtmlUnit.
Can you please verify your sample with real IE.
Last edit: RBRi 2016-09-22
the alert listener prints "loading" for me (OSX)
To make it clear:
I have done a similar test. And yes the result was 'loading' when running the test with HtmlUnit. But when running the test inside a real IE the result was 'undefind'. And there was no 'complete' at all. Based on this observation i have changed the code to also produce 'undefined'.
If you use the latest build from teamcity (https://ci.canoo.com/teamcity/project.html?projectId=HtmlUnit&tab=projectOverview) you should get the same results.
In general HtmlUnit tries to mimic the real browser als close as possible.
Please check if you get the same results also with real browsers.
The fix seems to have some positive effect for our jQuery test cases also. I guess it was not wrong at all.
undefined is totally fine! that's how our production code checks the onLoad/onReadyStateChange handler
so !this.readyState in the if then works as expected! Thanks for your help!
Ok, great. There is also a new snapshot build available.
Will close this.
Thanks for the detailed report.
where can i find the related code change? just out of interest :)
https://sourceforge.net/p/htmlunit/code/commit_browser
On Fri, 23 Sep 2016 11:04:57 +0000 bitkid wrote:
Related
Bugs:
#1824