summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error.html
blob: 23180e6f9ed6e2ccb19326803c9e9c8c0c21a19d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script>
if (window.testRunner) {
  testRunner.dumpAsText()
  testRunner.waitUntilDone();
}

function log(msg) {
  var elmt = document.createElement("div");
  elmt.textContent = msg;
  document.body.appendChild(msg);
}

var timer = setInterval(function() {
  clearInterval(timer);
  setTimeout(function() {
    if (window.testRunner)
      testRunner.notifyDone();
  }, 10);

  // This function tries to appendChild to body, but body doesn't exist
  // yet, generating an error.  This test passes if we don't crash when
  // trying to add the error message to the console.
  log("PASS");
}, 10);
</script>