New issue
Advanced search Search tips

Issue 717286 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DevTools: copying selected text from console breaks when selection ends on the expand triangle

Project Member Reported by l...@chromium.org, May 1 2017

Issue description

What steps will reproduce the problem?
(1) Create some console message with text (e.g. console.log('foo'))
(2) Create some console message with an expand triangle and text (e.g. type 'xyzzy' and then enter)
(3) Click and drag from the first message (inside 'foo') and mouseup on the expand triangle in the error message below it
(4) Copy / paste the text somewhere

What is the expected result?
Only the selected text in the first message 'foo' should be pasted

What happens instead?
Paste includes all of the text from the second message 'VM112:1 Uncaught ReferenceError: xyzzy is not defined
    at <anonymous>:1:1
(anonymous) @ VM112:1'

Our custom copy handler seems to run into an issue when getSelection() gives us an anchor/focus node that is an Element without textContent.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/56d8d770469ff02ac1521f49addaae48863a05f8

commit 56d8d770469ff02ac1521f49addaae48863a05f8
Author: luoe <luoe@chromium.org>
Date: Wed May 10 00:06:49 2017

DevTools: fix text offset when selection ends on expand triangle

A user's text selection may start/end on a non-TextNode with no text content,
for example the expand triangle icon. In these cases, getSelection()'s
anchor/focus node may be located before the first TextNode in a console message.

These cases break ConsoleViewport._textOffsetInNode(), which traverses starting
from the first TextNode. This CL addresses it by moving the target node to the
next TextNode.

BUG= 717286 

Review-Url: https://codereview.chromium.org/2856933006
Cr-Commit-Position: refs/heads/master@{#470442}

[modify] https://crrev.com/56d8d770469ff02ac1521f49addaae48863a05f8/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text-expected.txt
[modify] https://crrev.com/56d8d770469ff02ac1521f49addaae48863a05f8/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
[modify] https://crrev.com/56d8d770469ff02ac1521f49addaae48863a05f8/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js

Comment 2 by l...@chromium.org, May 10 2017

Status: Fixed (was: Assigned)

Sign in to add a comment