Use throw_type_error and throw_range_error from js.

This commit is contained in:
Ms2ger 2015-11-09 12:11:18 +01:00
parent ddaa1a1960
commit acb24e80b8
5 changed files with 24 additions and 92 deletions

View file

@ -157,6 +157,7 @@ impl HTMLCanvasElement {
}
}
#[allow(unsafe_code)]
pub fn get_or_init_webgl_context(&self,
cx: *mut JSContext,
attrs: Option<HandleValue>) -> Option<Root<WebGLRenderingContext>> {
@ -165,7 +166,7 @@ impl HTMLCanvasElement {
let size = self.get_size();
let attrs = if let Some(webgl_attributes) = attrs {
if let Ok(ref attrs) = WebGLContextAttributes::new(cx, webgl_attributes) {
if let Ok(ref attrs) = unsafe { WebGLContextAttributes::new(cx, webgl_attributes) } {
From::from(attrs)
} else {
debug!("Unexpected error on conversion of WebGLContextAttributes");