proposal-error-stacks icon indicating copy to clipboard operation
proposal-error-stacks copied to clipboard

Infinite loop in explainer page

Open erights opened this issue 6 years ago • 4 comments

https://github.com/tc39/proposal-error-stacks/blob/123ef01a1b706d68df12778dc936334eec0e0e75/spec.js#L298 says

  var current = this.$toc;
  var index = 0;
  while (index < path.length) {
    var children = current.children;
    for (var i = 0; i < children.length; i++) {
      if ('#' + path[index].id === children[i].children[1].getAttribute('href') ) {
         // ... update variable that might cause while loop to exit
      }      
    }
  }

In other words, if the if ('#'...) condition is false, none of current, index, or path are updated. The for loop always exits. The while loop never does.

This infinite loop causes the page to get stuck when viewed offline. For reasons I did not diagnose, it does not cause the page to get stuck when viewed on the web.

I suspect this problem does not come from this repository. If so, please refile at the appropriate place.

erights avatar Jun 17 '19 11:06 erights

This JS is generated by ecmarkup; but i can't fathom how viewing offline would affect anything - unless you're saying you were on the file:// protocol?

cc @bterlson

ljharb avatar Jun 18 '19 17:06 ljharb

Yes, I was going with file:

On Tue, Jun 18, 2019, 10:18 AM Jordan Harband [email protected] wrote:

This JS is generated by ecmarkup; but i can't fathom how viewing offline would affect anything - unless you're saying you were on the file:// protocol?

cc @bterlson https://github.com/bterlson

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tc39/proposal-error-stacks/issues/29?email_source=notifications&email_token=AACC3TADQJ24U3YVU7XW55TP3EKGFA5CNFSM4HYVUJUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX7K2PQ#issuecomment-503229758, or mute the thread https://github.com/notifications/unsubscribe-auth/AACC3TELW3N5OI6YHWO5YJLP3EKGFANCNFSM4HYVUJUA .

erights avatar Jun 18 '19 17:06 erights

s/going/viewing/

On Tue, Jun 18, 2019, 10:33 AM Mark S. Miller [email protected] wrote:

Yes, I was going with file:

On Tue, Jun 18, 2019, 10:18 AM Jordan Harband [email protected] wrote:

This JS is generated by ecmarkup; but i can't fathom how viewing offline would affect anything - unless you're saying you were on the file:// protocol?

cc @bterlson https://github.com/bterlson

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tc39/proposal-error-stacks/issues/29?email_source=notifications&email_token=AACC3TADQJ24U3YVU7XW55TP3EKGFA5CNFSM4HYVUJUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX7K2PQ#issuecomment-503229758, or mute the thread https://github.com/notifications/unsubscribe-auth/AACC3TELW3N5OI6YHWO5YJLP3EKGFANCNFSM4HYVUJUA .

erights avatar Jun 18 '19 17:06 erights

Many web features are broken on file://; the typical advice i give is to never use it, and instead go with a local http server. That said, ecmarkup's JS certainly shouldn't infinite loop there :-/

ljharb avatar Jun 18 '19 18:06 ljharb