question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing ceylon.interop.browser.dom.document goes into infinite loop on 1.3.2

See original GitHub issue

As 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:closed
  • Created 7 years ago
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
msx80commented, Aug 2, 2017

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!

0reactions
FroMagecommented, Aug 16, 2017

I’ll close this one and open another one for the other things to check.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found