[whatwg] Handling out of memory issues with getImageData/createImageData

Hi All,

Currently there is no spec'ed behavior for handling out-of memory issues
for the specific case of attempting to allocate a large buffer through
image data APIs.

In Chrome, the current behavior is to crash the process (out of memory
exception), which results in a "sad browser tab".  We are considering
changing this behavior to throw a DOM exception instead of crashing. The
idea is to provide a better user experience by halting the script rather
than crashing the tab.  In particular, we are often encountering this error
in cases where an advertisement embedded in an iframe is attempting to
allocate a large image data object. By throwing an exception instead of
crashing, only the ad's script context would halt, and the main page would
be able to continue to function normally.

I am sharing this here in case there would be interest in standardizing
this behavior. By standardizing it, developers could expect the exception,
and therefore write more stable apps by calling image data APIs inside a
try/catch scope.

Thoughts?

    Justin

Received on Friday, 25 September 2015 14:48:39 UTC