layout/reftests/first-letter/dynamic-2.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>CSS 2.1 Test Suite: :first-letter</title>
     5   <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu" />
     6   <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
     7   <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#first-letter"/>
     8   <meta name="flags" content="dom" />
     9 <script>
    10 function boom1()
    11 {
    12   initFuzzerSpecific();
    13   setTextContent(stylesheets[1], "*:first-letter { }");
    14   setTextContent(stylesheets[2], "*:before { counter-reset: chicken; }");
    15   document.body.offsetWidth;
    16   boom2();
    17 }
    19 function boom2()
    20 {
    21   setTextContent(stylesheets[3], "#q2:first-letter { content: 'generated'; }");
    22   setTextContent(stylesheets[1], "");
    23   setTextContent(stylesheets[4], "#q2 { quotes: '<1>' '</1>'; }");
    24   document.body.offsetWidth;
    25   boom3();
    26 }
    28 function boom3()
    29 {
    30   document.getElementById("p2").style.counterReset = "egg";
    31   setTextContent(stylesheets[1], "*:first-letter { }");
    32 }
    34 function setTextContent(n, t) { n.textContent = t; }
    36 var stylesheets = [];
    37 function initFuzzerSpecific()
    38 {
    39   var myStylesheetHolder = document.getElementsByTagName("head")[0];
    41   for (var i = 0; i < 25; ++i) {
    42     var s = document.createElementNS("http://www.w3.org/1999/xhtml", 'style');
    43     s.style.display = "none";
    44     myStylesheetHolder.appendChild(s);
    45     stylesheets.push(s);
    46   }
    47 }
    48 </script>
    50 </head>
    51 <body>
    53 <p><q>Foo</q></p>
    55 <p id="p2"><q id="q2">0</q></p>
    57 <script>
    58   document.body.offsetWidth;
    59   boom1();
    60 </script>
    61 </body>
    62 </html>

mercurial