content/canvas/test/webgl-mochitest/test_webgl_request_context.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.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <title>WebGL test: 'webgl' and 'experimental-webgl' context requests succeed,
michael@0 3 'moz-webgl' context requests fail.</title>
michael@0 4 <script src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
michael@0 6 <script src="driver-info.js"></script>
michael@0 7 <body>
michael@0 8 <canvas id="c1"></canvas>
michael@0 9 <canvas id="c2"></canvas>
michael@0 10 <script>
michael@0 11
michael@0 12 var testFunc = ok;
michael@0 13
michael@0 14 function testContextRetrieval(canvasId, creationId, shouldSucceed) {
michael@0 15 var canvas = document.getElementById(canvasId);
michael@0 16 ok(canvas, 'Invalid `canvasId`: ' + canvasId);
michael@0 17
michael@0 18 var createdGL = canvas.getContext(creationId);
michael@0 19 if (shouldSucceed) {
michael@0 20 testFunc(createdGL, 'Request for \'' + creationId + '\' should succeed.');
michael@0 21 } else {
michael@0 22 ok(!createdGL, 'Request for \'' + creationId + '\' should fail.');
michael@0 23 }
michael@0 24 }
michael@0 25
michael@0 26 SimpleTest.waitForExplicitFinish();
michael@0 27 SpecialPowers.pushPrefEnv({'set': [
michael@0 28 ['webgl.force-enabled', true]
michael@0 29 ]}, function() {
michael@0 30 testContextRetrieval('c1', 'experimental-webgl', true);
michael@0 31 testContextRetrieval('c2', 'moz-webgl', false);
michael@0 32 SimpleTest.finish();
michael@0 33 });
michael@0 34
michael@0 35 </script>
michael@0 36

mercurial