mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.55k stars 260 forks source link

Entering a backtick character (`) in the editor crashes Chrome tab #26

Closed tyilo closed 10 years ago

tyilo commented 10 years ago

It's pretty annoying when writing some code and you accidentally enter a "`" character in the editor and the tab crashes.

It doesn't seem to happen in Firefox.

tyilo commented 10 years ago

The samething happens when entering a dollar sign.

jfontan commented 10 years ago

I've just seen that. Not sure what could be happening. The development console also crashes in chrome.

emackey commented 10 years ago

Is this on Windows? If so maybe it's an ANGLE crash. /cc @Toji

tyilo commented 10 years ago

Nope I'm using OS X 10.9.

toji commented 10 years ago

I'm not seeing a crash on any platform I try this on, but I do see the tab lock up. The key here is that the rest of the browser continues to function correctly. (I'm using dev or canary builds, so the behavior may have recently changed.) In my case I was actually able to open up an inspector before hand and verified that the Javascript was still running, it just seemed to be caught in an infinite loop of parsing and re-parsing the shader. Because the JS never yields to the browser it can't process any additional user input. This should be something that can be solved in the glsl-sandbox code.

emackey commented 10 years ago

Yep, it's my code. I'll open a pull request in the next day or two with a fix.

One of my old contributions highlights the line with the GLSL error after making some guesses about non-standardized error messages returned by the shader compiler. It's now receiving a message I hadn't seen before, ERROR: 0:?. It tries to parseInt the '?' and then injects the resulting NaN into CodeMirror's line numbering system, causing doom. I'll fix it soon.

emackey commented 10 years ago

OK, pull request is open, it's jfontan/glsl-sandbox#11.

emackey commented 10 years ago

The fix is deployed now thanks to @jfontan, and thanks to @toji for the triage when it appeared to be a shader crash. I had to manually reload the effects page to get the old version out of my browser cache. Give it a try.

This issue can be closed unless there are any remaining crashes.