Backed out changeset 2c986272197f (bug 1298225) for mochitest-c1 failures a=backout
authorWes Kocher <wkocher@mozilla.com>
Wed, 31 Aug 2016 13:07:21 -0700
changeset 408742 ff74f7a0d29c29817e87e04abed391237458f6a8
parent 408741 e760ad8231d667e777534dce301db6bee92acbbd
child 408743 98465d11d072916826935273917cea32f4486359
push id28281
push userbmo:giles@thaumas.net
push dateThu, 01 Sep 2016 16:55:56 +0000
reviewersbackout
bugs1298225
milestone51.0a1
backs out2c986272197fedc498235e2a012c8a3e13993b58
Backed out changeset 2c986272197f (bug 1298225) for mochitest-c1 failures a=backout
devtools/client/shared/components/frame.js
devtools/client/shared/components/stack-trace.js
devtools/client/webconsole/console-output.js
devtools/client/webconsole/test/browser_console_copy_entire_message_context_menu.js
devtools/client/webconsole/test/test-console.html
--- a/devtools/client/shared/components/frame.js
+++ b/devtools/client/shared/components/frame.js
@@ -171,18 +171,17 @@ module.exports = createClass({
       let functionDisplayName = frame.functionDisplayName;
       if (!functionDisplayName && showAnonymousFunctionName) {
         functionDisplayName = webl10n.getStr("stacktrace.anonymousFunction");
       }
 
       if (functionDisplayName) {
         elements.push(
           dom.span({ className: "frame-link-function-display-name" },
-            functionDisplayName),
-          " "
+            functionDisplayName)
         );
       }
     }
 
     let displaySource = showFullSourceUrl ? long : short;
     if (isSourceMapped) {
       displaySource = getSourceMappedFile(displaySource);
     } else if (showEmptyPathAsHost && (displaySource === "" || displaySource === "/")) {
@@ -232,14 +231,14 @@ module.exports = createClass({
     } else {
       sourceEl = dom.span({
         className: "frame-link-source",
       }, sourceInnerEl);
     }
     elements.push(sourceEl);
 
     if (showHost && host) {
-      elements.push(" ", dom.span({ className: "frame-link-host" }, host));
+      elements.push(dom.span({ className: "frame-link-host" }, host));
     }
 
     return dom.span(attributes, ...elements);
   }
 });
--- a/devtools/client/shared/components/stack-trace.js
+++ b/devtools/client/shared/components/stack-trace.js
@@ -37,32 +37,32 @@ const StackTrace = createClass({
   },
 
   render() {
     let { stacktrace, onViewSourceInDebugger } = this.props;
 
     let frames = [];
     stacktrace.forEach(s => {
       if (s.asyncCause) {
-        frames.push("\t", AsyncFrame({
+        frames.push(AsyncFrame({
           asyncCause: s.asyncCause
-        }), "\n");
+        }));
       }
 
-      frames.push("\t", Frame({
+      frames.push(Frame({
         frame: {
           functionDisplayName: s.functionName,
           source: s.filename.split(" -> ").pop(),
           line: s.lineNumber,
           column: s.columnNumber,
         },
         showFunctionName: true,
         showAnonymousFunctionName: true,
         showFullSourceUrl: true,
         onClick: onViewSourceInDebugger
-      }), "\n");
+      }));
     });
 
     return dom.div({ className: "stack-trace" }, frames);
   }
 });
 
 module.exports = StackTrace;
--- a/devtools/client/webconsole/console-output.js
+++ b/devtools/client/webconsole/console-output.js
@@ -930,16 +930,18 @@ Messages.Simple.prototype = extend(Messa
       twisty.addEventListener("click", this._onClickCollapsible);
       this.element.appendChild(twisty);
       this.collapsible = true;
       this.element.setAttribute("collapsible", true);
     }
 
     this.element.appendChild(body);
 
+    this.element.appendChild(this.document.createTextNode("\n"));
+
     this.element.clipboardText = this.element.textContent;
 
     if (this.private) {
       this.element.setAttribute("private", true);
     }
 
     // TODO: handle object releasing in a more elegant way once all console
     // messages use the new API - bug 778766.
@@ -986,26 +988,22 @@ Messages.Simple.prototype = extend(Messa
 
     // do this before repeatNode is rendered - it has no effect afterwards
     this._repeatID.textContent += "|" + container.textContent;
 
     let repeatNode = this._renderRepeatNode();
     let location = this._renderLocation();
 
     if (repeatNode) {
-      bodyFlex.appendChild(this.document.createTextNode(" "));
       bodyFlex.appendChild(repeatNode);
     }
     if (location) {
-      bodyFlex.appendChild(this.document.createTextNode(" "));
       bodyFlex.appendChild(location);
     }
 
-    bodyFlex.appendChild(this.document.createTextNode("\n"));
-
     if (this.stack) {
       this._attachment = new Widgets.Stacktrace(this, this.stack).render().element;
     }
 
     if (this._attachment) {
       bodyWrapper.appendChild(this._attachment);
     }
 
--- a/devtools/client/webconsole/test/browser_console_copy_entire_message_context_menu.js
+++ b/devtools/client/webconsole/test/browser_console_copy_entire_message_context_menu.js
@@ -1,97 +1,69 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-/* globals goDoCommand */
-
 "use strict";
 
 // Test copying of the entire console message when right-clicked
 // with no other text selected. See Bug 1100562.
 
-add_task(function* () {
+function test() {
   let hud;
   let outputNode;
   let contextMenu;
 
-  const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/test-console.html";
+  const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
+                   "test/test-console.html";
+
+  Task.spawn(runner).then(finishTest);
 
-  const { tab, browser } = yield loadTab(TEST_URI);
-  hud = yield openConsole(tab);
-  outputNode = hud.outputNode;
-  contextMenu = hud.iframeWindow.document.getElementById("output-contextmenu");
-
-  registerCleanupFunction(() => {
-    hud = outputNode = contextMenu = null;
-  });
+  function* runner() {
+    const {tab} = yield loadTab(TEST_URI);
+    hud = yield openConsole(tab);
+    outputNode = hud.outputNode;
+    contextMenu = hud.iframeWindow.document.getElementById("output-contextmenu");
 
-  hud.jsterm.clearOutput();
+    registerCleanupFunction(() => {
+      hud = outputNode = contextMenu = null;
+    });
 
-  yield ContentTask.spawn(browser, {}, function* () {
-    let button = content.document.getElementById("testTrace");
-    button.click();
-  });
+    hud.jsterm.clearOutput();
+    content.console.log("bug 1100562");
 
-  let results = yield waitForMessages({
-    webconsole: hud,
-    messages: [
-      {
+    let [results] = yield waitForMessages({
+      webconsole: hud,
+      messages: [{
         text: "bug 1100562",
         category: CATEGORY_WEBDEV,
         severity: SEVERITY_LOG,
-        lines: 1,
-      },
-      {
-        name: "console.trace output",
-        consoleTrace: true,
-        lines: 3,
-      },
-    ]
-  });
+      }]
+    });
 
-  outputNode.focus();
+    outputNode.focus();
+    let message = [...results.matched][0];
 
-  for (let result of results) {
-    let message = [...result.matched][0];
+    yield waitForContextMenu(contextMenu, message, copyFromPopup,
+                             testContextMenuCopy);
 
-    yield waitForContextMenu(contextMenu, message, () => {
+    function copyFromPopup() {
       let copyItem = contextMenu.querySelector("#cMenu_copy");
       copyItem.doCommand();
 
       let controller = top.document.commandDispatcher
                                    .getControllerForCommand("cmd_copy");
       is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
-    });
-
-    let clipboardText;
-
-    yield waitForClipboardPromise(
-      () => goDoCommand("cmd_copy"),
-      (str) => {
-        clipboardText = str;
-        return message.textContent == clipboardText;
-      }
-    );
-
-    ok(clipboardText, "Clipboard text was found and saved");
+    }
 
-    let lines = clipboardText.split("\n");
-    ok(lines.length > 0, "There is at least one newline in the message");
-    is(lines.pop(), "", "There is a newline at the end");
-    is(lines.length, result.lines, `There are ${result.lines} lines in the message`);
-
-    // Test the first line for "timestamp message repeat file:line"
-    let firstLine = lines.shift();
-    ok(/^[\d:.]+ .+ \d+ .+:\d+$/.test(firstLine),
-      "The message's first line has the right format");
+    function testContextMenuCopy() {
+      waitForClipboard((str) => {
+        return message.textContent.trim() == str.trim();
+      }, () => {
+        goDoCommand("cmd_copy");
+      }, () => {}, () => {}
+      );
+    }
 
-    // Test the remaining lines (stack trace) for "TABfunctionName sourceURL:line:col"
-    for (let line of lines) {
-      ok(/^\t.+ .+:\d+:\d+$/.test(line), "The stack trace line has the right format");
-    }
+    yield closeConsole(tab);
   }
-
-  yield closeConsole(tab);
-  yield finishTest();
-});
+}
--- a/devtools/client/webconsole/test/test-console.html
+++ b/devtools/client/webconsole/test/test-console.html
@@ -8,27 +8,20 @@
       };
 
       function test() {
         var str = "Dolske Digs Bacon, Now and Forevermore."
         for (var i=0; i < 5; i++) {
           console.log(str);
         }
       }
-
-      function testTrace() {
-        console.log("bug 1100562");
-        console.trace();
-      }
-
       console.info("INLINE SCRIPT:");
       test();
       console.warn("I'm warning you, he will eat up all yr bacon.");
       console.error("Error Message");
     </script>
   </head>
   <body>
     <h1 id="header">Heads Up Display Demo</h1>
     <button onclick="test();">Log stuff about Dolske</button>
-    <button id="testTrace" onclick="testTrace();">Log stuff with stacktrace</button>
     <div id="myDiv"></div>
   </body>
 </html>