Thursday, 8 August 2013

What in JavaScript can cause browser crashes?

What in JavaScript can cause browser crashes?

I have an application that a wrote in straight JavaScript (no jQuery or
anything). What it does is it uploads an image, and when you click on it,
it gets the dominant colors of the image as well as picks the color you
just clicked in the image, and generates a color scheme based on this.
I have part of it implemented here:
http://cassidoo.co/assets/colordetect/index.html (this version only has
the color detection part, not the color picker/color scheme part)
Now, I'm trying to figure out some issues. The application usually works.
The only time it doesn't work is when the browser crashes. I looked at the
thread here:
How can I test potentially "browser-crashing" JavaScript?
And I've been using my debugger and everything, but I'm not actually
getting any errors when the browser crashes. It just suddenly isn't
responsive and after a little while I get the "Oh, Snap" screen or
something.
How can I debug this? What in my code might be freaking out (like is it an
infinite loop I'm not closing, something with the canvas that's not
normal)? Why does it only happen like 50-60% of the time? Is it a cache
issue?

No comments:

Post a Comment