dom/tests/mochitest/bugs/test_bug400204.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/bugs/test_bug400204.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=400204
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 400204</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=400204">Mozilla Bug 400204</a>
    1.16 +<p id="display"></p>
    1.17 +<iframe id="content" src="about:blank" style="display: none"></iframe>
    1.18 +<pre id="test">
    1.19 +<script class="testbody" type="text/javascript">
    1.20 +  var c = document.getElementById("content");
    1.21 +  var success = false;
    1.22 +  // try to access innerWidth
    1.23 +  try { success = (c.contentWindow.innerWidth == 0); } catch(ex) { success = false; }
    1.24 +  ok(success, "can't access hidden iframe innerWidth, or it's not 0");
    1.25 +
    1.26 +  // try to access innerHeight
    1.27 +  success = false;
    1.28 +  try { success = (c.contentWindow.innerHeight == 0); } catch(ex) { success = false; }
    1.29 +  ok(success, "can't access hidden iframe innerHeight, or it's not 0");
    1.30 +
    1.31 +  // try to set innerWidth
    1.32 +  success = false;
    1.33 +  try { c.contentWindow.innerWidth = 100; success = true; } catch(ex) { success = false; }
    1.34 +  ok(success, "can't set hidden iframe innerWidth");
    1.35 +
    1.36 +  // try to set innerHeight
    1.37 +  success = false;
    1.38 +  try { c.contentWindow.innerHeight = 100; success = true; } catch(ex) { success = false; }
    1.39 +  ok(success, "can't set hidden iframe innerHeight");
    1.40 +
    1.41 +  // now try these again for good measure, and to ensure the values
    1.42 +  // haven't changed
    1.43 +  // try to access innerWidth
    1.44 +  success = false;
    1.45 +  try { success = (c.contentWindow.innerWidth == 0); } catch(ex) { success = false; }
    1.46 +  ok(success, "can't access hidden iframe innerWidth, or it's not 0");
    1.47 +
    1.48 +  // try to access innerHeight
    1.49 +  success = false;
    1.50 +  try { success = (c.contentWindow.innerHeight == 0); } catch(ex) { success = false; }
    1.51 +  ok(success, "can't access hidden iframe innerHeight, or it's not 0");
    1.52 +</script>
    1.53 +</pre>
    1.54 +</body>
    1.55 +</html>

mercurial