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:
Emilio Cobos Álvarez 2015-10-03 21:09:54 +02:00
parent 217c7da413
commit 7030f09823
8 changed files with 146 additions and 2 deletions

View file

@ -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",

View file

@ -205,6 +205,7 @@ var interfaceNamesInGlobalScope = [
"WebGLRenderingContext",
"WebGLUniformLocation",
"WebGLBuffer",
"WebGLContextEvent",
"WebGLFramebuffer",
"WebGLRenderbuffer",
"WebGLTexture",

View file

@ -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>