aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/imagedata.rs
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-07-22 22:14:11 +0100
committermarmeladema <xademax@gmail.com>2019-07-24 09:53:10 +0100
commit88cacfb0098e20be70c27bfde6b74cd3290f1fe4 (patch)
tree95d7cd9ffad7eaff05114946a1e12f8e49d55fab /components/script/dom/imagedata.rs
parent2c5d0a6ebc39ad263e2bbe623e357a11b4cec5aa (diff)
downloadservo-88cacfb0098e20be70c27bfde6b74cd3290f1fe4.tar.gz
servo-88cacfb0098e20be70c27bfde6b74cd3290f1fe4.zip
Modify *::get_cx methods to return a safe JSContext instead of a raw one
Diffstat (limited to 'components/script/dom/imagedata.rs')
-rw-r--r--components/script/dom/imagedata.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs
index 8546f73e5cf..52851fdce36 100644
--- a/components/script/dom/imagedata.rs
+++ b/components/script/dom/imagedata.rs
@@ -41,7 +41,7 @@ impl ImageData {
let len = width * height * 4;
unsafe {
let cx = global.get_cx();
- rooted!(in (cx) let mut js_object = ptr::null_mut::<JSObject>());
+ rooted!(in (*cx) let mut js_object = ptr::null_mut::<JSObject>());
let data = match data {
Some(ref mut d) => {
d.resize(len as usize, 0);
@@ -49,7 +49,7 @@ impl ImageData {
},
None => CreateWith::Length(len),
};
- Uint8ClampedArray::create(cx, data, js_object.handle_mut()).unwrap();
+ Uint8ClampedArray::create(*cx, data, js_object.handle_mut()).unwrap();
Self::new_with_jsobject(global, width, Some(height), Some(js_object.get()))
}
}
@@ -70,7 +70,7 @@ impl ImageData {
// checking jsobject type and verifying (height * width * 4 == jsobject.byte_len())
if let Some(jsobject) = opt_jsobject {
let cx = global.get_cx();
- typedarray!(in(cx) let array_res: Uint8ClampedArray = jsobject);
+ typedarray!(in(*cx) let array_res: Uint8ClampedArray = jsobject);
let array = array_res.map_err(|_| {
Error::Type("Argument to Image data is not an Uint8ClampedArray".to_owned())
})?;
@@ -110,8 +110,8 @@ impl ImageData {
} else {
let len = width * height * 4;
let cx = global.get_cx();
- rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
- Uint8ClampedArray::create(cx, CreateWith::Length(len), array.handle_mut()).unwrap();
+ rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
+ Uint8ClampedArray::create(*cx, CreateWith::Length(len), array.handle_mut()).unwrap();
(*imagedata).data.set(array.get());
}