4 https://bugzilla.mozilla.org/show_bug.cgi?id=436083
7 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
8 <meta name=
"viewport" content=
"height=398, width=4224, minimum-scale=0.1,
9 initial-scale=2.3, maximum-scale=45.2, user-scalable=no">
10 <title>Test for Viewport META Tag Parsing
</title>
11 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
12 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
17 href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=436083">Mozilla Bug
436083</a>
19 <script class=
"testbody" type=
"text/javascript">
21 /** Test for Viewport META Tag **/
23 SimpleTest.waitForExplicitFinish();
25 function testViewport() {
27 /* We need to access the document headers, which are chrome-only. */
28 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
30 /* Grab Viewport Metadata from the document header. */
32 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
34 iRequester.getInterface(Components.interfaces.nsIDOMWindowUtils);
36 parseInt(windowUtils.getDocumentMetadata(
"viewport-width"));
38 parseInt(windowUtils.getDocumentMetadata(
"viewport-height"));
40 parseFloat(windowUtils.getDocumentMetadata(
"viewport-initial-scale"));
42 parseFloat(windowUtils.getDocumentMetadata(
"viewport-maximum-scale"));
44 parseFloat(windowUtils.getDocumentMetadata(
"viewport-minimum-scale"));
46 windowUtils.getDocumentMetadata(
"viewport-user-scalable");
48 is(vpWidth,
4224,
"Should get proper width");
49 is(vpHeight,
398,
"Should get proper height");
50 is(vpInitialScale,
2.3,
"Should get proper initial scale");
51 is(vpMaxScale,
45.2,
"Should get proper max scale");
52 is(vpMinScale,
0.1,
"Should get proper min scale");
53 is(vpUserScalable,
"no",
"Should get proper user scalable parameter");
56 addLoadEvent(testViewport);
57 addLoadEvent(SimpleTest.finish);