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.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for language-sensitive font prefs on canvas</title> |
michael@0 | 5 | <script type="text/javascript"> |
michael@0 | 6 | function test(canvasID) { |
michael@0 | 7 | var canvas = document.getElementById(canvasID); |
michael@0 | 8 | var ctx = canvas.getContext('2d'); |
michael@0 | 9 | |
michael@0 | 10 | var str = 'Hello world! \u4F60\u597D\u5417\uFF1F'; |
michael@0 | 11 | ctx.font = '2em sans-serif'; |
michael@0 | 12 | ctx.fillStyle = 'black'; |
michael@0 | 13 | ctx.textAlign = 'left'; |
michael@0 | 14 | ctx.textBaseline = 'top'; |
michael@0 | 15 | ctx.fillText(str, 10, 10); |
michael@0 | 16 | }; |
michael@0 | 17 | </script> |
michael@0 | 18 | </head> |
michael@0 | 19 | <body> |
michael@0 | 20 | |
michael@0 | 21 | <!-- |
michael@0 | 22 | In the reference, all divs are tagged with lang="en". |
michael@0 | 23 | The expectation is that at least some of them will resolve |
michael@0 | 24 | "sans-serif" to different fonts according to language. |
michael@0 | 25 | --> |
michael@0 | 26 | |
michael@0 | 27 | <div lang="ar" style="margin:20px; height:100px;"> |
michael@0 | 28 | <canvas id="c1" width="400" height="50"></canvas> |
michael@0 | 29 | <script type="text/javascript"> |
michael@0 | 30 | test("c1"); |
michael@0 | 31 | </script> |
michael@0 | 32 | </div> |
michael@0 | 33 | |
michael@0 | 34 | <div lang="ja" style="margin:20px; height:100px;"> |
michael@0 | 35 | <canvas id="c2" width="400" height="50"></canvas> |
michael@0 | 36 | <script type="text/javascript"> |
michael@0 | 37 | test("c2"); |
michael@0 | 38 | </script> |
michael@0 | 39 | </div> |
michael@0 | 40 | |
michael@0 | 41 | <div lang="zh-TW" style="margin:20px; height:100px;"> |
michael@0 | 42 | <canvas id="c3" width="400" height="50"></canvas> |
michael@0 | 43 | <script type="text/javascript"> |
michael@0 | 44 | test("c3"); |
michael@0 | 45 | </script> |
michael@0 | 46 | </div> |
michael@0 | 47 | |
michael@0 | 48 | <div lang="en" style="margin:20px; height:100px;"> |
michael@0 | 49 | <canvas id="c4" width="400" height="50"></canvas> |
michael@0 | 50 | <script type="text/javascript"> |
michael@0 | 51 | test("c4"); |
michael@0 | 52 | </script> |
michael@0 | 53 | </div> |
michael@0 | 54 | |
michael@0 | 55 | </body> |
michael@0 | 56 | </html> |