Copy event is not fired when pressing CTRL+C on contenteditable without selection
Categories
(Core :: DOM: Editor, defect)
Tracking
()
People
(Reporter: sefeng, Assigned: hereisdx, Mentored, NeedInfo)
References
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++] )
Attachments
(1 file)
STR:
- Load
data:text/html,<div contenteditable=true oncopy='alert(1)'>Copy</div>
- Click the div and press CTRL+C
Actual results:
- No alert
Expected results:
- Alert fired
The fix is to change the starting point to ComputeEditingHost(LimitInBodyElement::Yes)
if IsHTMLEditor()
is true. We'd also need a test case for this.
Reporter | ||
Updated•8 months ago
|
Reporter | ||
Updated•8 months ago
|
Assignee | ||
Comment 1•7 months ago
|
||
I'll take this one. Thanks for filing!
Assignee | ||
Comment 2•7 months ago
|
||
Updated•7 months ago
|
Assignee | ||
Comment 3•7 months ago
|
||
@segeng @masayuki I've created a patch to fix this bug. Can you please take a look? I've manually verified that it works, and also added a test.
Assignee | ||
Updated•7 months ago
|
Assignee | ||
Updated•7 months ago
|
Comment 4•7 months ago
|
||
(In reply to sheep424242 from comment #1)
I'll take this one. Thanks for filing!
Thank you for taking this :)
Updated•7 months ago
|
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf2277419073 Fire copy event when pressing Ctrl+C on contenteditable without selection. r=sefeng,masayuki
Reporter | ||
Updated•7 months ago
|
Comment 6•7 months ago
|
||
Backed out changeset bf2277419073 (Bug 1857303) for causing failures in test_contenteditable_copy_empty_selection.html CLOSED TREE
Logs:
TV https://treeherder.mozilla.org/logviewer?job_id=431989149&repo=autoland&lineNumber=5074
mochitest https://treeherder.mozilla.org/logviewer?job_id=431988744&repo=autoland&lineNumber=2827
Backout: https://hg.mozilla.org/integration/autoland/rev/0343092f20227f28b8a9de16a90fd2548de1e405
Reporter | ||
Updated•7 months ago
|
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cf6b9d74c2f9 Fire copy event when pressing Ctrl+C on contenteditable without selection. r=sefeng,masayuki
Comment 8•7 months ago
|
||
Backed out for causing failures on test_contenteditable_copy_empty_selection.html
- backout: https://hg.mozilla.org/integration/autoland/rev/c4f29639f3fe0ac9921399b6e0bf65a565b25b3f
- push: https://treeherder.mozilla.org/jobs?repo=autoland&revision=cf6b9d74c2f926defe39e04ff96084a85ed5acfe&group_state=expanded
- push where tier 1 fails were seen: https://treeherder.mozilla.org/jobs?repo=autoland&selectedTaskRun=c6VFidLyQcONnk6GTdEy4A.1&revision=e746122083e758920b17ca0fd4726093187f3715&searchStr=mochitest-plain&group_state=expanded
- failure log: https://treeherder.mozilla.org/logviewer?job_id=432027962&repo=autoland&lineNumber=23225
[task 2023-10-10T20:17:04.265Z] 20:17:04 INFO - TEST-START | editor/libeditor/tests/test_contenteditable_copy_empty_selection.html
[task 2023-10-10T20:17:04.319Z] 20:17:04 INFO - GECKO(4888) | [Child 4893, Main Thread] WARNING: '!originalEventTargetNode', file /builds/worker/checkouts/gecko/editor/libeditor/EditorEventListener.cpp:1152
[task 2023-10-10T20:17:04.320Z] 20:17:04 INFO - GECKO(4888) | [Child 4893, Main Thread] WARNING: EditorEventListener::Focus() failed: 'NS_SUCCEEDED(rv)', file /builds/worker/checkouts/gecko/editor/libeditor/EditorEventListener.cpp:473
[task 2023-10-10T20:17:04.320Z] 20:17:04 INFO - GECKO(4888) | [Child 4893, Main Thread] WARNING: EditorEventListener::HandleEvent() failed: 'NS_SUCCEEDED(rv)', file /builds/worker/checkouts/gecko/editor/libeditor/HTMLEditorEventListener.cpp:104
[task 2023-10-10T20:17:04.320Z] 20:17:04 INFO - GECKO(4888) | [Child 4893, Main Thread] WARNING: '!content', file /builds/worker/checkouts/gecko/editor/libeditor/HTMLEditor.cpp:6983
[task 2023-10-10T20:17:04.323Z] 20:17:04 INFO - GECKO(4888) | [Child 4893, Main Thread] WARNING: '!content', file /builds/worker/checkouts/gecko/editor/libeditor/HTMLEditor.cpp:6983
[task 2023-10-10T20:17:04.340Z] 20:17:04 INFO - TEST-INFO | started process screencapture
[task 2023-10-10T20:17:04.462Z] 20:17:04 INFO - TEST-INFO | screencapture: exit 0
[task 2023-10-10T20:17:04.462Z] 20:17:04 INFO - Buffered messages logged at 20:17:04
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - must wait for load
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - Buffered messages finished
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - TEST-UNEXPECTED-FAIL | editor/libeditor/tests/test_contenteditable_copy_empty_selection.html | Copy event should be fired
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - SimpleTest.ok@SimpleTest/SimpleTest.js:426:16
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - @editor/libeditor/tests/test_contenteditable_copy_empty_selection.html:27:15
[task 2023-10-10T20:17:04.463Z] 20:17:04 INFO - SimpleTest.waitForFocus/<@SimpleTest/SimpleTest.js:1058:13
[task 2023-10-10T20:17:04.464Z] 20:17:04 INFO - GECKO(4888) | MEMORY STAT | vsize 7089MB | residentFast 161MB | heapAllocated 23MB
[task 2023-10-10T20:17:04.465Z] 20:17:04 INFO - TEST-OK | editor/libeditor/tests/test_contenteditable_copy_empty_selection.html | took 186ms
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5fc128a7751b Fire copy event when pressing Ctrl+C on contenteditable without selection. r=sefeng,masayuki
Comment 10•7 months ago
|
||
bugherder |
Updated•6 months ago
|
Comment 12•6 months ago
|
||
Reproduced this issue on an affected nightly build from 2023-10-05 on Win 10.
Verified as fixed on Firefox 121.0b4 (20231127091758) and 122.0a1 (20231129050021) on Ubuntu 22, macOS 11 and Windows 10.
Description
•