mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibWeb: Don't crash when failing to create WebGL context on non-Serenity
This makes Ladybird stop panicking on websites that try to use WebGL.
This commit is contained in:
parent
b56282d4b2
commit
f1576160d7
1 changed files with 8 additions and 1 deletions
|
@ -41,10 +41,17 @@ JS::ThrowCompletionOr<RefPtr<WebGLRenderingContext>> WebGLRenderingContext::crea
|
||||||
return RefPtr<WebGLRenderingContext> { nullptr };
|
return RefPtr<WebGLRenderingContext> { nullptr };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __serenity__
|
||||||
|
// FIXME: Make WebGL work on other platforms.
|
||||||
|
(void)context_attributes;
|
||||||
|
dbgln("FIXME: WebGL not supported on the current platform");
|
||||||
|
fire_webgl_context_creation_error(canvas_element);
|
||||||
|
return RefPtr<WebGLRenderingContext> { nullptr };
|
||||||
|
#else
|
||||||
// FIXME: LibGL currently doesn't propagate context creation errors.
|
// FIXME: LibGL currently doesn't propagate context creation errors.
|
||||||
auto context = GL::create_context(*canvas_element.bitmap());
|
auto context = GL::create_context(*canvas_element.bitmap());
|
||||||
|
|
||||||
return adopt_ref(*new WebGLRenderingContext(canvas_element, move(context), context_attributes, context_attributes));
|
return adopt_ref(*new WebGLRenderingContext(canvas_element, move(context), context_attributes, context_attributes));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue