Accessing ceylon.interop.browser.dom.document goes into infinite loop on 1.3.2
See original GitHub issueAs at: http://try.ceylon-lang.org/?gist=5fb85393d1631ea78ecdfff0a79b0d77
The following never completes. Firefox offers to stop the script. Chrome consumes 100% cpu indefinitely. The same occurs with document.getElementById(“someid”).
import ceylon.interop.browser.dom {
document
}
shared void run() {
value d = document;
print("Done");
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:22 (18 by maintainers)
Top Results From Across the Web
Problem with infinite loop when manipulating DOM
The problem comes when I copy and paste all the code at one time in the browser console. It is like the executions...
Read more >document.write(innerHTML) can cause infinite loop and crash ...
I think this bug is INVALID after all, innerHTML contains the javascript, and you are writing into document script which writes a script...
Read more >Untitled
#bags Pbb 737 ylona, Interop conference pass, De groene mijl boekverslag, ... Battery what does wh mean, 29418 movies, New items in minecraft...
Read more >Bug: Infinite loop at startup · Issue #23219 · facebook/react
As soon as I launch my React app in dev mode, the browser crashes because the page goes into an infinite loop logging...
Read more >SmartBear Community - Groovy in Action.pdf
to use Groovy on multi-core machines and thus go into concurrent programming with Groovy. Another much-requested topic is using Groovy for domain specific ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think i figured out the bug: in function dre$$ of ceylon.language-1.3.2.js there are two nested for loop that cycle with the same variable “i” (one on line 977, the other in line 1022). Since they’re nested, javascript handle the “i” variable as the same variable (despite both having “var”) as per this answer.
The second loop is only reached for particular cases, for example while “working” (i don’t really know what the function does) on HTMLElement.dataset. In this case the second loop is smaller than the first, effectively rewinding the “i” variable to a lower value.
Workaround is simply changing the name of the smaller, inner loop, which becomes for example:
for (var ii=0;ii<mm.sts.length;ii++) { if (mm.sts[ii].a && mm.sts[ii].a[_t]) { object.$$targs$$[_t]=mm.sts[ii].a[_t]; _t=mm.sts[ii].a[_t]; break; }
I don’t know if the code is hand written or generated, in the second case the generator probably needs to be corrected.I hope this helps!
I’ll close this one and open another one for the other things to check.