summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/doc-message-run-to-completion.html
blob: db6aa0b0a0efed5f2db1fd0a71b72428f4494988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<iframe id="iframe" src="doc-message-run-to-completion-frame.html"></iframe>
<script>
function test() {
  var messageName = "test-message";

  function handleMessage(event) {
    // While paused here, the additional posted messages should not be delivered.
    // The debugger should pause three times.
    debugger;
  }

  window.addEventListener("message", handleMessage, true);
  document.getElementById("iframe").contentWindow.addEventListener("message", handleMessage, true);

  window.postMessage("first", "*");
  document.getElementById("iframe").contentWindow.postMessage("second", "*");
  window.postMessage("third", "*");
}
</script>