Closed Bug 1576463 Opened 5 years ago Closed 5 years ago

toDataURL and toBlob should not throw for serialization errors

Categories

(Core :: Graphics: Canvas2D, defect, P3)

69 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: tristan.fraipont, Assigned: baku)

Details

(Keywords: reproducible)

Attachments

(2 files)

Attached file bug.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

create a huge <canvas> (50K * 50K pixels)
call toDataURL or toBlob

Actual results:

The toDataURL call throws an error NS_ERROR_ILLEGAL_VALUE
The toBlob one fails silently.

Expected results:

toDataURL should have returned the string "data:,",
toBlob should have invoked the callback with null as result.

Here are the specs for the serialization of the bitmap as file[1], where it said

If an error occurs during the creation of the image file (e.g. an internal encoder error), then the result of the serialization is null.

Note that as far as I could check, Firefox always had this behavior, though it's been fixed for zero sized canvas: https://bugzilla.mozilla.org/show_bug.cgi?id=649618

[1][https://html.spec.whatwg.org/multipage/canvas.html#a-serialisation-of-the-bitmap-as-a-file]

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Flags: needinfo?(lsalzman)
Keywords: reproducible
Priority: -- → P3

It looks like Morris Tseng is no longer with us. Andrea, do you know who would be the appropriate maintainer for this code?

Flags: needinfo?(lsalzman) → needinfo?(amarchesini)
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/30509dab7f70
canvas toDataURL and toBlob should not throw for serialization errors, r=jya
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: