w3c / w3c/webdriver

base64 encoding a canvas does not actually specify base64 encoding

Open
#1,496 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Print Page Take Element Screenshot Take Screenshot
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

The algorithm for encoding a canvas element to abse64 effectively says to convert it into a data url and then remove the url part, leaving only the data part after the comma.

This is a weird way of specifying things (print does it much better, it simply says to base64 encode the pdf file - why not just say base64 encode the png file?).

The real problem is, however, that this does not result in base464 encoded data - the algorithm only says to encode it in "a" data url, but fails to enforce that it must be a base64 data url (as opposed to uri-escaped or any other encodings which are legal for data urls).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the canvas element encoding algorithm and compare its data URL wording with the print algorithm mentioned in the issue. Update the specification so canvas output is explicitly base64 encoded rather than allowing any valid data URL encoding. Confirm the revised text clearly requires base64 data after the URL prefix is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.