browser_dbg_blackboxing-07.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * Test that if we unblackbox a source which has been automatically blackboxed
  6. * and then refresh, it is still unblackboxed.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_blackboxing_unblackbox.html";
  9. var gTab, gPanel, gDebugger;
  10. function test() {
  11. let options = {
  12. source: EXAMPLE_URL + "code_blackboxing_unblackbox.min.js",
  13. };
  14. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  15. gTab = aTab;
  16. gPanel = aPanel;
  17. gDebugger = gPanel.panelWin;
  18. testBlackBoxSource()
  19. .then(testBlackBoxReload)
  20. .then(() => closeDebuggerAndFinish(gPanel))
  21. .then(null, aError => {
  22. ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
  23. });
  24. });
  25. }
  26. function testBlackBoxSource() {
  27. const bbButton = getBlackBoxButton(gPanel);
  28. ok(bbButton.checked, "Should be black boxed by default");
  29. return toggleBlackBoxing(gPanel).then(aSource => {
  30. ok(!aSource.isBlackBoxed, "The source should no longer be blackboxed.");
  31. });
  32. }
  33. function testBlackBoxReload() {
  34. return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
  35. const selectedSource = getSelectedSourceElement(gPanel);
  36. ok(!selectedSource.isBlackBoxed, "The source should not be blackboxed.");
  37. });
  38. }
  39. registerCleanupFunction(function () {
  40. gTab = null;
  41. gPanel = null;
  42. gDebugger = null;
  43. });