content/canvas/crashtests/360293-1.html

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>
     4 <body>
     5  Firefox: <a href="javascript:noCrash()">no crash</a> | <a href="javascript:crash()">crash</a><br/>
     6  <canvas id="foo" width="200" height="200">
     7  </canvas>
     8  <script>
     9    function d(lineWidth){
    10     var c = document.getElementById("foo").getContext("2d")
    11     c.clearRect(0,0,200,200)
    12     c.lineWidth = lineWidth
    13     c.beginPath()
    14     c.arc(100,100,80, Math.PI, 2*Math.PI, 1)
    15     c.stroke()
    16     c.beginPath()
    17     c.arc(50,50, 20, 0, 2*Math.PI, 1)
    18     c.stroke()
    19     c.beginPath()
    20     c.arc(150,50, 20, 0, 2*Math.PI, 1)
    21     c.stroke()
    22    }
    23    function noCrash() {
    24      d(Math.random()*20+5)
    25    }
    26    function crash() {
    27      d( '_' )
    28    }
    30    crash();
    31  </script>
    33 </body>
    35 </html>

mercurial