layout/forms/test/test_bug477700.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=477700
     5 -->
     6 <head>
     7   <title>Test for Bug 477700</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=477700">Mozilla Bug 477700</a>
    13 <p id="display">
    14   <iframe id="i"
    15           src="http://example.com/tests/layout/forms/test/bug477700_subframe.html"></iframe>
    16 </p>
    17 <div id="content" style="display: none">
    19 </div>
    20 <pre id="test">
    21 <script type="application/javascript">
    23 /** Test for Bug 477700 **/
    24 SimpleTest.waitForExplicitFinish();
    25 addLoadEvent(function() {
    26   isnot(window.location.host, "example.com", "test is not testing cross-site");
    27   var accessed = false;
    28   try {
    29     $("i").contentDocument.documentElement;
    30     accessed = true;
    31   } catch(e) {}
    32   is(accessed, false, "Shouldn't be able to access cross-site");
    34   $("i").style.display = "none";
    35   document.body.offsetWidth;
    36   is(document.defaultView.getComputedStyle($("i"), "").display, "none",
    37      "toggling display failed");
    38   $("i").style.display = "";
    39   document.body.offsetWidth;
    40   is(document.defaultView.getComputedStyle($("i"), "").display, "inline",
    41      "toggling display back failed");
    43   $("i").contentWindow.postMessage("start", "*");
    44 });
    46 window.addEventListener("message",
    47   function(evt) {
    48     var arr = evt.data.split(/ /).map(decodeURIComponent);
    49     if (arr[0] == 't') {
    50       is(arr[1], arr[2], arr[3]);
    51     } else if (arr[0] == 'f') {
    52       SimpleTest.finish();
    53     }
    54   },
    55   false);
    57 </script>
    58 </pre>
    59 </body>
    60 </html>

mercurial