Closed Bug 747798 Opened 12 years ago Closed 9 years ago

[meta] Copy'n'paste support

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-basecamp:-)

RESOLVED DUPLICATE of bug 1023688
blocking-basecamp -

People

(Reporter: philikon, Unassigned)

References

Details

(Whiteboard: [FT:System-Platform][tech-p1])

We should have a copy'n'paste support with a clipboard, ideally with support for not only text but any kind of media (I'm thinking via Blobs or so). Haptics and visuals should probably be left to the UI, so it feels like there should be a Web API for this. (This would be very useful for the desktop as well, since right now web pages seem to have to rely on Flash for dealing with the clipboard, or use the IE-only and rather limited window.clipboardData property.)
Not a P1 bug for V1, not blocking.
blocking-basecamp: --- → -
Needed for competitive parity.
Whiteboard: [tech-p1]
For tracking purposes - 

Users have started requesting this feature on input.mozilla.org:
https://input.mozilla.org/en-US/dashboard/response/3848097

Are there still plans to implement this feature on future versions?

Thanks!! =)
- Ralph
This is a necessary feature, so please implement it! Since all Firefox OS apps are HTML5, maybe you could use localStorage for that.
hi,which version will support this feature,V1.2 or V1.3?
(In reply to lecky from comment #8)
> hi,which version will support this feature,V1.2 or V1.3?

This will not be in 1.2, and I would not make promises for 1.3 either.
Even though I have very limited understanding of Gecko for Firefox OS though I honestly don't think Gecko's the one who needs to achieve this, Copy and Paste could be easily a Gaia implementation. Sad though the 1.2 won't be shipped with this feature as it's very needed for Basic usage...
In terms of this, as we dig through the details, maybe we should decide which App needs to have this feature. We don't want users clicking (touching) all apps copying everything on sight..
I'd say something in the App's manifest to decide whether this App supports copying its content or not.. like that the browser app *will* support copying its content, while music won't.
Or maybe a Javascript API? So we can limit copying content to a certain HTML element ? Like that Tabs' names in browser app won't be copyable... ? 
Sorry if some (or ALL) of what I'm saying doesn't make sense. I have a very limit understanding for this and for how this should be achieved ..
Thoughts ?
There's the CSS user-select property (https://developer.mozilla.org/en-US/docs/Web/CSS/user-select) which should serve the purpose very well (but does not fix the current lack of copy & paste, though).
Nom'ing due to Comment 4 and Comment 6. I also think this is vital to support in next versions, and 1.3 seems to reduce some technical debt already.
blocking-b2g: --- → 1.3?
FWIW it seems that Gecko already supports some Clipboard API [1] events [2].

[1] http://dev.w3.org/2006/webapi/clipops/clipops.html
[2] https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent
If the Clipboard API is already implemented in Firefox 22, it should be straightforward to implement it in B2G, shouldn't it?
(In reply to Jerzy from comment #15)
> If the Clipboard API is already implemented in Firefox 22, it should be
> straightforward to implement it in B2G, shouldn't it?

The hard part is not the events, but the UX/UI.
Doesn't Firefox for Android have its own Copy & Paste UX? How about adapting that?
hi beatriz:
Can you accept the conclusion that this feature would not implemented on V1.1HD?
Thank you very much!
Flags: needinfo?(brg)
(In reply to lecky from comment #18)
> hi beatriz:
> Can you accept the conclusion that this feature would not implemented on
> V1.1HD?
> Thank you very much!
Yes, we accept the increase of features in future FxOS releases.
Flags: needinfo?(brg)
Copy-and-paste support is targeted for 1.4 or later. Cursor position and text selection are the foundational features of copy-and-paste, and these are targeted for 1.3. We're getting there! :)
blocking-b2g: 1.3? → ---
Did you intentionally remove the blocking-b2g flag?
blocking-b2g: --- → 1.3?
(In reply to Florian Bender from comment #23)
> Did you intentionally remove the blocking-b2g flag?

No, sorry about that.
Would be nice to have some script inside Gaia to enable copy-and-paste for certain HTML Elements. I'm thinking about a script like the navigator.mozL10n [1]

Somethink like:

navigator.mozEnableCopyAndPaste(document.querySelector('p'));

This will trigger a cut, copy, paste event [2] on all p-Tags.

[1] https://github.com/mozilla-b2g/gaia/blob/master/shared/js/l10n.js
[2] https://developer.mozilla.org/en-US/docs/Web/API/Element.onpaste
Copy and paste is part of the keyboard team's backlog for 1.4. We can evaluate this within that large batch of work.
Clearing the 1.3? flag as we're still getting all the pieces in place for this work.
blocking-b2g: 1.3? → 1.4?
Whiteboard: [tech-p1] → [tech-p1][ucid:SystemPlatform27, 1.4:p2, ft:system-platform]
Depends on: 946646
This feature has been planned in v1.5. Remove blocking-b2g flag and move this bug to block system platform backlog meta bug
Blocks: 908549
No longer blocks: 1.3-system-platform
blocking-b2g: 1.4? → ---
Whiteboard: [tech-p1][ucid:SystemPlatform27, 1.4:p2, ft:system-platform] → [tech-p1][ucid:SystemPlatform27, ft:system-platform][backlog]
Copy'n'paste is of course a necessary feature, but if not properly implemented could pose some serious security risks. The clipboard is often use as a way to transfer data from a (web) app to another (web) app. 
A quite common use case is copying credentials from a document (or a password manager) then switching to the login page of a web site and pasting them.

"[...] On Android, writing data to or reading data from the clip- board does not require any permission. Therefore, every app currently running on an Android device can read the items stored in the clipboard at any time! 
To make matters worse for password managers, the Android SDK provides the android.content.ClipboardManager.OnPrimaryClipChangedListener inter- face, which defines a listener callback that is invoked each time the primary item on the clipboard changes. This can be used by malicious apps to harvest passwords as they are passed through the clipboard.'

Source: "Hey, You, Get Off of My Clipboard", by folks at Distributed Computing & Security Group, Leibniz University of Hannover [1]

This paper is quite interesting and advocate for implementing a "Secure Clipboard Architecture" that could prevent sniffing confidential information while providing a convenient and secure channel for communications between different (web) apps. Android is a nightmare from this point of view and therefore a strong copy'n'paste implementation could represent a competitive advantage for FF OS.

I highly recommend to go and read the whole paper.

Full disclosure: I'm the co-founder of http://clipperz.is, an online password manager that will greatly benefit from a secure clipboard implementation.

[1]: https://www2.dcsec.uni-hannover.de/files/p170.pdf
There is a way to implement the coppy'n'paste feature:
https://github.com/CodingFree/CopyPaste

How does it work? Check this:
http://dropbox.com/s/778soipo3to7hsq/VID-20140121-WA0001.mp4
Component: General → Gaia::Keyboard
Related to Comment#22, It's challenging to dogfood FxOS as I have a long, unique random password for every account.

I went to whip up a locally hosted copy/paste web app to work around these issues, but hit this bug.
Blocks: 2.0-system-platform
No longer blocks: 908549
Whiteboard: [tech-p1][ucid:SystemPlatform27, ft:system-platform][backlog] → [tech-p1][ucid:SystemPlatform27, 1.5, ft:system-platform]
Whiteboard: [tech-p1][ucid:SystemPlatform27, 1.5, ft:system-platform] → [tech-p1][ucid:SystemPlatform27, 2.0, ft:system-platform]
feature-b2g: --- → 2.0
blocked by text selection, move to 2.1
feature-b2g: 2.0 → 2.1
Depends on: 921965
Any feedback from the developers about the security concerns stated above?

Being the only mobile OS that pays attention to the security of the clipboard could make a substantial difference! 

People should be aware that when copying data to the clipboard on an Android device, there are good chances that some other people could read those data as well. 

Thanks!
(In reply to Marco Barulli from comment #29)
> "[...] On Android, writing data to or reading data from the clip- board does
> not require any permission. Therefore, every app currently running on an
> Android device can read the items stored in the clipboard at any time! 
> To make matters worse for password managers, the Android SDK provides the
> android.content.ClipboardManager.OnPrimaryClipChangedListener inter- face,
> which defines a listener callback that is invoked each time the primary item
> on the clipboard changes. This can be used by malicious apps to harvest
> passwords as they are passed through the clipboard.'

As far as I know the clipboard API will only be exposed to the OS itself, just like it is in Firefox for Desktop. It's possible for the browser code to have access to the clipboard but not for ordinary web pages. This will behave the same. The UI will be implemented as core OS feature, and cannot be replicated by third party applications / pages.

For a discussion about an open web facing API for clipboard data please see the W3C draft for Clipboard API at http://dev.w3.org/2006/webapi/clipops/clipops.html.
Flags: needinfo?(marco.barulli)
That would sound very appealing to anyone interested in the security of his/her smartphone.
Make sure to advertise this feature when available!

"Within Firefox OS you can copy and paste sensitive data without worrying about the risk of other apps eavesdropping on the clipboard." 

:)
Flags: needinfo?(marco.barulli)
Late to the party - we start talking about copying media via blobs and we're talking hitting what look like graphics OOM bugs.  Let me know if there is a better bug for graphics to listen to.
Copy and Paste for editable text fields is moved to bug 1029465 for tracking since the initial description of this meta is for broader scope.
No longer blocks: 2.0-system-platform
feature-b2g: 2.1 → ---
No longer depends on: 921965, 938045, 946646
Whiteboard: [tech-p1][ucid:SystemPlatform27, 2.0, ft:system-platform] → [tech-p1]
Depends on: 1029465
Blocks: 958307
A common use case for copy/paste is password managers. Now that WebCrypto API is starting to land in the nightlies, it should start to be possible to create Firefox OS ports of KeePass and other password managers.

However, the UI for these in other mobile implementations rely on being able to copy the password into the clipboard so that it can easily be pasted into a text field of another app/browser.

Are copied items in Firefox OS going to be able to be pasted inter-application?
Is there any plan to include it in the Developer menu?

By the way, how to enable it? According to, I have added:
PreferencesBuilder.prototype.preparePref = function() {
  this.system = this.config.SYSTEM;
  this.userPrefs['selectioncaret.enabled'] = true;
  this.userPrefs['touchcaret.enabled'] = true;

(File: http://paste.ubuntu.com/8344611/ )

But it's nt enabled for me.

Am I missing anything?
I was also thinking in adding a 'share with clipboard' to allow all apps to send an URL/image/etc to the clipboard so it can be pasted from another app.
Depends on: 1066231
Component: Gaia::Keyboard → Gaia::System
Whiteboard: [tech-p1] → [FT:System-Platform][tech-p1]
Hi, I've switched from 2.1 to lightly 2.2 in a hope to be able to use this feature (on Flame, on nightly channel). It was there two months ago, but it was too buggy for me to use it, so II wen to 2.1 in its stead. Now I'd like to give it a try again, but I do not know how? What worked couple of months back has changed. I see nice blue caret in text and I'm able to drag it around, but nor long tapp nor double tap nor pinch-out is bringing selection via two carrets for me. Can you please help/advise me?
I'd expect tutorial to this feature in first-use as well, but nothing...
Thx a lot,
MR
No longer blocks: 958307
Tim, John - is there still work that we need to do for copy/paste? Wondering if we can close this bug, or maybe dupe it if there is work being tracked somewhere else?
Flags: needinfo?(timdream)
Flags: needinfo?(jlu)
Forwarding NI to George, the go-to-person of Copy/Paste's Gaia side ;)
Flags: needinfo?(jlu) → needinfo?(gduan)
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(timdream)
Flags: needinfo?(gduan)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.