content/canvas/test/reftest/webgl-clear-test.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 <!DOCTYPE html>
     2 <html class="reftest-wait">
     3 <head>
     4 <meta charset="UTF-8">
     6 <script type="text/javascript" src="webgl-utils.js"></script>
     7 <script type="text/javascript">
     8 /* Clear Test
     9  *
    10  * Clear the canvas to green to test that we get pixels to the screen.
    11  */
    13 "use strict";
    15 function renderGL(gl) {
    16   gl.clearColor(0.0, 1.0, 0.0, 1.0);
    17   gl.clear(gl.COLOR_BUFFER_BIT);
    18   gl.finish();
    19 }
    21 function renderFailure(canvas) {
    22   // This will also trigger RAF for us.
    23   var context = canvas.getContext("2d");
    24   context.fillText('WebGL failed.', 64, 64);
    25 }
    27 function runTest() {
    28   var canvas = document.getElementById("canvas");
    29   var gl = initGL(canvas);
    31   if (gl)
    32     renderGL(gl);
    33   else
    34     renderFailure(canvas);
    36   waitForComposite(testComplete);
    37 }
    39 function testComplete() {
    40   document.documentElement.removeAttribute("class");
    41 }
    43 </script>
    44 </head>
    46 <body onload="rAF(runTest);">
    47   <canvas id="canvas" width="256" height="256"></canvas>
    48 </body>
    50 </html>

mercurial