Backed out changeset 671011b82100 (bug 659625)
This commit is contained in:
@@ -107,11 +107,6 @@ timerStarted=%S: timer started
|
||||
# is the number of milliseconds.
|
||||
timeEnd=%1$S: %2$Sms
|
||||
|
||||
# LOCALIZATION NOTE (consoleCleared): this string is displayed when receiving a
|
||||
# call to console.clear() to let the user know the previous messages of the
|
||||
# console have been removed programmatically.
|
||||
consoleCleared=Console was cleared.
|
||||
|
||||
# LOCALIZATION NOTE (noCounterLabel): this string is used to display
|
||||
# count-messages with no label provided.
|
||||
noCounterLabel=<no label>
|
||||
|
||||
@@ -93,7 +93,6 @@ const CONSOLE_API_LEVELS_TO_SEVERITIES = {
|
||||
warn: "warning",
|
||||
info: "info",
|
||||
log: "log",
|
||||
clear: "log",
|
||||
trace: "log",
|
||||
table: "log",
|
||||
debug: "log",
|
||||
|
||||
@@ -69,7 +69,6 @@ support-files =
|
||||
test-closure-optimized-out.html
|
||||
test-closures.html
|
||||
test-console-assert.html
|
||||
test-console-clear.html
|
||||
test-console-count.html
|
||||
test-console-count-external-file.js
|
||||
test-console-extras.html
|
||||
@@ -158,7 +157,6 @@ skip-if = (e10s && (os == 'win' || os == 'mac')) # Bug 1243976
|
||||
[browser_cached_messages.js]
|
||||
[browser_console.js]
|
||||
[browser_console_addonsdk_loader_exception.js]
|
||||
[browser_console_clear_method.js]
|
||||
[browser_console_clear_on_reload.js]
|
||||
[browser_console_click_focus.js]
|
||||
[browser_console_consolejsm_output.js]
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/* -*- 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/ */
|
||||
|
||||
// Check that calls to console.clear from a script delete the messages
|
||||
// previously logged.
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/test-console-clear.html";
|
||||
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield openConsole();
|
||||
ok(hud, "Web Console opened");
|
||||
|
||||
info("Check the console.clear() done on page load has been processed.");
|
||||
yield waitForLog("Console was cleared", hud);
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log1"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log2"), "log2 not displayed");
|
||||
|
||||
info("Logging two messages log3, log4");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.log("log3");
|
||||
content.wrappedJSObject.console.log("log4");
|
||||
});
|
||||
|
||||
yield waitForLog("log3", hud);
|
||||
yield waitForLog("log4", hud);
|
||||
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
ok(hud.outputNode.textContent.includes("log3"), "log3 is displayed");
|
||||
ok(hud.outputNode.textContent.includes("log4"), "log4 is displayed");
|
||||
|
||||
info("Open the variables view sidebar for 'objFromPage'");
|
||||
yield openSidebar("objFromPage", { a: 1 }, hud);
|
||||
let sidebarClosed = hud.jsterm.once("sidebar-closed");
|
||||
|
||||
info("Call console.clear from the page");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.clear();
|
||||
});
|
||||
|
||||
// Cannot wait for "Console was cleared" here because such a message is
|
||||
// already present and would yield immediately.
|
||||
info("Wait for variables view sidebar to be closed after console.clear()");
|
||||
yield sidebarClosed;
|
||||
|
||||
ok(!hud.outputNode.textContent.includes("log3"), "log3 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log4"), "log4 not displayed");
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
is(hud.outputNode.textContent.split("Console was cleared").length, 2,
|
||||
"console.clear() message is only displayed once");
|
||||
|
||||
info("Logging one messages log5");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.log("log5");
|
||||
});
|
||||
yield waitForLog("log5", hud);
|
||||
|
||||
info("Close and reopen the webconsole.");
|
||||
yield closeConsole(gBrowser.selectedTab);
|
||||
hud = yield openConsole();
|
||||
yield waitForLog("Console was cleared", hud);
|
||||
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log1"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log2"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log3"), "log3 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log4"), "log4 not displayed");
|
||||
ok(hud.outputNode.textContent.includes("log5"), "log5 still displayed");
|
||||
});
|
||||
|
||||
/**
|
||||
* Wait for a single message to be logged in the provided webconsole instance
|
||||
* with the category CATEGORY_WEBDEV and the SEVERITY_LOG severity.
|
||||
*
|
||||
* @param {String} message
|
||||
* The expected messaged.
|
||||
* @param {WebConsole} webconsole
|
||||
* WebConsole instance in which the message should be logged.
|
||||
*/
|
||||
function* waitForLog(message, webconsole, options) {
|
||||
yield waitForMessages({
|
||||
webconsole: webconsole,
|
||||
messages: [{
|
||||
text: message,
|
||||
category: CATEGORY_WEBDEV,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the variables view sidebar for the object with the provided name objName
|
||||
* and wait for the expected object is displayed in the variables view.
|
||||
*
|
||||
* @param {String} objName
|
||||
* The name of the object to open in the sidebar.
|
||||
* @param {Object} expectedObj
|
||||
* The properties that should be displayed in the variables view.
|
||||
* @param {WebConsole} webconsole
|
||||
* WebConsole instance in which the message should be logged.
|
||||
*
|
||||
*/
|
||||
function* openSidebar(objName, expectedObj, webconsole) {
|
||||
let msg = yield webconsole.jsterm.execute(objName);
|
||||
ok(msg, "output message found");
|
||||
|
||||
let anchor = msg.querySelector("a");
|
||||
let body = msg.querySelector(".message-body");
|
||||
ok(anchor, "object anchor");
|
||||
ok(body, "message body");
|
||||
|
||||
yield EventUtils.synthesizeMouse(anchor, 2, 2, {}, webconsole.iframeWindow);
|
||||
|
||||
let vviewVar = yield webconsole.jsterm.once("variablesview-fetched");
|
||||
let vview = vviewVar._variablesView;
|
||||
ok(vview, "variables view object exists");
|
||||
|
||||
yield findVariableViewProperties(vviewVar, [
|
||||
expectedObj,
|
||||
], { webconsole: webconsole });
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Console.clear() tests</title>
|
||||
<script type="text/javascript">
|
||||
console.log("log1");
|
||||
console.log("log2");
|
||||
console.clear();
|
||||
|
||||
window.objFromPage = { a: 1 };
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="header">Clear Demo</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -142,7 +142,6 @@ const LEVELS = {
|
||||
warn: SEVERITY_WARNING,
|
||||
info: SEVERITY_INFO,
|
||||
log: SEVERITY_LOG,
|
||||
clear: SEVERITY_LOG,
|
||||
trace: SEVERITY_LOG,
|
||||
table: SEVERITY_LOG,
|
||||
debug: SEVERITY_LOG,
|
||||
@@ -1286,11 +1285,6 @@ WebConsoleFrame.prototype = {
|
||||
node = msg.init(this.output).render().element;
|
||||
break;
|
||||
}
|
||||
case "clear": {
|
||||
body = l10n.getStr("consoleCleared");
|
||||
clipboardText = body;
|
||||
break;
|
||||
}
|
||||
case "dir": {
|
||||
body = { arguments: args };
|
||||
let clipboardArray = [];
|
||||
@@ -2209,14 +2203,6 @@ WebConsoleFrame.prototype = {
|
||||
|
||||
let isRepeated = this._filterRepeatedMessage(node);
|
||||
|
||||
// If a clear message is processed while the webconsole is opened, the UI
|
||||
// should be cleared.
|
||||
if (message && message.level == "clear") {
|
||||
// Do not clear the consoleStorage here as it has been cleared already
|
||||
// by the clear method, only clear the UI.
|
||||
this.jsterm.clearOutput(false);
|
||||
}
|
||||
|
||||
let visible = !isRepeated && !isFiltered;
|
||||
if (!isRepeated) {
|
||||
this.outputNode.appendChild(node);
|
||||
|
||||
Reference in New Issue
Block a user