Classloader.checkOptionalCycle seems buggy
Brought to you by:
zhourenjian
For your attention.
ClazzLoader.checkOptionalCycle (rev 694) has code:
for (var k = 0; k < ts[i].parents.length; k++) {
//log ("updating parent ::" + ts[i].parents[k].name);
ClazzLoader.updateNode (ts[i].parents[k]);
}
I don't know what is it, but it seems buggy. updateNode can change ts[i] and this will break cycle.
I use modified for only synchronous calls ClassLoader.js and sometimes Firebug tells "ts[i] don't have properties", but all work fine.
Logged In: NO
Could you explain more about your "synchronous calls", or give us some snippets for this bug.
Logged In: YES
user_id=1787911
Originator: YES
I did change little ClazzLoader.loadScript function:
I use mozilla's XUL, and head.appendChild(script) not works.
I make synchronous XMLHTTP Reqest and after that manually call script onLoad function.
See file.diff.
I mean this modification mustn't change checkOptionalCycle logic.
File Added: 1.diff
Logged In: YES
user_id=1702895
Originator: NO
Hi brainsponger,
If you would like to load classes using XMLHttpRequest in synchronous mode, why not using
ClazzLoader.setLoadingMode ("xhr");
The ClassLoader will loading *.js as expected. But ClassLoader do freezes UI for some seconds.
And if you want to loading *.js asynchronously, you may set
ClazzLoader.setLoadingMode ("xhr.async");
Regards
Logged In: YES
user_id=1787911
Originator: YES
Thanks for advice.
But...
You change object from for condition in cycle body.
Don't do it (at least in JavaScript).
Logged In: YES
user_id=1787911
Originator: YES
With correct ClazzLoader using with ClazzLoader.setLoadingMode ("xhr") error remains.
Logged In: YES
user_id=1702895
Originator: NO
Some other bugs of ClassLoader are fixed.
So this bug is considered as fixed after 1.0.0 release.
Java2Script 2.0.0 was released