content/xml/document/test/test_viewport.xhtml

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=436083
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
michael@0 8 <meta name="viewport" content="height=398, width=4224, minimum-scale=0.1,
michael@0 9 initial-scale=2.3, maximum-scale=45.2, user-scalable=no" />
michael@0 10 <title>Test for Viewport META Tag Parsing</title>
michael@0 11 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 13 </head>
michael@0 14 <body>
michael@0 15 <a target="_blank"
michael@0 16 href="https://bugzilla.mozilla.org/show_bug.cgi?id=436083">Mozilla Bug 436083</a>
michael@0 17 <pre id="test">
michael@0 18 <script class="testbody" type="text/javascript">
michael@0 19 <![CDATA[
michael@0 20
michael@0 21 /** Test for Viewport META Tag **/
michael@0 22
michael@0 23 SimpleTest.waitForExplicitFinish();
michael@0 24
michael@0 25 function testViewport() {
michael@0 26
michael@0 27 /* Grab Viewport Metadata from the document header. */
michael@0 28 var windowUtils = SpecialPowers.getDOMWindowUtils(window);
michael@0 29 var vpWidth =
michael@0 30 parseInt(windowUtils.getDocumentMetadata("viewport-width"));
michael@0 31 var vpHeight =
michael@0 32 parseInt(windowUtils.getDocumentMetadata("viewport-height"));
michael@0 33 var vpInitialScale =
michael@0 34 parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
michael@0 35 var vpMaxScale =
michael@0 36 parseFloat(windowUtils.getDocumentMetadata("viewport-maximum-scale"));
michael@0 37 var vpMinScale =
michael@0 38 parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale"));
michael@0 39 var vpUserScalable =
michael@0 40 windowUtils.getDocumentMetadata("viewport-user-scalable");
michael@0 41
michael@0 42 is(vpWidth, 4224, "Should get proper width");
michael@0 43 is(vpHeight, 398, "Should get proper height");
michael@0 44 is(vpInitialScale, 2.3, "Should get proper initial scale");
michael@0 45 is(vpMaxScale, 45.2, "Should get proper max scale");
michael@0 46 is(vpMinScale, 0.1, "Should get proper min scale");
michael@0 47 is(vpUserScalable, "no", "Should get proper user scalable parameter");
michael@0 48 }
michael@0 49
michael@0 50 addLoadEvent(testViewport);
michael@0 51 addLoadEvent(SimpleTest.finish);
michael@0 52 ]]>
michael@0 53
michael@0 54 </script>
michael@0 55 </pre>
michael@0 56 </body>
michael@0 57 </html>

mercurial