WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 222262
244812
navigator.clipboard.write() rejects with NotAllowedError after an async call
https://bugs.webkit.org/show_bug.cgi?id=244812
Summary
navigator.clipboard.write() rejects with NotAllowedError after an async call
Christian Liebel
Reported
2022-09-05 08:02:11 PDT
I'm using the Async Clipboard API (roughly) like this: button.addEventListener('click', async () => { const blob = await getBlobFromSelection(context, selection); await navigator.clipboard.write([new ClipboardItem({ [blob.type]: blob })]); }; When the user clicks the button, the blob to copy is asynchronously resolved. (In my particular scenario, the selected part of an image gets cropped and converted to PNG.) Expected behavior: The blob's content should be copied to the clipboard. Actual behavior: The call to navigator.clipboard.write() is rejected with the following error message: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. Context: I suspect this is related to the user gesture policy. After the asynchronous call, the call to the write() method is not seen as part of a user gesture anymore. If I omit the asynchronous call, everything works as expected. I think this scenario should be supported because certain asynchronous operations (like preprocessing images) are sometimes necessary. It's working fine in Blink. Steps to reproduce: - Open
https://paint.js.org
- Click Edit > Select All - Click Edit > Copy - The error mentioned above is logged to the console. The user's drawing is not written to the clipboard.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2022-09-05 12:53:31 PDT
Duplicate of
bug 222262
?
Alexey Proskuryakov
Comment 2
2022-09-05 12:54:31 PDT
Actually, I'm fairly certain that it is. *** This bug has been marked as a duplicate of
bug 222262
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug