content/canvas/test/webgl-mochitest/test_webgl_request_mismatch.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 <title>WebGL test: Mismatched 'webgl' and 'experimental-webgl' context requests</title>
     3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
     4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     5 <body>
     6 <canvas id="c1"></canvas>
     7 <canvas id="c2"></canvas>
     8 <canvas id="c3"></canvas>
     9 <canvas id="c4"></canvas>
    10 <script>
    12 function testContextRetrieval(canvasId, creationId, requestId) {
    13   var canvas = document.getElementById(canvasId);
    14   ok(canvas, 'Invalid `canvasId`: ' + canvasId);
    16   var createdGL = canvas.getContext(creationId);
    17   if (!createdGL)
    18     return; // No WebGL on this machine?
    20   var requestedGL = canvas.getContext(requestId);
    21   if (creationId == requestId) {
    22     ok(requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should succeed.');
    23     ok(requestedGL == createdGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should match.');
    24   } else {
    25     ok(!requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should fail.');
    26   }
    27 }
    29 testContextRetrieval('c1', 'experimental-webgl', 'webgl');
    30 testContextRetrieval('c2', 'webgl', 'experimental-webgl');
    31 testContextRetrieval('c3', 'experimental-webgl', 'experimental-webgl');
    32 testContextRetrieval('c4', 'webgl', 'webgl');
    34 </script>

mercurial