browser_dbg_sources-iframe-reload.js 1019 B

1234567891011121314151617181920212223242526272829303132333435
  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 iframe scripts don't disappear after few reloads (bug 1259743)
  6. */
  7. "use strict";
  8. const IFRAME_URL = "data:text/html;charset=utf-8," +
  9. "<script>function fn() { console.log('hello'); }</script>" +
  10. "<div onclick='fn()'>hello</div>";
  11. const TAB_URL = `data:text/html;charset=utf-8,<iframe src="${IFRAME_URL}"/>`;
  12. add_task(function* () {
  13. let [,, panel] = yield initDebugger();
  14. let dbg = panel.panelWin;
  15. let newSource;
  16. newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
  17. reload(panel, TAB_URL);
  18. yield newSource;
  19. ok(true, "Source event fired on initial load");
  20. for (let i = 0; i < 5; i++) {
  21. newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
  22. reload(panel);
  23. yield newSource;
  24. ok(true, `Source event fired after ${i + 1} reloads`);
  25. }
  26. yield closeDebuggerAndFinish(panel);
  27. });