docshell/test/navigation/test_bug279495.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/navigation/test_bug279495.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +    <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     1.8 +    <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     1.9 +    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +    <script type="text/javascript" src="NavigationUtils.js"></script>
    1.11 +<script>
    1.12 +window.onload = function () {
    1.13 +  document.getElementById("link0").href = target_url;
    1.14 +  document.getElementById("link1").href = target_url;
    1.15 +
    1.16 +  sendMouseEvent({type:"click"}, "link0");
    1.17 +  sendMouseEvent({type:"click"}, "link1");
    1.18 +
    1.19 +  xpcWaitForFinishedFrames(function() {
    1.20 +    countAndClose("window0", 1);
    1.21 +    countAndClose("window1", 1);
    1.22 +
    1.23 +    xpcCleanupWindows();
    1.24 +    SimpleTest.finish();
    1.25 +  }, 2);
    1.26 +}
    1.27 +
    1.28 +function countAndClose(name, expected_count) {
    1.29 +  var array_of_frames = xpcGetFramesByName(name);
    1.30 +  is(array_of_frames.length, expected_count,
    1.31 +     "Should only open " + expected_count +
    1.32 +     " window(s) with name " + name + " using a fancy hyperlink.");
    1.33 +
    1.34 +  for (var i=0; i < array_of_frames.length; ++i)
    1.35 +    array_of_frames[i].close();
    1.36 +}
    1.37 +</script>
    1.38 +</head>
    1.39 +<body>
    1.40 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=279495">Mozilla Bug 279495</a>
    1.41 +<div id="links">
    1.42 +<a id="link0" target="window0" onclick="window.open('blank.html', 'window0', 'width=10,height=10');">This is a fancy hyperlink</a>
    1.43 +<a id="link1" target="window1" onclick="window.open('http://test1.example.org:80/tests/docshell/test/navigation/blank.html', 'window1', 'width=10,height=10');">This is a fancy hyperlink</a>
    1.44 +</div>
    1.45 +<pre id="test">
    1.46 +<script type="text/javascript">
    1.47 +SimpleTest.waitForExplicitFinish();
    1.48 +</script>
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial