Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
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 | |
michael@0 | 20 | /** Test for Viewport META Tag **/ |
michael@0 | 21 | |
michael@0 | 22 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 23 | |
michael@0 | 24 | function testViewport() { |
michael@0 | 25 | |
michael@0 | 26 | /* We need to access the document headers, which are chrome-only. */ |
michael@0 | 27 | |
michael@0 | 28 | /* Grab Viewport Metadata from the document header. */ |
michael@0 | 29 | var windowUtils = SpecialPowers.getDOMWindowUtils(window); |
michael@0 | 30 | var vpWidth = |
michael@0 | 31 | parseInt(windowUtils.getDocumentMetadata("viewport-width")); |
michael@0 | 32 | var vpHeight = |
michael@0 | 33 | parseInt(windowUtils.getDocumentMetadata("viewport-height")); |
michael@0 | 34 | var vpInitialScale = |
michael@0 | 35 | parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale")); |
michael@0 | 36 | var vpMaxScale = |
michael@0 | 37 | parseFloat(windowUtils.getDocumentMetadata("viewport-maximum-scale")); |
michael@0 | 38 | var vpMinScale = |
michael@0 | 39 | parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale")); |
michael@0 | 40 | var vpUserScalable = |
michael@0 | 41 | windowUtils.getDocumentMetadata("viewport-user-scalable"); |
michael@0 | 42 | |
michael@0 | 43 | is(vpWidth, 4224, "Should get proper width"); |
michael@0 | 44 | is(vpHeight, 398, "Should get proper height"); |
michael@0 | 45 | is(vpInitialScale, 2.3, "Should get proper initial scale"); |
michael@0 | 46 | is(vpMaxScale, 45.2, "Should get proper max scale"); |
michael@0 | 47 | is(vpMinScale, 0.1, "Should get proper min scale"); |
michael@0 | 48 | is(vpUserScalable, "no", "Should get proper user scalable parameter"); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | addLoadEvent(testViewport); |
michael@0 | 52 | addLoadEvent(SimpleTest.finish); |
michael@0 | 53 | |
michael@0 | 54 | </script> |
michael@0 | 55 | </pre> |
michael@0 | 56 | </body> |
michael@0 | 57 | </html> |