зеркало из https://github.com/mozilla/gecko-dev.git
Bug 923281 - Console filter output does not match source filenames; r=msucan
This commit is contained in:
Родитель
9a0c2ce901
Коммит
5179afc10a
|
@ -94,6 +94,9 @@ support-files =
|
|||
test_bug_770099_violation.html
|
||||
test_bug_770099_violation.html^headers^
|
||||
testscript.js
|
||||
test-bug_923281_console_log_filter.html
|
||||
test-bug_923281_test1.js
|
||||
test-bug_923281_test2.js
|
||||
|
||||
[browser_bug664688_sandbox_update_after_navigation.js]
|
||||
[browser_bug_638949_copy_link_location.js]
|
||||
|
@ -231,3 +234,4 @@ support-files =
|
|||
[browser_webconsole_property_provider.js]
|
||||
[browser_webconsole_scratchpad_panel_link.js]
|
||||
[browser_webconsole_view_source.js]
|
||||
[browser_webconsole_log_file_filter.js]
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that the text filter box works to filter based on filenames
|
||||
// where the logs were generated.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug_923281_console_log_filter.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;
|
||||
let console = content.console;
|
||||
console.log("sentinel log");
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "sentinel log",
|
||||
category: CATEGORY_WEBDEV,
|
||||
severity: SEVERITY_LOG
|
||||
}],
|
||||
}).then(testLiveFilteringOnSearchStrings);
|
||||
}
|
||||
|
||||
function testLiveFilteringOnSearchStrings() {
|
||||
is(hud.outputNode.children.length, 4, "number of messages");
|
||||
|
||||
setStringFilter("random");
|
||||
is(countMessageNodes(), 1, "the log nodes not containing string " +
|
||||
"\"random\" are hidden");
|
||||
|
||||
setStringFilter("test2.js");
|
||||
is(countMessageNodes(), 2, "show only log nodes containing string " +
|
||||
"\"test2.js\" or log nodes created from files with filename " +
|
||||
"containing \"test2.js\" as substring.");
|
||||
|
||||
setStringFilter("test1");
|
||||
is(countMessageNodes(), 2, "show only log nodes containing string " +
|
||||
"\"test1\" or log nodes created from files with filename " +
|
||||
"containing \"test1\" as substring.");
|
||||
|
||||
setStringFilter("");
|
||||
is(countMessageNodes(), 4, "show all log nodes on setting filter string " +
|
||||
"as \"\".");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let outputNode = hud.outputNode;
|
||||
|
||||
let messageNodes = outputNode.querySelectorAll(".message");
|
||||
content.console.log(messageNodes.length);
|
||||
let displayedMessageNodes = 0;
|
||||
let view = hud.iframeWindow;
|
||||
for (let i = 0; i < messageNodes.length; i++) {
|
||||
let computedStyle = view.getComputedStyle(messageNodes[i], null);
|
||||
if (computedStyle.display !== "none") {
|
||||
displayedMessageNodes++;
|
||||
}
|
||||
}
|
||||
|
||||
return displayedMessageNodes;
|
||||
}
|
||||
|
||||
function setStringFilter(aValue)
|
||||
{
|
||||
hud.ui.filterBox.value = aValue;
|
||||
hud.ui.adjustVisibilityOnSearchStringChange();
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Console test</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<script type="text/javascript" src="test-bug_923281_test1.js"></script>
|
||||
<script type="text/javascript" src="test-bug_923281_test2.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
console.log("Sample log.");
|
||||
console.log("This log should be filtered when filtered for test2.js.");
|
|
@ -0,0 +1,4 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
console.log("This is a random text.");
|
|
@ -873,7 +873,7 @@ WebConsoleFrame.prototype = {
|
|||
let node = nodes[i];
|
||||
|
||||
// hide nodes that match the strings
|
||||
let text = node.clipboardText;
|
||||
let text = node.textContent;
|
||||
|
||||
// if the text matches the words in aSearchString...
|
||||
if (this.stringMatchesFilters(text, searchString)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче