browser_perf-options-02-toggle-throw-alt.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 during a recording 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. const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
  10. add_task(function* () {
  11. let { panel } = yield initPerformanceInNewTab({
  12. url: SIMPLE_URL,
  13. win: window
  14. });
  15. let { DetailsView, JsCallTreeView } = panel.panelWin;
  16. yield DetailsView.selectView("js-calltree");
  17. yield startRecording(panel);
  18. // Manually call the _onPrefChanged function so we can catch an error.
  19. try {
  20. JsCallTreeView._onPrefChanged(null, "invert-call-tree", true);
  21. ok(true, "Toggling preferences during a recording should not fail.");
  22. } catch (e) {
  23. ok(false, "Toggling preferences during a recording should not fail.");
  24. }
  25. yield stopRecording(panel, {
  26. expectedViewClass: "JsCallTreeView",
  27. expectedViewEvent: "UI_JS_CALL_TREE_RENDERED"
  28. });
  29. yield teardownToolboxAndRemoveTab(panel);
  30. });