dom/tests/mochitest/dom-level0/innerWidthHeight_script.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/dom-level0/innerWidthHeight_script.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <meta name="viewport" content="width=320,height=320" />
     1.8 +  <title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
     1.9 +  <script class="testbody" type="text/javascript">
    1.10 +  function runSubTest()
    1.11 +  {
    1.12 +    // Firefox doesn't support the metaviewport tag on desktop, so we force
    1.13 +    // css viewport here using nsIDomWindowUtils
    1.14 +    var cwu = SpecialPowers.getDOMWindowUtils(window);
    1.15 +    cwu.setCSSViewport(320, 320);
    1.16 +
    1.17 +    var oldWidth = window.innerWidth;
    1.18 +    var oldHeight = window.innerHeight;
    1.19 +
    1.20 +    /* Test that return values are now from viewport */
    1.21 +    window.opener.is(window.innerWidth, 320, "innerWidth is css viewport width");
    1.22 +    window.opener.is(window.innerHeight, 320, "innerHeight is css viewport height");
    1.23 +
    1.24 +    window.innerWidth = 300;
    1.25 +    window.opener.is(window.innerWidth, 300, "innerWidth returns value that was set");
    1.26 +    window.innerWidth = oldWidth;
    1.27 +
    1.28 +    window.innerHeight = 300;
    1.29 +    window.opener.is(window.innerHeight, 300, "innerHeight returns value that was set");
    1.30 +    window.innerHeight = oldHeight;
    1.31 +
    1.32 +    window.opener.finish();
    1.33 +  }
    1.34 +  </script>
    1.35 +</head>
    1.36 +<body onload="runSubTest()">
    1.37 +</body>
    1.38 +</html>

mercurial