browser_wa_reset-04.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. //
  4. // Whitelisting this test.
  5. // As part of bug 1077403, the leaking uncaught rejection should be fixed.
  6. //
  7. thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Connection closed");
  8. /**
  9. * Tests that switching to an iframe works fine.
  10. */
  11. add_task(function* () {
  12. Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
  13. let { target, panel, toolbox } = yield initWebAudioEditor(IFRAME_CONTEXT_URL);
  14. let { gFront, $ } = panel.panelWin;
  15. is($("#reload-notice").hidden, false,
  16. "The 'reload this page' notice should initially be visible.");
  17. is($("#waiting-notice").hidden, true,
  18. "The 'waiting for an audio context' notice should initially be hidden.");
  19. is($("#content").hidden, true,
  20. "The tool's content should initially be hidden.");
  21. let btn = toolbox.doc.getElementById("command-button-frames");
  22. ok(!btn.firstChild, "The frame list button has no children");
  23. // Open frame menu and wait till it's available on the screen.
  24. let menu = toolbox.showFramesMenu({target: btn});
  25. yield once(menu, "open");
  26. let frames = menu.items;
  27. is(frames.length, 2, "We have both frames in the list");
  28. // Select the iframe
  29. frames[1].click();
  30. let navigating = once(target, "will-navigate");
  31. yield navigating;
  32. is($("#reload-notice").hidden, false,
  33. "The 'reload this page' notice should still be visible when switching to a frame.");
  34. is($("#waiting-notice").hidden, true,
  35. "The 'waiting for an audio context' notice should be kept hidden when switching to a frame.");
  36. is($("#content").hidden, true,
  37. "The tool's content should still be hidden.");
  38. navigating = once(target, "will-navigate");
  39. let started = once(gFront, "start-context");
  40. reload(target);
  41. yield Promise.all([navigating, started]);
  42. is($("#reload-notice").hidden, true,
  43. "The 'reload this page' notice should be hidden after reloading the frame.");
  44. is($("#waiting-notice").hidden, true,
  45. "The 'waiting for an audio context' notice should be hidden after reloading the frame.");
  46. is($("#content").hidden, false,
  47. "The tool's content should appear after reload.");
  48. yield teardown(target);
  49. });