browser_perf-options-01-toggle-throw.js 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests that toggling preferences before there are any recordings does not throw.
  6. */
  7. const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
  8. const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
  9. add_task(function* () {
  10. let { panel } = yield initPerformanceInNewTab({
  11. url: SIMPLE_URL,
  12. win: window
  13. });
  14. let { DetailsView, JsCallTreeView } = panel.panelWin;
  15. yield DetailsView.selectView("js-calltree");
  16. // Manually call the _onPrefChanged function so we can catch an error.
  17. try {
  18. JsCallTreeView._onPrefChanged(null, "invert-call-tree", true);
  19. ok(true, "Toggling preferences before there are any recordings should not fail.");
  20. } catch (e) {
  21. ok(false, "Toggling preferences before there are any recordings should not fail.");
  22. }
  23. yield teardownToolboxAndRemoveTab(panel);
  24. });