Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #23697: Fix up paste and paste-go handling for certain types of clipboard items #24294

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

grigoryk
Copy link
Contributor

@grigoryk grigoryk commented Mar 16, 2022

This is a follow-up to #24180 which adds handling for a few clipboard paste/paste-go cases. Specifically, I observed that in certain cases when copying links from, say, Chrome, we'd get MIME type text/x-moz-url for the clipboard item, which we weren't recognizing.

Additionally, second commit here allows pasting non-url contents of the clipboard (after stripping them).

Note that there's also a text/uri-list MIME type, used for passing around one or more URLs. Currently we don't support it - e.g. we'd need to make assumptions about its associated contents, etc. In my testing I haven't yet seen it used in context of a clipboard copy/paste.

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@grigoryk
Copy link
Contributor Author

Tested this on a Pixel5 running Android 12, and a recent Samsung device.

@grigoryk grigoryk changed the title For #23697: Fix up paste and paste-go handling in for certain types of clipboard items For #23697: Fix up paste and paste-go handling for certain types of clipboard items Mar 16, 2022
…xt as url

It seems like this is the MIME type we're getting from the clipboard in
certain scenarios, e.g. after copying a link from Chrome or Gmail on
some devices.
@@ -81,12 +81,14 @@ object ToolbarPopupWindow {
}
}

clipboardUrl?.let { url ->
clipboardText?.let { text ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add some tests for this in ToolbarPopupWindowTest as well. Can we file a good-first-bug issue for this?

@grigoryk grigoryk added the pr:needs-landing PRs that are ready to land [Will be merged by Mergify] label Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:needs-landing PRs that are ready to land [Will be merged by Mergify]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants