Backed out changeset 4206d18e42c0 (bug 684096) for test bustage

This commit is contained in:
Carsten "Tomcat" Book 2014-11-05 12:34:42 +01:00
Родитель 452547227c
Коммит c1c79e7750
6 изменённых файлов: 37 добавлений и 124 удалений

Просмотреть файл

@ -943,16 +943,14 @@ Messages.Simple.prototype = Heritage.extend(Messages.BaseMessage.prototype,
return null;
}
let {url, line, column} = this.location;
let {url, line} = this.location;
if (IGNORED_SOURCE_URLS.indexOf(url) != -1) {
return null;
}
// The ConsoleOutput owner is a WebConsoleFrame instance from webconsole.js.
// TODO: move createLocationNode() into this file when bug 778766 is fixed.
return this.output.owner.createLocationNode({url: url,
line: line,
column: column});
return this.output.owner.createLocationNode(url, line);
},
}); // Messages.Simple.prototype
@ -1252,7 +1250,6 @@ Messages.ConsoleGeneric = function(packet)
location: {
url: packet.filename,
line: packet.lineNumber,
column: packet.columnNumber
},
};
@ -3449,8 +3446,8 @@ Widgets.Stacktrace.prototype = Heritage.extend(Widgets.BaseWidget.prototype,
fn.textContent = l10n.getStr("stacktrace.anonymousFunction");
}
let location = this.output.owner.createLocationNode({url: frame.filename,
line: frame.lineNumber},
let location = this.output.owner.createLocationNode(frame.filename,
frame.lineNumber,
"jsdebugger");
// .devtools-monospace sets font-size to 80%, however .body already has

Просмотреть файл

@ -82,7 +82,6 @@ support-files =
test-console-output-04.html
test-console-output-dom-elements.html
test-console-output-events.html
test-console-column.html
test-consoleiframes.html
test-data.json
test-data.json^headers^
@ -325,4 +324,3 @@ skip-if = buildapp == 'mulet'
[browser_webconsole_autocomplete_crossdomain_iframe.js]
[browser_webconsole_console_custom_styles.js]
[browser_webconsole_console_api_stackframe.js]
[browser_webconsole_column_numbers.js]

Просмотреть файл

@ -1,48 +0,0 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Check if console provides the right column number alongside line number
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-column.html";
let hud;
function test() {
addTab(TEST_URI);
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
openConsole(null, consoleOpened);
}, true);
}
function consoleOpened(aHud) {
hud = aHud;
waitForMessages({
webconsole: hud,
messages: [{
text: 'Error Message',
category: CATEGORY_WEBDEV,
severity: SEVERITY_ERROR
}]
}).then(testLocationColumn);
}
function testLocationColumn() {
let messages = hud.outputNode.children;
let expected = ['6:6', '6:38', '7:8', '8:10', '9:8', '10:6'];
let valid = true;
for(let i = 0, len = messages.length; i < len; i++) {
let msg = messages[i].textContent;
is(!msg.contains(expected[i]), true, 'Found expected line:column of ' + expected[i])
}
is(valid, true, 'column numbers match expected results');
finishTest();
}

Просмотреть файл

@ -1,17 +0,0 @@
<!DOCTYPE HTML>
<html dir="ltr" xml:lang="en-US" lang="en-US">
<head>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<meta charset="utf-8">
<title>Console test</title>
<script type="text/javascript">
console.info("INLINE SCRIPT:"); console.log('Further');
console.warn("I'm warning you, he will eat up all yr bacon.");
console.error("Error Message");
console.log('Rainbooooww');
console.log('NYAN CATZ');
</script>
</head>
</html>

Просмотреть файл

@ -5,10 +5,7 @@
<title>Test for bugs 720180, 800510 and 865288</title>
<script>
function testConsole() {
// same line and column number
for(var i = 0; i < 2; i++) {
console.log("foo repeat");
}
console.log("foo repeat"); console.log("foo repeat");
console.log("foo repeat"); console.error("foo repeat");
}
function testConsoleObjects() {

Просмотреть файл

@ -1359,19 +1359,9 @@ WebConsoleFrame.prototype = {
{
// Warnings and legacy strict errors become warnings; other types become
// errors.
let severity = 'error';
let severity = SEVERITY_ERROR;
if (aScriptError.warning || aScriptError.strict) {
severity = 'warning';
}
let category = 'js';
switch(aCategory) {
case CATEGORY_CSS:
category = 'css';
break;
case CATEGORY_SECURITY:
category = 'security';
break;
severity = SEVERITY_WARNING;
}
let objectActors = new Set();
@ -1389,27 +1379,21 @@ WebConsoleFrame.prototype = {
errorMessage = errorMessage.initial;
}
// Create a new message
let msg = new Messages.Simple(errorMessage, {
location: {
url: aScriptError.sourceName,
line: aScriptError.lineNumber,
column: aScriptError.columnNumber
},
category: category,
severity: severity,
timestamp: aScriptError.timeStamp,
private: aScriptError.private,
filterDuplicates: true
});
let node = msg.init(this.output).render().element;
let node = this.createMessageNode(aCategory, severity,
errorMessage,
aScriptError.sourceName,
aScriptError.lineNumber, null, null,
aScriptError.timeStamp);
// Select the body of the message node that is displayed in the console
let msgBody = node.getElementsByClassName("message-body")[0];
// Add the more info link node to messages that belong to certain categories
this.addMoreInfoLink(msgBody, aScriptError);
if (aScriptError.private) {
node.setAttribute("private", true);
}
if (objectActors.size > 0) {
node._objectActors = objectActors;
}
@ -2577,8 +2561,7 @@ WebConsoleFrame.prototype = {
// right side of the message, if applicable.
let locationNode;
if (aSourceURL && IGNORED_SOURCE_URLS.indexOf(aSourceURL) == -1) {
locationNode = this.createLocationNode({url: aSourceURL,
line: aSourceLine});
locationNode = this.createLocationNode(aSourceURL, aSourceLine);
}
node.appendChild(timestampNode);
@ -2621,8 +2604,11 @@ WebConsoleFrame.prototype = {
* Creates the anchor that displays the textual location of an incoming
* message.
*
* @param object aLocation
* An object containing url, line and column number of the message source (destructured).
* @param string aSourceURL
* The URL of the source file responsible for the error.
* @param number aSourceLine [optional]
* The line number on which the error occurred. If zero or omitted,
* there is no line number associated with this message.
* @param string aTarget [optional]
* Tells which tool to open the link with, on click. Supported tools:
* jsdebugger, styleeditor, scratchpad.
@ -2630,10 +2616,10 @@ WebConsoleFrame.prototype = {
* The new anchor element, ready to be added to the message node.
*/
createLocationNode:
function WCF_createLocationNode({url, line, column}, aTarget)
function WCF_createLocationNode(aSourceURL, aSourceLine, aTarget)
{
if (!url) {
url = "";
if (!aSourceURL) {
aSourceURL = "";
}
let locationNode = this.document.createElementNS(XHTML_NS, "a");
let filenameNode = this.document.createElementNS(XHTML_NS, "span");
@ -2644,13 +2630,13 @@ WebConsoleFrame.prototype = {
let fullURL;
let isScratchpad = false;
if (/^Scratchpad\/\d+$/.test(url)) {
filename = url;
fullURL = url;
if (/^Scratchpad\/\d+$/.test(aSourceURL)) {
filename = aSourceURL;
fullURL = aSourceURL;
isScratchpad = true;
}
else {
fullURL = url.split(" -> ").pop();
fullURL = aSourceURL.split(" -> ").pop();
filename = WebConsoleUtils.abbreviateSourceURL(fullURL);
}
@ -2663,27 +2649,27 @@ WebConsoleFrame.prototype = {
if (aTarget) {
locationNode.target = aTarget;
}
locationNode.setAttribute("title", url);
locationNode.setAttribute("title", aSourceURL);
locationNode.className = "message-location theme-link devtools-monospace";
// Make the location clickable.
let onClick = () => {
let target = locationNode.target;
if (target == "scratchpad" || isScratchpad) {
this.owner.viewSourceInScratchpad(url);
this.owner.viewSourceInScratchpad(aSourceURL);
return;
}
let category = locationNode.parentNode.category;
if (target == "styleeditor" || category == CATEGORY_CSS) {
this.owner.viewSourceInStyleEditor(fullURL, line);
this.owner.viewSourceInStyleEditor(fullURL, aSourceLine);
}
else if (target == "jsdebugger" ||
category == CATEGORY_JS || category == CATEGORY_WEBDEV) {
this.owner.viewSourceInDebugger(fullURL, line);
this.owner.viewSourceInDebugger(fullURL, aSourceLine);
}
else {
this.owner.viewSource(fullURL, line);
this.owner.viewSource(fullURL, aSourceLine);
}
};
@ -2691,12 +2677,12 @@ WebConsoleFrame.prototype = {
this._addMessageLinkCallback(locationNode, onClick);
}
if (line) {
if (aSourceLine) {
let lineNumberNode = this.document.createElementNS(XHTML_NS, "span");
lineNumberNode.className = "line-number";
lineNumberNode.textContent = ":" + line + (column >= 0 ? ":" + column : "");
lineNumberNode.textContent = ":" + aSourceLine;
locationNode.appendChild(lineNumberNode);
locationNode.sourceLine = line;
locationNode.sourceLine = aSourceLine;
}
return locationNode;