docshell/test/navigation/test_bug279495.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c77b18a86739
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
5 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
7 <script type="text/javascript" src="NavigationUtils.js"></script>
8 <script>
9 window.onload = function () {
10 document.getElementById("link0").href = target_url;
11 document.getElementById("link1").href = target_url;
12
13 sendMouseEvent({type:"click"}, "link0");
14 sendMouseEvent({type:"click"}, "link1");
15
16 xpcWaitForFinishedFrames(function() {
17 countAndClose("window0", 1);
18 countAndClose("window1", 1);
19
20 xpcCleanupWindows();
21 SimpleTest.finish();
22 }, 2);
23 }
24
25 function countAndClose(name, expected_count) {
26 var array_of_frames = xpcGetFramesByName(name);
27 is(array_of_frames.length, expected_count,
28 "Should only open " + expected_count +
29 " window(s) with name " + name + " using a fancy hyperlink.");
30
31 for (var i=0; i < array_of_frames.length; ++i)
32 array_of_frames[i].close();
33 }
34 </script>
35 </head>
36 <body>
37 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=279495">Mozilla Bug 279495</a>
38 <div id="links">
39 <a id="link0" target="window0" onclick="window.open('blank.html', 'window0', 'width=10,height=10');">This is a fancy hyperlink</a>
40 <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>
41 </div>
42 <pre id="test">
43 <script type="text/javascript">
44 SimpleTest.waitForExplicitFinish();
45 </script>
46 </pre>
47 </body>
48 </html>

mercurial