Open Bug 1945768 Opened 19 days ago Updated 13 days ago

captureScreenshot format type "image/jpg" gets converted to "image/png"

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect
Points:
3

Tracking

(firefox-esr115 unaffected, firefox-esr128 unaffected, firefox135 unaffected, firefox136 affected, firefox137 affected)

Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox135 --- unaffected
firefox136 --- affected
firefox137 --- affected

People

(Reporter: jdescottes, Unassigned)

References

Details

(Whiteboard: [webdriver:backlog])

Not sure if this is actually a defect, but I stumbled upon this when writing the blog post for 135.
We advertise using "image/png" or "image/jpg", but the second one is actually not recognized properly and will produce a png. To create a JPG, one should use "image/jpeg". This is quite important, because the quality parameter only has an impact with image/jpeg.

I wonder if we should restrict values to known supported types, and throw an UnsupportedOperationError otherwise?

Oh, good catch. Yes we should fix that sooner than later as best for the 135 release. Maybe we should revert the announcement in the blog post and on MDN and bring it up again in the next release? It doesn't make sense to announce a feature that actually doesn't work. :/

The feature works fine if you provide the expected MIME type "image/jpeg", but it looks like "image/jpg" is actually not a valid / known MIME type, so it falls back to image/png when using canvas' toDataURL. I think spec-wise everything is fine, it's just easy to make the same mistake for end users.

I will send a PR to update our MDN release note and mention the correct MIME type, but I wouldn't backout anything at this point?

Flags: needinfo?(jdescottes)

(In reply to Julian Descottes [:jdescottes] from comment #2)

I will send a PR to update our MDN release note and mention the correct MIME type, but I wouldn't backout anything at this point?

If it's just the fallback that is wrong then I agree. No need to change the release notes.

Severity: -- → S3
Points: --- → 3
Priority: -- → P3
Whiteboard: [webdriver:backlog]
You need to log in before you can comment on or make changes to this bug.