author | Dave Herman <dherman@mozilla.com> |
Fri, 08 Apr 2011 10:30:19 -0700 | |
changeset 67615 | 2ea06ff58dbe6299d60e734c4fde05e5b9542d2f |
parent 67614 | ce7276f42938df8a83b0556a70473fefe808c7c4 |
child 67616 | 3578f5b22f6b1af5225ac390d0c8e029c8d1d279 |
push id | 1 |
push user | root |
push date | Tue, 26 Apr 2011 22:38:44 +0000 |
treeherder | mozilla-beta@bfdb6e623a36 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gavin, rcampbell |
bugs | 637801 |
milestone | 2.2a1pre |
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
|
--- a/toolkit/components/console/hudservice/HUDService.jsm +++ b/toolkit/components/console/hudservice/HUDService.jsm @@ -1973,18 +1973,20 @@ HUD_SERVICE.prototype = * @return void */ logConsoleAPIMessage: function HS_logConsoleAPIMessage(aHUDId, aLevel, aArguments) { // Pipe the message to createMessageNode(). let hud = HUDService.hudReferences[aHUDId]; - let mappedArguments = Array.map(aArguments, hud.jsterm.formatResult, - hud.jsterm); + function formatResult(x) { + return (typeof(x) == "string") ? x : hud.jsterm.formatResult(x); + } + let mappedArguments = Array.map(aArguments, formatResult); let joinedArguments = Array.join(mappedArguments, " "); let node = ConsoleUtils.createMessageNode(hud.outputNode.ownerDocument, CATEGORY_WEBDEV, LEVELS[aLevel], joinedArguments); ConsoleUtils.outputMessageNode(node, aHUDId); },
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_598357_jsterm_output.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_598357_jsterm_output.js @@ -12,17 +12,17 @@ const TEST_URI = "http://example.com/bro let testEnded = false; let pos = -1; let dateNow = Date.now(); let inputValues = [ // [showsPropertyPanel?, input value, expected output format, - // print() output, optional console API test] + // print() output, console output, optional console API test] // 0 [false, "'hello \\nfrom \\rthe \\\"string world!'", '"hello \\nfrom \\rthe \\"string world!"', "hello \nfrom \rthe \"string world!"], // 1 [false, "'\xFA\u1E47\u0129\xE7\xF6d\xEA \u021B\u0115\u0219\u0165'", @@ -54,39 +54,44 @@ let inputValues = [ [false, "undefined", "undefined"], // 10 [false, "true", "true"], // 11 [false, "document.getElementById", "function getElementById() {[native code]}", "function getElementById() {\n [native code]\n}", + "function getElementById() {[native code]}", "document.wrappedJSObject.getElementById"], // 12 [false, "function() { return 42; }", "function () {return 42;}", - "function () {\n return 42;\n}"], + "function () {\n return 42;\n}", + "(function () {return 42;})"], // 13 [false, "new Date(" + dateNow + ")", (new Date(dateNow)).toString()], // 14 [true, "document.body", "[object HTMLBodyElement", "[object HTMLBodyElement", + "[object HTMLBodyElement", "document.wrappedJSObject.body"], // 15 [true, "window.location", TEST_URI], // 16 [true, "[1,2,3,'a','b','c','4','5']", '[1, 2, 3, "a", "b", "c", "4", "5"]', - '1,2,3,a,b,c,4,5'], + '1,2,3,a,b,c,4,5', + '[1, 2, 3, "a", "b", "c", "4", "5"]'], // 17 [true, "({a:'b', c:'d', e:1, f:'2'})", '({a:"b", c:"d", e:1, f:"2"})', - "[object Object"], + "[object Object", + '({a:"b", c:"d", e:1, f:"2"})'], ]; let eventHandlers = []; let popupShown = []; function tabLoad(aEvent) { browser.removeEventListener(aEvent.type, arguments.callee, true); @@ -111,30 +116,33 @@ function testNext() { let showsPropertyPanel = inputValues[cpos][0]; let inputValue = inputValues[cpos][1]; let expectedOutput = inputValues[cpos][2]; let printOutput = inputValues[cpos].length >= 4 ? inputValues[cpos][3] : expectedOutput; - let consoleTest = inputValues[cpos][4] || inputValue; + let consoleOutput = inputValues[cpos].length >= 5 ? + inputValues[cpos][4] : printOutput; + + let consoleTest = inputValues[cpos][5] || inputValue; HUD.jsterm.clearOutput(); // Ugly but it does the job. with (content) { eval("HUD.console.log(" + consoleTest + ")"); } let outputItem = HUD.outputNode. querySelector(".hud-log:last-child"); ok(outputItem, "found the window.console output line for inputValues[" + cpos + "]"); - ok(outputItem.textContent.indexOf(expectedOutput) > -1, + ok(outputItem.textContent.indexOf(consoleOutput) > -1, "console API output is correct for inputValues[" + cpos + "]"); HUD.jsterm.clearOutput(); HUD.jsterm.setInputValue("print(" + inputValue + ")"); HUD.jsterm.execute(); outputItem = HUD.outputNode.querySelector(".webconsole-msg-output:" +
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_console_logging_api.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_console_logging_api.js @@ -97,17 +97,17 @@ function testConsoleLoggingAPI(aMethod) HUDService.clearDisplay(hudId); setStringFilter(hudId, ""); // test for multiple arguments. console[aMethod]("foo", "bar"); let node = outputNode.querySelector(".hud-msg-node"); - ok(/"foo" "bar"/.test(node.textContent), + ok(/foo bar/.test(node.textContent), "Emitted both console arguments"); } function setStringFilter(aId, aValue) { let hudBox = HUDService.getHeadsUpDisplay(aId); hudBox.querySelector(".hud-filter-box").value = aValue; HUDService.adjustVisibilityOnSearchStringChange(aId, aValue); }
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_output_order.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_output_order.js @@ -64,17 +64,17 @@ function testOutputOrder() { let nodes = outputNode.querySelectorAll(".hud-msg-node"); is(nodes.length, 3, "3 children in output"); let executedStringFirst = /console\.log\('foo', 'bar'\);/.test(nodes[0].textContent); let outputSecond = - /"foo" "bar"/.test(nodes[1].textContent); + /foo bar/.test(nodes[1].textContent); ok(executedStringFirst && outputSecond, "executed string comes first"); jsterm.clearOutput(); jsterm.history.splice(0); // workaround for bug 592552 finishTest(); }