docshell/test/navigation/test_not-opener.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/navigation/test_not-opener.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     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 +    <style type="text/css">
    1.12 +      iframe { width: 90%; height: 50px; }
    1.13 +    </style>
    1.14 +<script>
    1.15 +if (!navigator.platform.startsWith("Win")) {
    1.16 +  SimpleTest.expectAssertions(0, 1);
    1.17 +}
    1.18 +
    1.19 +window.onload = function () {
    1.20 +  //navigateByLocation(window0);  // Don't have a handle to the window.
    1.21 +  navigateByOpen("window1");
    1.22 +  navigateByForm("window2");
    1.23 +  navigateByHyperlink("window3");
    1.24 +
    1.25 +  xpcWaitForFinishedFrames(function() {
    1.26 +    is(xpcGetFramesByName("window1").length, 2, "Should not be able to navigate popup's popup by calling window.open.");
    1.27 +    is(xpcGetFramesByName("window2").length, 2, "Should not be able to navigate popup's popup by submitting form.");
    1.28 +    is(xpcGetFramesByName("window3").length, 2, "Should not be able to navigate popup's popup by targeted hyperlink.");
    1.29 +
    1.30 +    //opener0.close();
    1.31 +    opener1.close();
    1.32 +    opener2.close();
    1.33 +    opener3.close();
    1.34 +
    1.35 +    xpcCleanupWindows();
    1.36 +    SimpleTest.finish();
    1.37 +  }, 6);
    1.38 +}
    1.39 +
    1.40 +//opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");
    1.41 +opener1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window1", "_blank", "width=10,height=10");
    1.42 +opener2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window2", "_blank", "width=10,height=10");
    1.43 +opener3 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window3", "_blank", "width=10,height=10");
    1.44 +</script>
    1.45 +</head>
    1.46 +<body>
    1.47 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=408052">Mozilla Bug 408052</a>
    1.48 +<pre id="test">
    1.49 +<script type="text/javascript">
    1.50 +SimpleTest.waitForExplicitFinish();
    1.51 +</script>
    1.52 +</pre>
    1.53 +</body>
    1.54 +</html>

mercurial