js/xpconnect/tests/mochitest/test_bug986542.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/test_bug986542.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=986542
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 986542</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for Bug 986542 **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +  addLoadEvent(function() {
    1.19 +    var ifr = document.getElementById("ifr");
    1.20 +    var doc = ifr.contentDocument;
    1.21 +    var scr = doc.createElement("script");
    1.22 +    scr.textContent = "function f() { onF(); }";
    1.23 +    ifr.contentWindow.onF = function() {
    1.24 +      ok(true, "Called event handler in detached window");
    1.25 +      SimpleTest.finish();
    1.26 +    }
    1.27 +    doc.body.appendChild(scr);
    1.28 +    var target = document.getElementById("target");
    1.29 +    target.onclick = ifr.contentWindow.f;
    1.30 +    ifr.parentNode.removeChild(ifr);
    1.31 +    info("Removed frame from document. Waiting for event handler to be called.");
    1.32 +    target.dispatchEvent(new MouseEvent('click'));
    1.33 +  });
    1.34 +
    1.35 +  </script>
    1.36 +</head>
    1.37 +<body>
    1.38 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=986542">Mozilla Bug 986542</a>
    1.39 +<p id="display"></p>
    1.40 +<div id="content" style="display: none">
    1.41 +
    1.42 +</div>
    1.43 +<div id="target"></div>
    1.44 +<iframe id="ifr"></iframe>
    1.45 +<pre id="test">
    1.46 +</pre>
    1.47 +</body>
    1.48 +</html>

mercurial