author Brad Werth <>
Wed, 16 Jan 2019 21:57:52 +0000
changeset 514156 ddc9999232d6692a0bd58d10e9a5b3dad77562c0
parent 514122 28bcc4da309251ab6c1f10a3d4e67c1c55ee4fad
permissions -rw-r--r--
Bug 1504659 Part 4: Update tests to distinguish between layout and visual viewports. r=botond Testing the initial value of innerWidth and innerHeight is not really viable when the visual viewport has been set by the opener, but constrained by the device. The returned value differs between the desktop and mobile browsers because of the device constraints. The simplest thing to do is to test the CSS viewport and ensure that the innerWidth values can be set. Differential Revision:

<!DOCTYPE html>
  <meta name="viewport" content="width=320,height=320" />
  <title>Bug 602580 - Test layout viewport and visual viewport sizes with meta tags and changed innerWidth</title>
  <script class="testbody" type="text/javascript">
  function runSubTest()
    /* CSS viewport is set the by the meta tag in this document. */, 320, "CSS viewport width is meta viewport width");, 320, "CSS viewport height is meta viewport height");

    /* Visual viewport values can be changed by setting window.innerWidth and innerHeight. */
    var oldWidth = window.innerWidth;
    var oldHeight = window.innerHeight;

    window.innerWidth = 300;, 300, "visual viewport width returns set value");
    window.innerWidth = oldWidth;

    window.innerHeight = 300;, 300, "visual viewport height returns set value");
    window.innerHeight = oldHeight;

<body onload="runSubTest()">