Bug 146336 - Implement unprivileged execCommand("copy") and execCommand("cut")
Summary: Implement unprivileged execCommand("copy") and execCommand("cut")
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
Keywords: InRadar
Depends on:
Blocks: 155548
  Show dependency treegraph
Reported: 2015-06-25 18:41 PDT by Alan Tam
Modified: 2016-03-16 10:36 PDT (History)
13 users (show)

See Also:

Test case (597 bytes, text/html)
2015-06-25 18:41 PDT, Alan Tam
no flags Details
Patch (24.41 KB, patch)
2016-03-13 20:58 PDT, Sam Weinig
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Tam 2015-06-25 18:41:37 PDT
Created attachment 255609 [details]
Test case

Chrome 43 decides that allowing the website to pollute your clipboard inside _any_ DOM event handler is no longer a concern.

Can WebKit consider allowing the same?

Test case attached.
Comment 1 Ryosuke Niwa 2015-06-29 19:41:30 PDT
Letting webpages _write_ into the clibpard while the user is interactiving with the page seems okay.
Comment 2 Alan Tam 2015-06-30 13:49:46 PDT
Yes, writing only.

Looks like this will be implemented in Firefox 41 too. https://bugzilla.mozilla.org/show_bug.cgi?id=1012662
Comment 3 Alan Tam 2015-06-30 15:54:09 PDT
FWIW, the Chrome issue is here: https://code.google.com/p/chromium/issues/detail?id=424968
Comment 4 Radar WebKit Bug Importer 2016-01-26 14:01:07 PST
Comment 5 David Kilzer (:ddkilzer) 2016-01-26 14:01:51 PST
This would allow Github.com to stop using Flash on WebKit:
Comment 6 Alexey Proskuryakov 2016-01-26 14:12:06 PST
There is certainly no shortage of websites that are using Flash for this purpose, github possibly not even being the most prominent.

Personally, I'm not looking forward to a world in which advertisers put their content on my pasteboard each time a click a webpage.
Comment 7 Sam Weinig 2016-03-13 20:58:06 PDT
Created attachment 273921 [details]
Comment 8 WebKit Commit Bot 2016-03-13 20:59:37 PDT
Attachment 273921 [details] did not pass style-queue:

ERROR: Source/WebCore/editing/EditorCommand.cpp:1177:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 1 in 9 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Sam Weinig 2016-03-13 21:43:43 PDT
Committed r198092: <http://trac.webkit.org/changeset/198092>
Comment 10 Adam Roben (:aroben) 2016-03-14 07:21:15 PDT
Yay! Thanks Sam!
Comment 11 Sam Weinig 2016-03-15 17:01:32 PDT
(In reply to comment #10)
> Yay! Thanks Sam!

My pleasure! Any chance we can get Github updated to check document.queryCommandSupported("copy") to add the copy button :).