mirror of
https://github.com/servo/servo.git
synced 2025-06-11 01:50:10 +00:00
Mark some canvas methods as unsafe
They use raw JS context pointers.
This commit is contained in:
parent
1e1eca07ed
commit
ed673f8070
1 changed files with 10 additions and 5 deletions
|
@ -188,7 +188,8 @@ impl HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_or_init_webgl_context(
|
#[allow(unsafe_code)]
|
||||||
|
unsafe fn get_or_init_webgl_context(
|
||||||
&self,
|
&self,
|
||||||
cx: *mut JSContext,
|
cx: *mut JSContext,
|
||||||
options: HandleValue,
|
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,
|
&self,
|
||||||
cx: *mut JSContext,
|
cx: *mut JSContext,
|
||||||
options: HandleValue,
|
options: HandleValue,
|
||||||
|
@ -243,11 +245,14 @@ impl HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_gl_attributes(cx: *mut JSContext, options: HandleValue) -> Option<GLContextAttributes> {
|
unsafe fn get_gl_attributes(
|
||||||
match unsafe { WebGLContextAttributes::new(cx, options) } {
|
cx: *mut JSContext,
|
||||||
|
options: HandleValue,
|
||||||
|
) -> Option<GLContextAttributes> {
|
||||||
|
match WebGLContextAttributes::new(cx, options) {
|
||||||
Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
|
Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
|
||||||
Ok(ConversionResult::Failure(ref error)) => {
|
Ok(ConversionResult::Failure(ref error)) => {
|
||||||
unsafe { throw_type_error(cx, &error); }
|
throw_type_error(cx, &error);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue