Automatically enable WebGL 2 for specific domains.

This commit is contained in:
Josh Matthews 2020-04-15 11:42:02 -04:00
parent 7d1f968d52
commit e2845a6939
3 changed files with 25 additions and 4 deletions

View file

@ -41,7 +41,6 @@ use js::error::throw_type_error;
use js::rust::HandleValue;
use profile_traits::ipc;
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
use servo_config::pref;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
const DEFAULT_WIDTH: u32 = 300;
@ -222,7 +221,8 @@ impl HTMLCanvasElement {
cx: JSContext,
options: HandleValue,
) -> Option<DomRoot<WebGL2RenderingContext>> {
if !pref!(dom.webgl2.enabled) {
if !WebGL2RenderingContext::is_webgl2_enabled(cx, self.global().reflector().get_jsobject())
{
return None;
}
if let Some(ctx) = self.context() {