Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script loops when trying to render issue 1074 #614

Closed
hallvors opened this issue May 15, 2015 · 9 comments
Closed

script loops when trying to render issue 1074 #614

hallvors opened this issue May 15, 2015 · 9 comments

Comments

@hallvors
Copy link
Contributor

https://webcompat.com/issues/1074 seems to send some part of our JS (the Prism highlighter/tokenizer?) into a never-ending loop, causing a "slow script" dialog.

If there's a newer version of Prism we can try upgrading - else we need to dig into the tokenizer logic. I'm happy to do that :)

@karlcow
Copy link
Member

karlcow commented May 15, 2015

Wondering if it's because of the opening brace which is not closed. That would be a funny bug.

@hallvors
Copy link
Contributor Author

The cause here is actually a regexp used to look for a closing tag. The DIV tag in my comment isn't closed, and processing this regular expression will never finish:
/</?[\w:-]+\s_(?:\s+[\w:-]+(?:=(?:("|')(?[\w\W])?\1|[^\s'">=]+))?\s)_/?>/gi

@hallvors
Copy link
Contributor Author

(And it's not Firefox's fault - this thing fails in all browsers. Too many lookaheads, I guess..)

@miketaylr
Copy link
Member

@hallvors can you check to see if the latest has a fix? https://github.com/PrismJS/prism

@hallvors
Copy link
Contributor Author

The problematic regexp is still there:
https://github.com/PrismJS/prism/blob/b1fd5bdcee9c6203748286d13d6299f6ca90d903/components/prism-markup.js#L7
Maybe @LeaVerou and @PrismJS know if it's a known issue..

@miketaylr
Copy link
Member

Probably worth filing a proper bug upstream then. Or submitting a patch. :)

@miketaylr
Copy link
Member

(I went ahead and edited your comment to close the div as a workaround).

@LeaVerou
Copy link

LeaVerou commented Jun 4, 2015

This is very odd. Can you reproduce in Prism’s test drive page? If so, could you file an issue on Prism’s repo? This is serious, and would be very high priority.

@miketaylr
Copy link
Member

Thanks @LeaVerou -- reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants