1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
content / test / data / gpu / webgl-domain-blocking-page1.html [blame]
<html>
<head>
<script type="text/javascript">
var gl;
var restored;
var numLosses = 0;
function init()
{
var canvas = document.getElementById('c');
canvas.addEventListener('webglcontextlost', function(e) {
e.preventDefault();
restored = false;
++numLosses;
// This bakes in knowledge that GpuDataManagerImplPrivate blocks
// WebGL contexts from restoration after two context losses on the
// same domain.
if (numLosses == 2) {
window.location.href = "webgl-domain-blocking-page2.html";
}
}, false);
canvas.addEventListener('webglcontextrestored', function(e) {
e.preventDefault();
restored = true;
}, false);
gl = canvas.getContext('webgl');
if (window.domAutomationController) {
window.domAutomationController.send("LOADED");
if (!gl) {
window.domAutomationController.send("FAILED");
}
}
}
</script>
</head>
<body bgcolor="lightgray" onload="init()">
<canvas id="c" width="400" height="300" style="border-width: 1px; border-style: solid;"></canvas>
</body>
</html>