layout/base/tests/test_bug449781.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c82e55d8d460
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=449781
5 -->
6 <head>
7 <title>Test for Bug 449781</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=449781">Mozilla Bug 449781</a>
14 <p id="display">Canary</p>
15 <iframe src="about:blank" id="ourFrame" style="visibility: hidden">
16 </iframe>
17 </div>
18 <pre id="test">
19 <script class="testbody" type="text/javascript">
20 var s1, s2, s3, s4;
21
22 /** Test for Bug 449781 **/
23 SimpleTest.waitForExplicitFinish();
24 addLoadEvent(function() {
25 s1 = snapshotWindow(window);
26
27 $("ourFrame").style.display = "none";
28 is($("ourFrame").offsetWidth, 0, "Unexpected width after hiding");
29 $("ourFrame").style.display = "";
30 is($("ourFrame").clientWidth, 300, "Unexpected width after showing");
31
32 s2 = snapshotWindow(window);
33
34 var equal, str1, str2;
35 [equal, str1, str2] = compareSnapshots(s1, s2, true);
36 ok(equal, "Show/hide should have no effect",
37 "got " + str1 + " but expected " + str2);
38
39 var viewer =
40 SpecialPowers.wrap($("ourFrame")).contentWindow
41 .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
42 .getInterface(SpecialPowers.Ci.nsIWebNavigation)
43 .QueryInterface(SpecialPowers.Ci.nsIDocShell)
44 .contentViewer
45 .QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
46 viewer.fullZoom = 2;
47
48 s3 = snapshotWindow(window);
49
50 [equal, str1, str2] = compareSnapshots(s1, s3, true);
51 ok(equal, "Zoom should have no effect",
52 "got " + str1 + " but expected " + str2);
53
54 $("display").style.display = "none";
55
56 s4 = snapshotWindow(window);
57 [equal, str1, str2] = compareSnapshots(s3, s4, true);
58 ok(!equal, "Should be able to see the canary");
59
60 SimpleTest.finish();
61 });
62
63
64
65 </script>
66 </pre>
67 </body>
68 </html>
69

mercurial