Convert internal methods to handle safe JSContext instead of raw JSContext

This commit is contained in:
marmeladema 2019-07-21 22:22:44 +01:00
parent 2fb3f1f983
commit 808fa65aef
4 changed files with 151 additions and 139 deletions

View file

@ -28,6 +28,7 @@ use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
use crate::dom::webglrenderingcontext::{
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
};
use crate::script_runtime::JSContext as SafeJSContext;
use base64;
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
use canvas_traits::webgl::{GLContextAttributes, WebGLVersion};
@ -263,7 +264,7 @@ impl HTMLCanvasElement {
cx: *mut JSContext,
options: HandleValue,
) -> Option<GLContextAttributes> {
match WebGLContextAttributes::new(cx, options) {
match WebGLContextAttributes::new(SafeJSContext::from_ptr(cx), options) {
Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
Ok(ConversionResult::Failure(ref error)) => {
throw_type_error(cx, &error);