Open Bug 1433371 Opened 7 years ago Updated 3 years ago

document.execCommand("paste") does not include table content

Categories

(Core :: DOM: Editor, defect, P3)

55 Branch
x86_64
All
defect

Tracking

()

Tracking Status
firefox58 --- affected
firefox59 --- affected
firefox60 --- affected

People

(Reporter: rappazf, Unassigned)

Details

Attachments

(1 file)

989 bytes, application/x-zip-compressed
Details
Attached file paste_test.zip
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 OPR/50.0.2762.67 Steps to reproduce: Load the test extension from the zip attached. Now go to http://rzblx1.uni-regensburg.de/ezeit/fl.phtml?bibid=KUBFR&colors=7&lang=en Select some text on the page and right click to copy the selection in the clipboard Click in the search field Use the shift key to run a keyup event : no text is pasted, even if true is return on the console. Strangely if you open a empty notepad file, you paste there the clipboard content, reselect it and copy it again, the test works on the page… It seems that with copying a part of the text from the same page that I want to paste it, I lost the clipboard access. This behavior is not show in all the page, for example in this page http://www.unifr.ch/dokpe/en a text copied from the page is always pasted in the custom google search field on the left. Actual results: no text is pasted, even if true is return on the console. Expected results: the text from the clipboard should have been pasted in the text area
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID: 20180130223236 I have tested this issue on latest Firefox release 58.0.1, latest Nightly build 60.0a1 and managed to reproduce it. I've installed the provided extension through "about:debugging" page, navigated to the provided link and copied some text. After I've clicked into the search field and pressed "Shift" key an empty text field appeared and the text wasn't pasted. Indeed, after pasting the text into Notepad ++ file, select it, copy it and come back to the search field from the provided link and press "Shift" key, the text was pasted. This issue is also reproducible on older Nightly builds, such as 52.0a1 (2016-09-19). Moreover, the text is not pasted even from Notepad ++ file. I have also tested this on Mac 12.10.6 and Ubuntu 14.04 x64, but the provided extension didn't do anything. I'm not sure which is the most suitable component for this issue, but I'm going to move it to Toolkit:: WebExtensions: Untriaged.
Status: UNCONFIRMED → NEW
Component: Untriaged → WebExtensions: Untriaged
Ever confirmed: true
OS: Unspecified → Windows
Product: Firefox → Toolkit
Hardware: Unspecified → x86_64
Rob, does this ring any bells?
Flags: needinfo?(rob)
I can reproduce this on Linux too (and Firefox 58.0.1 in Windows 7). It does not appear to be specific to WebExtensions, but in how execCommand("paste") handles HTML tables. Minimal STR: 1. Visit data:text/html,<table><tr><td>intable</td></tr></table>outtable 2. Ctrl+A to select all, Ctrl-C to copy the text. 3. Go to the location bar and press Ctrl-V (then see that "intableouttable" is pasted; this works as expected and is not buggy). 4. Visit about:about (this is a privileged browser page, with the same capabilities as a WebExtension with the clipboardRead permission), and run the following snippet: document.onkeydown = function() { var area = document.createElement('textarea'); area.contentEditable = true; // Without this, nothing is seen at all. document.body.append(area); area.focus(); document.execCommand('paste'); }; 5. Then press any key (e.g. Shift in the page). Expected result: The text "intableouttable" should appear. Actual result: The text "outtable" appears (the text inside the table was blanked out). The text seems to be copied correctly, if I view the clipboard content with the InsideClipboard tool on Windows (http://www.nirsoft.net/utils/inside_clipboard.html). When I paste manually, it works too. So this is likely a bug in pasting HTML tables with document.execCommand('paste').
Flags: needinfo?(rob)
Component: WebExtensions: Untriaged → Editor
Product: Toolkit → Core
Summary: Extension: access to clipboard is lost when pasting → document.execCommand("paste") does not include table content
Priority: -- → P3

With the STR of c3, this is still reproducible, also on Ubuntu.

OS: Windows → All
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: