Closed Bug 1715016 Opened 3 years ago Closed 3 years ago

Different behavior of createImageBitmap API among firefox and Chrome/Webkit

Categories

(Core :: Graphics: Canvas2D, enhancement)

Firefox 89
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1367251

People

(Reporter: zyscoder, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Steps to reproduce:

(1) Open a tab and navigate to https://outlook.live.com/owa/;
(2) Run the following code in the Console of Devtoots:

scroll(screenLeft,outerHeight);
_5491 = new ImageData(pageYOffset,devicePixelRatio);
createImageBitmap(_5491,screenX,pageXOffset,devicePixelRatio,devicePixelRatio,{resizeWidth:706349643111396100000});

(3) This code would be evaluated successfully without throwing any exceptions.

Actual results:

In Firefox, this code would be evaluated successfully without throwing any exceptions.
But Chrome and Webkit throw exceptions:
Chrome: VM295:3 Uncaught (in promise) TypeError: Failed to execute 'createImageBitmap' on 'Window': Value is outside the 'unsigned long' value range.
Webkit: TypeError: Value 706349643111396100000 is outside the range [0, 4294967295]

Expected results:

It seems that firefox misses range checking for the options.resizeWidth somehow.

BTW, in my test, the following code would throw an exception in Nightly v89.0.

_5491 = new ImageData(pageYOffset,devicePixelRatio);
createImageBitmap(_5491,screenX,pageXOffset,devicePixelRatio,devicePixelRatio,{resizeWidth:706349643111396100000});

The exception is as : Uncaught DOMException: Index or size is negative or greater than the allowed amount

Moving this over to its component. Thanks for the report!

Component: Untriaged → Canvas: 2D
Product: Firefox → Core

It looks like Firefox doesn't yet support the options argument to createImageBitmap, which explains why we don't throw an exception due to the value being too large. This will be added in bug 1367251.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.