Closed Bug 1307906 Opened 8 years ago Closed 7 years ago

Add newline at end of console messages for clipboard compat

Categories

(DevTools :: Console, enhancement, P1)

enhancement

Tracking

(firefox54 verified)

VERIFIED FIXED
Firefox 54
Iteration:
54.1 - Feb 6
Tracking Status
firefox54 --- verified

People

(Reporter: linclark, Assigned: jdescottes)

References

Details

Attachments

(1 file)

Priority: -- → P2
Whiteboard: new-console
Flags: qe-verify+
QA Contact: iulia.cristescu
Whiteboard: new-console → [new-console]
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Iteration: --- → 53.5 - Jan 23
Priority: P2 → P1
Iteration: 53.5 - Jan 23 → 54.1 - Feb 6
Comment on attachment 8829534 [details]
Bug 1307906 - add newline and spaces in console msg for clipboard;

https://reviewboard.mozilla.org/r/106600/#review107788

::: devtools/client/shared/components/stack-trace.js:50
(Diff revision 1)
>          frames.push("\t", AsyncFrame({
>            asyncCause: s.asyncCause
>          }), "\n");

shouldn't we make the same change for that bit too ?

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:43
(Diff revision 1)
> -  }
> +  ok(true, "Clipboard text was found and saved");
> +
> +  info("Check copied text for simple log message");
> +  let lines = clipboardText.split("\n");
> +  ok(lines.length, 2, "There are 2 lines in the copied text");
> +  is(lines[1], "", "There last line is an empty new line");

s/There/The

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:47
(Diff revision 1)
> +  ok(lines.length, 2, "There are 2 lines in the copied text");
> +  is(lines[1], "", "There last line is an empty new line");
> +  ok(LOG_FORMAT.test(lines[0]), "Log line has the right format:\n" + lines[0]);
> +
> +  info("Test copy menu item for the stack trace message");
> +  message = yield waitFor(() => findMessage(hud, "simple text message"));

We might want to wait for `console.trace():` here

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:54
(Diff revision 1)
> +  ok(true, "Clipboard text was found and saved");
> +
> +  info("Check copied text for stack trace message");
> +  lines = clipboardText.split("\n");
> +  ok(lines.length, 4, "There are 4 lines in the copied text");
> +  is(lines[3], "", "There last line is an empty new line");

s/There/The
Comment on attachment 8829534 [details]
Bug 1307906 - add newline and spaces in console msg for clipboard;

https://reviewboard.mozilla.org/r/106600/#review107942

::: devtools/client/shared/components/stack-trace.js:50
(Diff revision 1)
>          frames.push("\t", AsyncFrame({
>            asyncCause: s.asyncCause
>          }), "\n");

Missed your review comments, sorry! 

Your comment is totally valid, but I actually can't modify this without breaking backward compat for the old console. I reverted this in the last version

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:43
(Diff revision 1)
> -  }
> +  ok(true, "Clipboard text was found and saved");
> +
> +  info("Check copied text for simple log message");
> +  let lines = clipboardText.split("\n");
> +  ok(lines.length, 2, "There are 2 lines in the copied text");
> +  is(lines[1], "", "There last line is an empty new line");

Fixed thanks!

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:47
(Diff revision 1)
> +  ok(lines.length, 2, "There are 2 lines in the copied text");
> +  is(lines[1], "", "There last line is an empty new line");
> +  ok(LOG_FORMAT.test(lines[0]), "Log line has the right format:\n" + lines[0]);
> +
> +  info("Test copy menu item for the stack trace message");
> +  message = yield waitFor(() => findMessage(hud, "simple text message"));

Ahah right :) Try was not happy about this one either!

::: devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js:54
(Diff revision 1)
> +  ok(true, "Clipboard text was found and saved");
> +
> +  info("Check copied text for stack trace message");
> +  lines = clipboardText.split("\n");
> +  ok(lines.length, 4, "There are 4 lines in the copied text");
> +  is(lines[3], "", "There last line is an empty new line");

ditto
Comment on attachment 8829534 [details]
Bug 1307906 - add newline and spaces in console msg for clipboard;

https://reviewboard.mozilla.org/r/106600/#review107950

::: devtools/client/webconsole/new-console-output/components/message.js:215
(Diff revisions 1 - 4)
> -        attachment
> -      ),
> -      // Add a newline for formatting when copying to the clipboard.
> +        // Add a newline for formatting when copying to the clipboard.
> -      "\n"
> +        "\n",
> +        // If an attachment is displayed, the final newline is handled by the attachment.
> +        attachment

is it valid if the attachment is the result of a `console.table` call ?

I just checked in the old console and we only copy the `console.table():` label (with a new empty line though), so I guess this is not a big deal
Attachment #8829534 - Flags: review?(chevobbe.nicolas) → review+
Thanks for checking that! Let's land it like this, we don't want to achieve 100% parity with the old one (and I guess only copying `console.table():` was not very useful either).

I'll log a follow up to review the clipboard output of the different messages.
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6ba1dc63a5e3
add newline and spaces in console msg for clipboard;r=nchevobbe
https://hg.mozilla.org/mozilla-central/rev/6ba1dc63a5e3
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 54
The bug is verified fixed on 54.0a1 (2017-02-02) using Windows 10 x64, Mac OS X 10.11.6 and Ubuntu 16.04 x64.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Whiteboard: [new-console]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: