Tue, 06 Jan 2015 21:39:09 +0100
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>
2 <head>
3 <script type="text/javascript">
4 function assert(cond, msg) { if (!cond) { throw msg; } }
5 window.onload = function() {
6 try {
7 var ctx = document.getElementById("c1").getContext("2d");
9 assert("nonzero" == ctx.mozFillRule,
10 "Default fillRule is 'nonzero'");
12 ctx.mozFillRule = "evenodd";
13 assert("evenodd" == ctx.mozFillRule,
14 "fillRule understands 'evenodd'");
15 ctx.mozFillRule = "nonzero";
17 ctx.mozFillRule = "garbageLSKJDF 29879234";
18 assert("nonzero" == ctx.mozFillRule,
19 "Garbage fillRule string has no effect");
21 ctx.mozFillRule = "evenodd";
22 ctx.mozFillRule = "garbageLSKJDF 29879234";
23 assert("evenodd" == ctx.mozFillRule,
24 "Garbage fillRule string has no effect");
25 ctx.mozFillRule = "nonzero";
27 ctx.save();
28 ctx.mozFillRule = "evenodd";
29 ctx.restore();
30 assert("nonzero" == ctx.mozFillRule,
31 "fillRule was saved then restored");
32 } catch (e) {
33 document.body.innerHTML = "FAIL: "+ e.toString();
34 return;
35 }
36 document.body.innerHTML = "Pass";
37 }
38 </script>
39 </head>
40 <body>
41 <div><canvas id="c1" width="300" height="300"></canvas></div>
42 </body>
43 </html>