docshell/test/navigation/test_bug279495.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial