Skip to content

[Clipboard API] DataError vs NotAllowedError for malformed image data. Spec bug or wrong WPT? #51814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
karlcow opened this issue Apr 3, 2025 · 3 comments

Comments

@karlcow
Copy link
Contributor

karlcow commented Apr 3, 2025

await promise_rejects_dom(t, 'DataError',
navigator.clipboard.write([clipboardItemInput]));
}, 'Verify write error on malformed data [image/png ClipboardItem]');

  1. navigator.clipboard.write() is currently failing for malformed image data with NotAllowedError in Safari.
  2. All the failures in the specification are NotAllowedError https://w3c.github.io/clipboard-apis/#dom-clipboard-write
  3. WPT is expecting DataError https://github.com/web-platform-tests/wpt/blob/9cc1a33a76/clipboard-apis/async-write-image-read-image.https.html#L81-L83 which is passing on Chrome and Firefox

WPT issue or should the spec change?

@karlcow
Copy link
Contributor Author

karlcow commented Apr 3, 2025

@garykac @saschanaz for recommendations.

@gsnedders
Copy link
Member

Similar but different to #49301? Similar to that, the spec doesn't really seem to define this (it takes whatever the data is and sets it to that value, regardless of validity).

@karlcow
Copy link
Contributor Author

karlcow commented Apr 3, 2025

ha good point, I had fogotten about this. Thanks @gsnedders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants