docshell/test/navigation/test_bug270414.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

     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     <style type="text/css">
     9       iframe { width: 90%; height: 50px; }
    10     </style>
    11 <script>
    12 var headerHTML = "<html><head>" +
    13                  "<script src='/tests/SimpleTest/EventUtils.js'></scr" + "ipt>" + 
    14                  "<script src='NavigationUtils.js'></scr" + "ipt>" +
    15                  "</head><body>";
    16 var footerHTML = "</body></html>";
    18 function testChild0() {
    19   if (!window.window0) {
    20     window0 = window.open("", "window0", "width=10,height=10");
    21     window0.document.open();
    22     window0.document.write(headerHTML);
    23     window0.document.write("<script>navigateByLocation(opener.frames[0])</scr" + "ipt>");
    24     window0.document.write(footerHTML);
    25     window0.document.close();
    26   }
    27 }
    29 function testChild1() {
    30   if (!window.window1) {
    31     window1 = window.open("", "window1", "width=10,height=10");
    32     window1.document.open();
    33     window1.document.write(headerHTML);
    34     window1.document.write("<script>navigateByOpen('child1');</scr" + "ipt>");
    35     window1.document.write(footerHTML);
    36     window1.document.close();
    37   }
    38 }
    40 function testChild2() {
    41   if (!window.window2) {
    42     window2 = window.open("", "window2", "width=10,height=10");
    43     window2.document.open();
    44     window2.document.write(headerHTML);
    45     window2.document.write("<script>navigateByForm('child2');</scr" + "ipt>");
    46     window2.document.write(footerHTML);
    47     window2.document.close();
    48   }
    49 }
    51 function testChild3() {
    52   if (!window.window3) {
    53     window3 = window.open("", "window3", "width=10,height=10");
    54     window3.document.open();
    55     window3.document.write(headerHTML);
    56     window3.document.write("<script>navigateByHyperlink('child3');</scr" + "ipt>");
    57     window3.document.write(footerHTML);
    58     window3.document.close();
    59   }
    60 }
    62 xpcWaitForFinishedFrames(function() {
    63   isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
    64   isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
    65   isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
    66   isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
    68   window0.close();
    69   window1.close();
    70   window2.close();
    71   window3.close();
    73   xpcCleanupWindows();
    74   SimpleTest.finish();
    75 }, 4);
    77 </script>
    78 </head>
    79 <body>
    80 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=270414">Mozilla Bug 270414</a>
    81 <div id="frames">
    82 <iframe onload="testChild0();" name="child0" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
    83 <iframe onload="testChild1();" name="child1" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
    84 <iframe onload="testChild2();" name="child2" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
    85 <iframe onload="testChild3();" name="child3" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
    86 </div>
    87 <pre id="test">
    88 <script type="text/javascript">
    89 SimpleTest.waitForExplicitFinish();
    90 </script>
    91 </pre>
    92 </body>
    93 </html>

mercurial