layout/base/tests/test_bug449781.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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;
    22 /** Test for Bug 449781 **/
    23 SimpleTest.waitForExplicitFinish();
    24 addLoadEvent(function() {
    25   s1 = snapshotWindow(window);
    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");
    32   s2 = snapshotWindow(window);
    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);
    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;
    48   s3 = snapshotWindow(window);
    50   [equal, str1, str2] = compareSnapshots(s1, s3, true);
    51   ok(equal, "Zoom should have no effect",
    52      "got " + str1 + " but expected " + str2);
    54   $("display").style.display = "none";
    56   s4 = snapshotWindow(window);
    57   [equal, str1, str2] = compareSnapshots(s3, s4, true);
    58   ok(!equal, "Should be able to see the canary");
    60   SimpleTest.finish();
    61 });
    65 </script>
    66 </pre>
    67 </body>
    68 </html>

mercurial