Skip to content
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

cool#8292 browser, clipboard: fix navigator.clipboard error handling #8306

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

vmiklos
Copy link
Contributor

@vmiklos vmiklos commented Feb 19, 2024

  • cool#8292 browser

If the notebookbar's paste or paste special button is pressed and
Chrome's clipboard permisson popup is rejected, then nothing happened,
while Firefox case was showing a more helpful popup, explaining the
problem.

This has two sides: error handling should be better and also the error
should not happen in the first place. The error can also happen when the
<iframe> is not set up correctly, but that's to be handled on the
nextcloud side.

When there *is* an error, improve error handling by restoring the
codepath that matches Firefox:

- extract the rest of the code after invoking the async clipboard read
  in _execCopyCutPaste() to a new _afterCopyCutPaste()

- paste case: invoke _afterCopyCutPaste() when the paste fails

- paste special case: only pretend we're in paste special mode if the
  success fallback is called

  - if the failure callback is called, then invoke
    _openPasteSpecialPopup()

With this, the "has async clipboard, but the permission request
rejected" and the "don't have async clipboard" codepath matches.

Signed-off-by: Miklos Vajna <[email protected]>
Change-Id: I727f00a1cf94dd1837e15e60410e1798de5daecc
@vmiklos vmiklos changed the title private/vmiklos/master cool#8292 browser, clipboard: fix navigator.clipboard error handling Feb 19, 2024
@vmiklos vmiklos requested a review from caolanm February 19, 2024 12:15
@vmiklos
Copy link
Contributor Author

vmiklos commented Feb 19, 2024

@caolanm could you please review this? Thanks.

If paste fails in chrome, it should fail with a visible popup, like it does in firefox.

@caolanm caolanm merged commit 8d931d8 into master Feb 19, 2024
11 checks passed
@caolanm caolanm deleted the private/vmiklos/master branch February 19, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants