layout/inspector/tests/test_bug609549.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.

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=609549
     4 -->
     5 <head>
     6   <title>Test for Bug 609549</title>
     7   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10   <bindings xmlns="http://www.mozilla.org/xbl">
    11     <binding id="testBinding">
    12       <!-- No linebreaks since this is html and whitespace is preserved. -->
    13       <content><div anonid="box-A">x</div><div anonid="box-B"><children includes="span"/></div><div anonid="box-C">x</div><children/></content>
    14     </binding>
    15   </bindings>
    16 </head>
    18 <body>
    19 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=609549">Mozilla Bug 609549</a>
    20 <div id="bound" style="-moz-binding: url(#testBinding);"><p id="p">lorem ipsum dolor sit amet</p><span id="sandwiched">sandwiched</span></div>
    22 <div id="content" style="display: none">
    24 </div>
    25 <pre id="test">
    26 <script type="application/javascript">
    27 <![CDATA[
    29 /** Test for Bug 609549 **/
    30 SimpleTest.waitForExplicitFinish();
    32 addLoadEvent(function() {
    33   var domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
    34                    getService(SpecialPowers.Ci.inIDOMUtils);
    35   ok("getChildrenForNode" in domUtils, "domUtils has no getChildrenForNode");
    36   var withoutAnons = SpecialPowers.unwrap(domUtils.getChildrenForNode($("bound"), false));
    38   is(withoutAnons.length, $("bound").childNodes.length,
    39      "withoutAnons should be the same length as childNodes");
    40   is(withoutAnons[0], $("p"), "didn't get paragraph - without anons");
    41   is(withoutAnons[1], $("sandwiched"),
    42      "didn't get sandwiched span - without anons");
    44   var withAnons = domUtils.getChildrenForNode($("bound"), true);
    46   is(withAnons.length, 4, "bad withAnons.length");
    47   is(withAnons[0].getAttribute("anonid"), "box-A",
    48      "didn't get anonymous box-A");
    49   is(withAnons[1].getAttribute("anonid"), "box-B",
    50      "didn't get anonymous box-B");
    51   is(withAnons[2].getAttribute("anonid"), "box-C",
    52      "didn't get anonymous box-C");
    53   is(withAnons[3].id, "p", "didn't get paragraph - with anons");
    55   var bKids = domUtils.getChildrenForNode(withAnons[1], true);
    56   is(bKids.length, 1, "bKids.length is bad");
    57   is(SpecialPowers.unwrap(bKids[0]), $("sandwiched"),
    58      "didn't get sandwiched span inserted into box-B");
    60   SimpleTest.finish();
    61 });
    63 ]]>
    64 </script>
    65 </pre>
    66 </body>
    67 </html>

mercurial