Skip to content

TypeError instead of NotAllowedError in navigator.clipboard.write(image/png DOMString) #49301

@karlcow

Description

@karlcow

promise_test(async t => {
await getPermissions();
const item = new ClipboardItem({'image/png': 'not an image'});
await promise_rejects_js(t, TypeError, navigator.clipboard.write([item]));
}, 'navigator.clipboard.write(image/png DOMString) fails');

The current specificiation for write(data)
https://w3c.github.io/clipboard-apis/#dom-clipboard-write

In Steps 4, it says:

  1. For each clipboardItem in dataList:

and then in 4.1.2.*

  1. If representationDataPromise was rejected, then:
    1.Reject p with "NotAllowedError" DOMException in realm.
    2. Abort these steps.

Here the test is assessing a TypeError instead of NotAllowedError.
Is there another step I'm missing?

@saschanaz @whsieh

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions