Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that removed contexts are made active before removal.
- Loading branch information
Showing
5 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_blue.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>WebGL ClearColor Test</title> | ||
</head> | ||
<style> | ||
|
||
html, body { | ||
margin: 0; | ||
} | ||
|
||
</style> | ||
<body> | ||
<canvas id="canvas" width="640" height="480"></canvas> | ||
<!-- Dummy canvas that is only used to create a GL context that will be garbage collected --> | ||
<canvas id="canvas2" width="640" height="480"></canvas> | ||
<script type="text/javascript"> | ||
|
||
var gl = document.getElementById("canvas").getContext("webgl"); | ||
var gl2 = document.getElementById("canvas2").getContext("webgl"); | ||
gl2 = null; | ||
document.getElementById('canvas2').remove(); | ||
|
||
function draw() { | ||
gl.clearColor(0.0, 0.0, 1.0, 1.0); | ||
gl.clear(gl.COLOR_BUFFER_BIT); | ||
} | ||
|
||
draw(); | ||
</script> | ||
</body> | ||
</html> |
33 changes: 33 additions & 0 deletions
33
tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_green.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>WebGL ClearColor Test</title> | ||
</head> | ||
<style> | ||
|
||
html, body { | ||
margin: 0; | ||
} | ||
|
||
</style> | ||
<body> | ||
<canvas id="canvas" width="640" height="480"></canvas> | ||
<!-- Dummy canvas that is only used to create a GL context that will be garbage collected --> | ||
<canvas id="canvas2" width="640" height="480"></canvas> | ||
<script type="text/javascript"> | ||
|
||
var gl = document.getElementById("canvas").getContext("webgl"); | ||
var gl2 = document.getElementById("canvas2").getContext("webgl"); | ||
gl2 = null; | ||
document.getElementById('canvas2').remove(); | ||
|
||
function draw() { | ||
gl.clearColor(0.0, 1.0, 0.0, 1.0); | ||
gl.clear(gl.COLOR_BUFFER_BIT); | ||
} | ||
|
||
draw(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>Traversing history with webgl content does not panic</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe></iframe> | ||
<script> | ||
/* | ||
Load two pages that each create two GL contexts and draw in one of them. | ||
Traverse history and attempt to draw again; this has historically caused crashes. | ||
*/ | ||
var first = "clearcolor_green.html"; | ||
var second = "clearcolor_blue.html"; | ||
|
||
var iframe = document.querySelector('iframe'); | ||
iframe.src = first; | ||
|
||
var t = async_test(); | ||
onload = t.step_func(function() { | ||
iframe.src = second; | ||
|
||
iframe.onload = t.step_func(function() { | ||
assert_true(iframe.contentWindow.location.href.endsWith(second)); | ||
iframe.contentWindow.history.back(); | ||
|
||
t.step_timeout(function() { | ||
assert_true(iframe.contentWindow.location.href.endsWith(first)); | ||
// Try to use the previously-used GL context. | ||
iframe.contentWindow.draw(); | ||
iframe.contentWindow.history.forward(); | ||
|
||
t.step_timeout(function() { | ||
assert_true(iframe.contentWindow.location.href.endsWith(second)); | ||
// Try to use the previously-used GL context. | ||
iframe.contentWindow.draw(); | ||
t.done(); | ||
}, 1000); | ||
|
||
}, 1000); | ||
}); | ||
}); | ||
</script> |