WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
147767
Web Inspector: Don't include zero-width space into a copied text from the console
https://bugs.webkit.org/show_bug.cgi?id=147767
Summary
Web Inspector: Don't include zero-width space into a copied text from the con...
Nikita Vasilyev
Reported
2015-08-06 20:28:32 PDT
Created
attachment 258439
[details]
[Animated GIF] Bug Steps: 1. var img = new Image; img.src = "
http://33.media.tumblr.com/tumblr_m6t5rzAfVU1qc0s10o1_500.gif
"; img; 2. Click on the logged console message to select it 3. Press Command-C to copy it Expected clipboard content: <img src="
http://33.media.tumblr.com/tumblr_m6t5rzAfVU1qc0s10o1_500.gif
"> Actual clipboard content: <img src="
http://33.media.tumblr.com/tumblr_m6t5rzAfVU1qc0s10o1_500.gif
"> = $1 1. There are a few zero-width spaces (\u200B) in the copied message; they are marked as red dots if you paste this message to the console prompt (see the attached image). 2. " = $1" shouldn't be copied.
Attachments
[Animated GIF] Bug
(768.69 KB, image/gif)
2015-08-06 20:28 PDT
,
Nikita Vasilyev
no flags
Details
Patch
(4.11 KB, patch)
2015-08-07 19:08 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(4.30 KB, patch)
2015-08-07 19:23 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(4.31 KB, patch)
2015-08-07 19:33 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Timothy Hatcher
Comment 1
2015-08-07 10:04:09 PDT
WebInspector._copy should already be doing this, I guess it isn't being called? // Remove word break characters from the selection before putting it on the pasteboard. var selectionString = selection.toString().removeWordBreakCharacters(); event.clipboardData.setData("text/plain", selectionString); event.preventDefault();
Devin Rousso
Comment 2
2015-08-07 19:08:11 PDT
Created
attachment 258553
[details]
Patch
Timothy Hatcher
Comment 3
2015-08-07 19:16:46 PDT
Comment on
attachment 258553
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258553&action=review
> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:190 > + clipboardString = clipboardString.replace(/(\s*=\s*\$\d+)$/, "");
No need for the () in the regex.
Devin Rousso
Comment 4
2015-08-07 19:18:57 PDT
Should this also remove console information? For example, entering console.log("test"); If I copy the resulting line (which should just say "text") and paste it, I get [Log] test Should that [Log] be there? I have also seen source location information at the end for functions.
Timothy Hatcher
Comment 5
2015-08-07 19:22:18 PDT
[Log[ is added on purpose. The location is also added. I think it makes sense to strip out the = $n parts.
Devin Rousso
Comment 6
2015-08-07 19:23:15 PDT
Created
attachment 258554
[details]
Patch
Timothy Hatcher
Comment 7
2015-08-07 19:24:18 PDT
Comment on
attachment 258554
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258554&action=review
> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:190 > + if (this._message.savedResultIndex) > + clipboardString = clipboardString.replace(/\s*=\s*\$\d+$/, "");
Wait, never mind. I think $n should stay. If you use $n in a future line (like $2.foo.bar), you want to be able to look back and see where it came from. So remote this stripping.
Devin Rousso
Comment 8
2015-08-07 19:33:20 PDT
Created
attachment 258555
[details]
Patch
Devin Rousso
Comment 9
2015-08-07 19:34:16 PDT
Comment on
attachment 258555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258555&action=review
> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:190 > + clipboardString = clipboardString.replace(/\s*=\s*(\$\d+)$/, " = $1");
By the way, I added this so that, as seen in Nikita's example, the " = $1" doesn't wrap to the next line.
Timothy Hatcher
Comment 10
2015-08-07 19:54:15 PDT
Comment on
attachment 258555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258555&action=review
>> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:190 >> + clipboardString = clipboardString.replace(/\s*=\s*(\$\d+)$/, " = $1"); > > By the way, I added this so that, as seen in Nikita's example, the " = $1" doesn't wrap to the next line.
Oh, I see. My bad.
Timothy Hatcher
Comment 11
2015-08-07 19:55:17 PDT
Comment on
attachment 258555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258555&action=review
>>> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:190 >>> + clipboardString = clipboardString.replace(/\s*=\s*(\$\d+)$/, " = $1"); >> >> By the way, I added this so that, as seen in Nikita's example, the " = $1" doesn't wrap to the next line. > > Oh, I see. My bad.
Oh, you were stripping before. Now you just strip linebreaks there. Nice!
WebKit Commit Bot
Comment 12
2015-08-07 20:45:37 PDT
Comment on
attachment 258555
[details]
Patch Clearing flags on attachment: 258555 Committed
r188184
: <
http://trac.webkit.org/changeset/188184
>
WebKit Commit Bot
Comment 13
2015-08-07 20:45:41 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug