browser_dbg_conditional-breakpoints-04.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. /**
  5. * Make sure that conditional breakpoints with blank expressions
  6. * maintain their conditions after enabling them.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_conditional-breakpoints.html";
  9. function test() {
  10. let options = {
  11. source: TAB_URL,
  12. line: 1
  13. };
  14. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  15. const gTab = aTab;
  16. const gPanel = aPanel;
  17. const gDebugger = gPanel.panelWin;
  18. const gSources = gDebugger.DebuggerView.Sources;
  19. const queries = gDebugger.require("./content/queries");
  20. const constants = gDebugger.require("./content/constants");
  21. const actions = bindActionCreators(gPanel);
  22. const getState = gDebugger.DebuggerController.getState;
  23. // This test forces conditional breakpoints to be evaluated on the
  24. // client-side
  25. var client = gPanel.target.client;
  26. client.mainRoot.traits.conditionalBreakpoints = false;
  27. Task.spawn(function* () {
  28. let onCaretUpdated = waitForCaretAndScopes(gPanel, 17);
  29. callInTab(gTab, "ermahgerd");
  30. yield onCaretUpdated;
  31. const location = { actor: gSources.selectedValue, line: 18 };
  32. yield actions.addBreakpoint(location, "");
  33. yield actions.disableBreakpoint(location);
  34. yield actions.addBreakpoint(location);
  35. const bp = queries.getBreakpoint(getState(), location);
  36. is(bp.condition, "", "The conditional expression is correct.");
  37. // Reset traits back to default value
  38. client.mainRoot.traits.conditionalBreakpoints = true;
  39. resumeDebuggerThenCloseAndFinish(gPanel);
  40. });
  41. });
  42. }