dom/events/test/test_bug322588.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug322588.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=322588
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 322588 - onBlur window close no longer works</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=322588">Mozilla Bug 322588 - onBlur window close no longer works</a>
    1.17 +<p id="display">
    1.18 +<a id="link" href="javascript:pop350d('bug322588-popup.html#target')">Openwindow</a><br>
    1.19 +The opened window should not directly close when clicking on the Openwindow link
    1.20 +</p>
    1.21 +<div id="content" style="display: none">
    1.22 +  
    1.23 +</div>
    1.24 +<pre id="test">
    1.25 +<script type="application/javascript">
    1.26 +
    1.27 +/** Test for Bug 322588 **/
    1.28 +
    1.29 +var result = "";
    1.30 +
    1.31 +var w;
    1.32 +function pop350d(url) {
    1.33 +  w = window.open();
    1.34 +  w.addEventListener("unload", function () { result += " unload";}, false);
    1.35 +  w.addEventListener("load", function () { result += " load"; setTimeout(done, 1000);}, false);
    1.36 +  w.addEventListener("blur", function () { result += " blur";}, false);
    1.37 +  w.location = url;
    1.38 +}
    1.39 +
    1.40 +function doTest() {
    1.41 +  try {
    1.42 +    sendMouseEvent({type:'click'}, 'link');
    1.43 +  } catch(e) {
    1.44 +    if (w)
    1.45 +      w.close();
    1.46 +    throw e;
    1.47 +  }
    1.48 +}
    1.49 +
    1.50 +function done() {
    1.51 +  is(result," unload load","unexpected events"); // The first unload is for about:blank
    1.52 +  if (w)
    1.53 +    w.close();
    1.54 +  SimpleTest.finish();
    1.55 +}
    1.56 +
    1.57 +SimpleTest.waitForExplicitFinish();
    1.58 +addLoadEvent(doTest);
    1.59 +
    1.60 +
    1.61 +</script>
    1.62 +</pre>
    1.63 +</body>
    1.64 +</html>

mercurial