docshell/test/navigation/test_bug13871.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/navigation/test_bug13871.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 +    <style type="text/css">
    1.12 +      iframe { width: 90%; height: 50px; }
    1.13 +    </style>
    1.14 +<script>
    1.15 +window.onload = function () {
    1.16 +  navigateByLocation(window0.frames[0]);
    1.17 +  navigateByOpen("window1_child0");
    1.18 +  navigateByForm("window2_child0");
    1.19 +  navigateByHyperlink("window3_child0");
    1.20 +
    1.21 +  xpcWaitForFinishedFrames(function() {
    1.22 +    isInaccessible(window0.frames[0], "Should not be able to navigate off-domain frame by setting location.");
    1.23 +    isInaccessible(window1.frames[0], "Should not be able to navigate off-domain frame by calling window.open.");
    1.24 +    isInaccessible(window2.frames[0], "Should not be able to navigate off-domain frame by submitting form.");
    1.25 +    isInaccessible(window3.frames[0], "Should not be able to navigate off-domain frame by targeted hyperlink.");
    1.26 +
    1.27 +    window0.close();
    1.28 +    window1.close();
    1.29 +    window2.close();
    1.30 +    window3.close();
    1.31 +
    1.32 +    xpcCleanupWindows();
    1.33 +    SimpleTest.finish();
    1.34 +  }, 4);
    1.35 +}
    1.36 +
    1.37 +var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window0", "width=10,height=10");
    1.38 +var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window1", "width=10,height=10");
    1.39 +var window2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window2", "width=10,height=10");
    1.40 +var window3 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window3", "width=10,height=10");
    1.41 +</script>
    1.42 +</head>
    1.43 +<body>
    1.44 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=13871">Mozilla Bug 13871</a>
    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