W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2015

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

From: Justin Novosad <junov@google.com>
Date: Fri, 25 Sep 2015 10:48:06 -0400
Message-ID: <CABpaAqQXXEq10LgfVQ1myC0kO8bjviRjJWOv11uhEqMyFy_D6g@mail.gmail.com>
To: WHAT Working Group <whatwg@whatwg.org>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:35 UTC