dom/events/test/test_bug489671.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug489671.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!doctype html>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=489671
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 489671</title>
    1.12 +  <script src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank"
    1.17 +   href="https://bugzilla.mozilla.org/show_bug.cgi?id=489671"
    1.18 +   >Mozilla Bug 489671</a>
    1.19 +<p id="display" onclick="queueNextTest(); throw 'Got click 1';"></p>
    1.20 +<script>
    1.21 +// override window.onerror so it won't see our exceptions
    1.22 +window.onerror = function() {}
    1.23 +
    1.24 +var testNum = 0;
    1.25 +function doTest() {
    1.26 +  switch(testNum++) {
    1.27 +    case 0:
    1.28 +      var event = document.createEvent("MouseEvents");
    1.29 +      event.initMouseEvent("click", true, true, document.defaultView,
    1.30 +                           0, 0, 0, 0, 0, false, false, false, false, 0, null);
    1.31 +      $("display").dispatchEvent(event);
    1.32 +      break;
    1.33 +    case 1:
    1.34 +      var script = document.createElement("script");
    1.35 +      script.textContent = "queueNextTest(); throw 'Got click 2'";
    1.36 +      document.body.appendChild(script);
    1.37 +      break;
    1.38 +    case 2:
    1.39 +      window.setTimeout("queueNextTest(); throw 'Got click 3'", 0);
    1.40 +      break;
    1.41 +    case 3:
    1.42 +      SimpleTest.endMonitorConsole();
    1.43 +      return;
    1.44 +  }
    1.45 +}
    1.46 +function queueNextTest() { SimpleTest.executeSoon(doTest); }
    1.47 +
    1.48 +SimpleTest.waitForExplicitFinish();
    1.49 +SimpleTest.monitorConsole(SimpleTest.finish, [
    1.50 +  { errorMessage: "uncaught exception: Got click 1" },
    1.51 +  { errorMessage: "uncaught exception: Got click 2" },
    1.52 +  { errorMessage: "uncaught exception: Got click 3" }
    1.53 +]);
    1.54 +
    1.55 +doTest();
    1.56 +</script>
    1.57 +</body>
    1.58 +</html>

mercurial