mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
webgl: Implement WebGLContextEvent and use it on context creation error
spec: https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
This commit is contained in:
parent
217c7da413
commit
7030f09823
8 changed files with 146 additions and 2 deletions
|
@ -821,6 +821,12 @@
|
|||
"url": "/_mozilla/mozilla/union.html"
|
||||
}
|
||||
],
|
||||
"mozilla/webgl_context_creation_error.html": [
|
||||
{
|
||||
"path": "mozilla/webgl_context_creation_error.html",
|
||||
"url": "/_mozilla/mozilla/webgl_context_creation_error.html"
|
||||
}
|
||||
],
|
||||
"mozilla/websocket_connection_fail.html": [
|
||||
{
|
||||
"path": "mozilla/websocket_connection_fail.html",
|
||||
|
|
|
@ -205,6 +205,7 @@ var interfaceNamesInGlobalScope = [
|
|||
"WebGLRenderingContext",
|
||||
"WebGLUniformLocation",
|
||||
"WebGLBuffer",
|
||||
"WebGLContextEvent",
|
||||
"WebGLFramebuffer",
|
||||
"WebGLRenderbuffer",
|
||||
"WebGLTexture",
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>WebGLContextEvent "webglcontextcreationerror" event</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
canvas.addEventListener("webglcontextcreationerror", this.step_func_done(function(e) {
|
||||
assert_true(e.__proto__ === WebGLContextEvent.prototype,
|
||||
"webglcontextcreationevent should be a WebGLContextEvent");
|
||||
assert_true(typeof(e.statusMessage) === "string",
|
||||
"'statusMessage' should be a string, " + typeof(e.statusMessage) + " found");
|
||||
}), false);
|
||||
|
||||
// Antialising actually is not supported and thus triggers the error event
|
||||
var gl = canvas.getContext('webgl', { antialiasing: true });
|
||||
|
||||
assert_false(!!gl, "WebGLContext creation succeeded, please update this test!");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue