Bug 1331007 - fix console debug filter persistence;r=nchevobbe
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 02 Feb 2017 20:32:39 +0100
changeset 378972 1b1fc1efce0ec95e111ac3b2183abf0ba14db83a
parent 378971 b0d575ddcf73415660785b9d2f5c2da5cac4d776
child 378973 35967a21613ea7f0a6aca96a4042d7a2d8fdcccf
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1331007
milestone54.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 1331007 - fix console debug filter persistence;r=nchevobbe MozReview-Commit-ID: AvenpwUn9YU
devtools/client/webconsole/new-console-output/store.js
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_filters_persist.js
--- a/devtools/client/webconsole/new-console-output/store.js
+++ b/devtools/client/webconsole/new-console-output/store.js
@@ -24,16 +24,17 @@ function configureStore() {
   const initialState = {
     prefs: new PrefState({
       logLimit: Math.max(Services.prefs.getIntPref("devtools.hud.loglimit"), 1),
     }),
     filters: new FilterState({
       error: Services.prefs.getBoolPref(PREFS.FILTER.ERROR),
       warn: Services.prefs.getBoolPref(PREFS.FILTER.WARN),
       info: Services.prefs.getBoolPref(PREFS.FILTER.INFO),
+      debug: Services.prefs.getBoolPref(PREFS.FILTER.DEBUG),
       log: Services.prefs.getBoolPref(PREFS.FILTER.LOG),
       css: Services.prefs.getBoolPref(PREFS.FILTER.CSS),
       net: Services.prefs.getBoolPref(PREFS.FILTER.NET),
       netxhr: Services.prefs.getBoolPref(PREFS.FILTER.NETXHR),
     }),
     ui: new UiState({
       filterBarVisible: Services.prefs.getBoolPref(PREFS.UI.FILTER_BAR),
     })
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -25,16 +25,17 @@ subsuite = clipboard
 skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
 [browser_webconsole_context_menu_copy_link_location.js]
 subsuite = clipboard
 skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
 [browser_webconsole_context_menu_open_in_var_view.js]
 [browser_webconsole_context_menu_open_url.js]
 [browser_webconsole_context_menu_store_as_global.js]
 [browser_webconsole_filters.js]
+[browser_webconsole_filters_persist.js]
 [browser_webconsole_init.js]
 [browser_webconsole_input_focus.js]
 [browser_webconsole_keyboard_accessibility.js]
 [browser_webconsole_location_debugger_link.js]
 [browser_webconsole_location_scratchpad_link.js]
 [browser_webconsole_location_styleeditor_link.js]
 [browser_webconsole_nodes_highlight.js]
 [browser_webconsole_observer_notifications.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_filters_persist.js
@@ -0,0 +1,72 @@
+/* -*- 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/ */
+
+// Tests all filters persist.
+
+"use strict";
+
+const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-console-filters.html";
+
+add_task(function* () {
+  let hud = yield openNewTabAndConsole(TEST_URI);
+
+  let filterButtons = yield getFilterButtons(hud);
+  info("Disable all filters");
+  filterButtons.forEach(filterButton => {
+    if (filterIsEnabled(filterButton)) {
+      filterButton.click();
+    }
+  });
+
+  info("Close and re-open the console");
+  yield closeTabAndToolbox();
+  hud = yield openNewTabAndConsole(TEST_URI);
+
+  info("Check that all filters are disabled, and enable them");
+  filterButtons = yield getFilterButtons(hud);
+  filterButtons.forEach(filterButton => {
+    ok(!filterIsEnabled(filterButton), "filter is disabled");
+    filterButton.click();
+  });
+
+  info("Close and re-open the console");
+  yield closeTabAndToolbox();
+  hud = yield openNewTabAndConsole(TEST_URI);
+
+  info("Check that all filters are enabled");
+  filterButtons = yield getFilterButtons(hud);
+  filterButtons.forEach(filterButton => {
+    ok(filterIsEnabled(filterButton), "filter is enabled");
+  });
+
+  // Check that the ui settings were persisted.
+  yield closeTabAndToolbox();
+});
+
+function* getFilterButtons(hud) {
+  const outputNode = hud.ui.experimentalOutputNode;
+
+  info("Wait for console toolbar to appear");
+  const toolbar = yield waitFor(() => {
+    return outputNode.querySelector(".webconsole-filterbar-primary");
+  });
+
+  // Show the filter bar if it is hidden
+  if (!outputNode.querySelector(".webconsole-filterbar-secondary")) {
+    toolbar.querySelector(".devtools-filter-icon").click();
+  }
+
+  info("Wait for console filterbar to appear");
+  const filterBar = yield waitFor(() => {
+    return outputNode.querySelector(".webconsole-filterbar-secondary");
+  });
+  ok(filterBar, "Filter bar is shown when filter icon is clicked.");
+
+  return filterBar.querySelectorAll(".menu-filter-button");
+}
+
+function filterIsEnabled(button) {
+  return button.classList.contains("checked");
+}