diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-15 01:11:53 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-16 20:44:41 +0200 |
commit | ed673f80708a0a10bef728628c43e975542e4b6c (patch) | |
tree | 188292b4916a180ecba5d96388da32043bc3c6bd | |
parent | 1e1eca07edac2b842751e7182cc641a84bef52bc (diff) | |
download | servo-ed673f80708a0a10bef728628c43e975542e4b6c.tar.gz servo-ed673f80708a0a10bef728628c43e975542e4b6c.zip |
Mark some canvas methods as unsafe
They use raw JS context pointers.
-rw-r--r-- | components/script/dom/htmlcanvaselement.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index cfc1ee9a3db..dd1538b8529 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -188,7 +188,8 @@ impl HTMLCanvasElement { } } - pub fn get_or_init_webgl_context( + #[allow(unsafe_code)] + unsafe fn get_or_init_webgl_context( &self, cx: *mut JSContext, options: HandleValue, @@ -209,7 +210,8 @@ impl HTMLCanvasElement { } } - pub fn get_or_init_webgl2_context( + #[allow(unsafe_code)] + unsafe fn get_or_init_webgl2_context( &self, cx: *mut JSContext, options: HandleValue, @@ -243,11 +245,14 @@ impl HTMLCanvasElement { } #[allow(unsafe_code)] - fn get_gl_attributes(cx: *mut JSContext, options: HandleValue) -> Option<GLContextAttributes> { - match unsafe { WebGLContextAttributes::new(cx, options) } { + unsafe fn get_gl_attributes( + cx: *mut JSContext, + options: HandleValue, + ) -> Option<GLContextAttributes> { + match WebGLContextAttributes::new(cx, options) { Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)), Ok(ConversionResult::Failure(ref error)) => { - unsafe { throw_type_error(cx, &error); } + throw_type_error(cx, &error); None } _ => { |