Backed out changeset 2c986272197f (bug 1298225) for mochitest-c1 failures a=backout

--HG--
extra : rebase_source : 0d2f61f743461d4f75f5c44552f9f1676cecb556
This commit is contained in:
Wes Kocher 2016-08-31 13:07:21 -07:00
parent 2af3f87bb6
commit 2cb56a6d70
5 changed files with 44 additions and 82 deletions

View File

@ -176,8 +176,7 @@ module.exports = createClass({
if (functionDisplayName) {
elements.push(
dom.span({ className: "frame-link-function-display-name" },
functionDisplayName),
" "
functionDisplayName)
);
}
}
@ -237,7 +236,7 @@ module.exports = createClass({
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);

View File

@ -42,12 +42,12 @@ const StackTrace = createClass({
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(),
@ -58,7 +58,7 @@ const StackTrace = createClass({
showAnonymousFunctionName: true,
showFullSourceUrl: true,
onClick: onViewSourceInDebugger
}), "\n");
}));
});
return dom.div({ className: "stack-trace" }, frames);

View File

@ -935,6 +935,8 @@ Messages.Simple.prototype = extend(Messages.BaseMessage.prototype, {
this.element.appendChild(body);
this.element.appendChild(this.document.createTextNode("\n"));
this.element.clipboardText = this.element.textContent;
if (this.private) {
@ -991,16 +993,12 @@ Messages.Simple.prototype = extend(Messages.BaseMessage.prototype, {
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;
}

View File

@ -3,21 +3,23 @@
/* 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";
const { tab, browser } = yield loadTab(TEST_URI);
Task.spawn(runner).then(finishTest);
function* runner() {
const {tab} = yield loadTab(TEST_URI);
hud = yield openConsole(tab);
outputNode = hud.outputNode;
contextMenu = hud.iframeWindow.document.getElementById("output-contextmenu");
@ -27,71 +29,41 @@ add_task(function* () {
});
hud.jsterm.clearOutput();
content.console.log("bug 1100562");
yield ContentTask.spawn(browser, {}, function* () {
let button = content.document.getElementById("testTrace");
button.click();
});
let results = yield waitForMessages({
let [results] = yield waitForMessages({
webconsole: hud,
messages: [
{
messages: [{
text: "bug 1100562",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
lines: 1,
},
{
name: "console.trace output",
consoleTrace: true,
lines: 3,
},
]
}]
});
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;
}
function testContextMenuCopy() {
waitForClipboard((str) => {
return message.textContent.trim() == str.trim();
}, () => {
goDoCommand("cmd_copy");
}, () => {}, () => {}
);
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");
// 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 finishTest();
});
}
}

View File

@ -13,12 +13,6 @@
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.");
@ -28,7 +22,6 @@
<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>