Bug 1419358 - Never filter-out navigation markers message. r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Tue, 21 May 2019 12:42:34 +0000
changeset 474715 be01ec66f386d44d59fc56ab904a84c299521177
parent 474714 4039c6761d62239b4e55691f381cf2953969dcca
child 474716 78571bb1f20e643cdab9791f61b0aa7b6a8bdf90
push id36044
push userrmaries@mozilla.com
push dateTue, 21 May 2019 15:45:34 +0000
treeherdermozilla-central@78571bb1f20e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1419358
milestone69.0a1
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
Bug 1419358 - Never filter-out navigation markers message. r=Honza. Differential Revision: https://phabricator.services.mozilla.com/D31219
devtools/client/webconsole/reducers/messages.js
devtools/client/webconsole/test/mochitest/browser.ini
devtools/client/webconsole/test/mochitest/browser_webconsole_filter_navigation_marker.js
devtools/client/webconsole/test/mochitest/head.js
--- a/devtools/client/webconsole/reducers/messages.js
+++ b/devtools/client/webconsole/reducers/messages.js
@@ -886,16 +886,17 @@ function getMessageVisibility(message, {
 }
 
 function isUnfilterable(message) {
   return [
     MESSAGE_TYPE.COMMAND,
     MESSAGE_TYPE.RESULT,
     MESSAGE_TYPE.START_GROUP,
     MESSAGE_TYPE.START_GROUP_COLLAPSED,
+    MESSAGE_TYPE.NAVIGATION_MARKER,
   ].includes(message.type);
 }
 
 function isInOpenedGroup(message, groupsById, messagesUI) {
   return !message.groupId
     || (
       !isGroupClosed(message.groupId, messagesUI)
       && !hasClosedParentGroup(groupsById.get(message.groupId), messagesUI)
--- a/devtools/client/webconsole/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/test/mochitest/browser.ini
@@ -303,16 +303,17 @@ tags = clipboard
 [browser_webconsole_eval_in_debugger_stackframe2.js]
 [browser_webconsole_eval_sources.js]
 [browser_webconsole_execution_scope.js]
 [browser_webconsole_external_script_errors.js]
 [browser_webconsole_file_uri.js]
 skip-if = true #	Bug 1404382
 [browser_webconsole_filter_by_input.js]
 [browser_webconsole_filter_by_regex_input.js]
+[browser_webconsole_filter_navigation_marker.js]
 [browser_webconsole_filter_scroll.js]
 [browser_webconsole_filters.js]
 [browser_webconsole_filters_persist.js]
 [browser_webconsole_highlighter_console_helper.js]
 [browser_webconsole_hpkp_invalid-headers.js]
 [browser_webconsole_hsts_invalid-headers.js]
 [browser_webconsole_iframe_wrong_hud.js]
 [browser_webconsole_ineffective_iframe_sandbox_warning.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_filter_navigation_marker.js
@@ -0,0 +1,40 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test that filters don't affect navigation markers.
+
+"use strict";
+
+const TEST_URI = `data:text/html;charset=utf-8,
+  <p>Web Console test for navigation marker filtering.</p>
+  <script>console.log("hello " + "world");</script>`;
+
+add_task(async function() {
+  // Enable persist log
+  await pushPref("devtools.webconsole.persistlog", true);
+
+  const hud = await openNewTabAndConsole(TEST_URI);
+  await waitFor(() => findMessage(hud, "hello world"));
+
+  info("Reload the page");
+  const onInitMessage = waitForMessage(hud, "hello world");
+  ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
+    content.location.reload();
+  });
+  await onInitMessage;
+
+  // Wait for the navigation message to be displayed.
+  await waitFor(() => findMessage(hud, "Navigated to"));
+
+  info("disable all filters and set a text filter that doesn't match anything");
+  await setFilterState(hud, {
+    error: false,
+    warn: false,
+    log: false,
+    info: false,
+    text: "qwqwqwqwqwqw",
+  });
+
+  await waitFor(() => !findMessage(hud, "hello world"));
+  ok(findMessage(hud, "Navigated to"), "The navigation marker is still visible");
+});
--- a/devtools/client/webconsole/test/mochitest/head.js
+++ b/devtools/client/webconsole/test/mochitest/head.js
@@ -956,17 +956,18 @@ function getFilterInput(hud) {
  *          {
  *            error: true,
  *            warn: true,
  *            log: true,
  *            info: true,
  *            debug: true,
  *            css: false,
  *            netxhr: false,
- *            net: false
+ *            net: false,
+ *            text: ""
  *          }
  */
 async function setFilterState(hud, settings) {
   const {outputNode} = hud.ui;
   const filterBar = outputNode.querySelector(".webconsole-filterbar-secondary");
 
   for (const category in settings) {
     const value = settings[category];