Bug 914108 - Include the number of message duplicates when copy-pasting from the console. r=nchevobbe.
authorDhruvi Butti <dhruvibutti9477@gmail.com>
Mon, 18 Mar 2019 10:11:13 +0000
changeset 464760 516e8d10ccedbe78cbba99fbfa940f461faa4b4a
parent 464759 c712c4153146bb7e8c689d7162e9f22dd9b6deb3
child 464761 7f3c70bce7e8edc2a5682365da254814cbf68829
push id112481
push userrgurzau@mozilla.com
push dateMon, 18 Mar 2019 21:51:19 +0000
treeherdermozilla-inbound@6ed5e5a3e39e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs914108
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 914108 - Include the number of message duplicates when copy-pasting from the console. r=nchevobbe. This makes it possible to copy paste the number of times the message is repeated Differential Revision: https://phabricator.services.mozilla.com/D23667
devtools/client/themes/webconsole.css
devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js
--- a/devtools/client/themes/webconsole.css
+++ b/devtools/client/themes/webconsole.css
@@ -245,17 +245,16 @@ a {
 }
 
 .message-body-wrapper .table-widget-body {
   overflow: visible;
 }
 
 /* The bubble that shows the number of times a message is repeated */
 .message-repeats {
-  -moz-user-select: none;
   flex-shrink: 0;
   margin: 2px 5px 0 5px;
   padding: 0 6px;
   height: 1.25em;
   color: white;
   background-color: var(--repeat-bubble-background-color);
   border-radius: 40px;
   font: message-box;
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_context_menu_copy_entire_message.js
@@ -17,16 +17,17 @@ httpServer.registerPathHandler(`/`, func
 httpServer.registerPathHandler("/test.js", function(request, response) {
   response.setHeader("Content-Type", "application/javascript");
   response.write(`
     window.logStuff = function() {
       console.log("simple text message");
       function wrapper() {
         console.log(new Error("error object"));
         console.trace();
+        for (let i = 0; i < 2; i++) console.log("repeated")
       }
       wrapper();
     };
     z.bar = "baz";
   `);
 });
 
 const TEST_URI = `http://localhost:${httpServer.identity.primaryPort}/`;
@@ -94,17 +95,17 @@ async function testMessagesCopy(hud, tim
     `${timestamp ? getTimestampText(message) + " " : ""}console.trace() test.js:6:17`,
     "Stacktrace first line has the expected text");
   if (timestamp) {
     ok(LOG_FORMAT_WITH_TIMESTAMP.test(lines[0]),
       "Log line has the right format:\n" + lines[0]);
   }
   is(lines[1], `    wrapper ${TEST_URI}test.js:6`,
     "Stacktrace first line has the expected text");
-  is(lines[2], `    logStuff ${TEST_URI}test.js:8`,
+  is(lines[2], `    logStuff ${TEST_URI}test.js:9`,
     "Stacktrace second line has the expected text");
 
   info("Test copy menu item for the error message");
   message = await waitFor(() => findMessage(hud, "Error:"));
   // Wait for the stacktrace to be rendered.
   await waitFor(() => message.querySelector(".frames"));
   clipboardText = await copyMessageContent(hud, message);
   ok(true, "Clipboard text was found and saved");
@@ -112,35 +113,39 @@ async function testMessagesCopy(hud, tim
   is(lines[0], `${timestamp ? getTimestampText(message) + " " : ""}Error: "error object"`,
     "Error object first line has expected text");
   if (timestamp) {
     ok(LOG_FORMAT_WITH_TIMESTAMP.test(lines[0]),
       "Log line has the right format:\n" + lines[0]);
   }
   is(lines[1], `    wrapper ${TEST_URI}test.js:5`,
     "Error Stacktrace first line has the expected text");
-  is(lines[2], `    logStuff ${TEST_URI}test.js:8`,
+  is(lines[2], `    logStuff ${TEST_URI}test.js:9`,
     "Error Stacktrace second line has the expected text");
 
   info("Test copy menu item for the reference error message");
   message = await waitFor(() => findMessage(hud, "ReferenceError:"));
   clipboardText = await copyMessageContent(hud, message);
   ok(true, "Clipboard text was found and saved");
   lines = clipboardText.split(newLineString);
   is(lines[0], (timestamp ? getTimestampText(message) + " " : "") +
-    "ReferenceError: z is not defined test.js:10:5",
+    "ReferenceError: z is not defined test.js:11:5",
     "ReferenceError first line has expected text");
   if (timestamp) {
     ok(LOG_FORMAT_WITH_TIMESTAMP.test(lines[0]),
       "Log line has the right format:\n" + lines[0]);
   }
   ok(!!message.querySelector(".learn-more-link"),
     "There is a Learn More link in the ReferenceError message");
   is(clipboardText.toLowerCase().includes("Learn More"), false,
     "The Learn More text wasn't put in the clipboard");
+
+  message = await waitFor(() => findMessage(hud, "repeated 2"));
+  clipboardText = await copyMessageContent(hud, message);
+  ok(true, "Clipboard text was found and saved");
 }
 
 function getTimestampText(messageEl) {
   return getSelectionTextFromElement(messageEl.querySelector(".timestamp"));
 }
 
 /**
  * Simple helper method to open the context menu on a given message, and click on the copy