aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/paintworkletglobalscope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/paintworkletglobalscope.rs')
-rw-r--r--components/script/dom/paintworkletglobalscope.rs51
1 files changed, 28 insertions, 23 deletions
diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs
index 296ad4998eb..bc04ab63440 100644
--- a/components/script/dom/paintworkletglobalscope.rs
+++ b/components/script/dom/paintworkletglobalscope.rs
@@ -253,12 +253,12 @@ impl PaintWorkletGlobalScope {
);
let cx = self.worklet_global.get_cx();
- let _ac = JSAutoRealm::new(cx, self.worklet_global.reflector().get_jsobject().get());
+ let _ac = JSAutoRealm::new(*cx, self.worklet_global.reflector().get_jsobject().get());
// TODO: Steps 1-2.1.
// Step 2.2-5.1.
- rooted!(in(cx) let mut class_constructor = UndefinedValue());
- rooted!(in(cx) let mut paint_function = UndefinedValue());
+ rooted!(in(*cx) let mut class_constructor = UndefinedValue());
+ rooted!(in(*cx) let mut paint_function = UndefinedValue());
let rendering_context = match self.paint_definitions.borrow().get(name) {
None => {
// Step 2.2.
@@ -282,21 +282,21 @@ impl PaintWorkletGlobalScope {
// prepopulate the paint instance in `RegisterPaint`, to avoid calling it in
// the primary worklet thread.
// https://github.com/servo/servo/issues/17377
- rooted!(in(cx) let mut paint_instance = UndefinedValue());
+ rooted!(in(*cx) let mut paint_instance = UndefinedValue());
match self.paint_class_instances.borrow_mut().entry(name.clone()) {
Entry::Occupied(entry) => paint_instance.set(entry.get().get()),
Entry::Vacant(entry) => {
// Step 5.2-5.3
let args = HandleValueArray::new();
- rooted!(in(cx) let mut result = null_mut::<JSObject>());
+ rooted!(in(*cx) let mut result = null_mut::<JSObject>());
unsafe {
- Construct1(cx, class_constructor.handle(), &args, result.handle_mut());
+ Construct1(*cx, class_constructor.handle(), &args, result.handle_mut());
}
paint_instance.set(ObjectValue(result.get()));
- if unsafe { JS_IsExceptionPending(cx) } {
+ if unsafe { JS_IsExceptionPending(*cx) } {
debug!("Paint constructor threw an exception {}.", name);
unsafe {
- JS_ClearPendingException(cx);
+ JS_ClearPendingException(*cx);
}
self.paint_definitions
.borrow_mut()
@@ -333,7 +333,7 @@ impl PaintWorkletGlobalScope {
.collect();
let arguments_value_array =
unsafe { HandleValueArray::from_rooted_slice(&*arguments_value_vec) };
- rooted!(in(cx) let argument_object = unsafe { JS_NewArrayObject(cx, &arguments_value_array) });
+ rooted!(in(*cx) let argument_object = unsafe { JS_NewArrayObject(*cx, &arguments_value_array) });
let args_slice = [
ObjectValue(rendering_context.reflector().get_jsobject().get()),
@@ -343,10 +343,10 @@ impl PaintWorkletGlobalScope {
];
let args = unsafe { HandleValueArray::from_rooted_slice(&args_slice) };
- rooted!(in(cx) let mut result = UndefinedValue());
+ rooted!(in(*cx) let mut result = UndefinedValue());
unsafe {
Call(
- cx,
+ *cx,
paint_instance.handle(),
paint_function.handle(),
&args,
@@ -356,10 +356,10 @@ impl PaintWorkletGlobalScope {
let missing_image_urls = rendering_context.take_missing_image_urls();
// Step 13.
- if unsafe { JS_IsExceptionPending(cx) } {
+ if unsafe { JS_IsExceptionPending(*cx) } {
debug!("Paint function threw an exception {}.", name);
unsafe {
- JS_ClearPendingException(cx);
+ JS_ClearPendingException(*cx);
}
return self.invalid_image(size_in_dpx, missing_image_urls);
}
@@ -518,8 +518,8 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
fn RegisterPaint(&self, name: DOMString, paint_ctor: Rc<VoidFunction>) -> Fallible<()> {
let name = Atom::from(name);
let cx = self.worklet_global.get_cx();
- rooted!(in(cx) let paint_obj = paint_ctor.callback_holder().get());
- rooted!(in(cx) let paint_val = ObjectValue(paint_obj.get()));
+ rooted!(in(*cx) let paint_obj = paint_ctor.callback_holder().get());
+ rooted!(in(*cx) let paint_val = ObjectValue(paint_obj.get()));
debug!("Registering paint image name {}.", name);
@@ -535,20 +535,20 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
// Step 4-6.
let mut property_names: Vec<String> =
- unsafe { get_property(cx, paint_obj.handle(), "inputProperties", ()) }?
+ unsafe { get_property(*cx, paint_obj.handle(), "inputProperties", ()) }?
.unwrap_or_default();
let properties = property_names.drain(..).map(Atom::from).collect();
// Step 7-9.
let input_arguments: Vec<String> =
- unsafe { get_property(cx, paint_obj.handle(), "inputArguments", ()) }?
+ unsafe { get_property(*cx, paint_obj.handle(), "inputArguments", ()) }?
.unwrap_or_default();
// TODO: Steps 10-11.
// Steps 12-13.
let alpha: bool =
- unsafe { get_property(cx, paint_obj.handle(), "alpha", ()) }?.unwrap_or(true);
+ unsafe { get_property(*cx, paint_obj.handle(), "alpha", ()) }?.unwrap_or(true);
// Step 14
if unsafe { !IsConstructor(paint_obj.get()) } {
@@ -556,19 +556,24 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
}
// Steps 15-16
- rooted!(in(cx) let mut prototype = UndefinedValue());
+ rooted!(in(*cx) let mut prototype = UndefinedValue());
unsafe {
- get_property_jsval(cx, paint_obj.handle(), "prototype", prototype.handle_mut())?;
+ get_property_jsval(*cx, paint_obj.handle(), "prototype", prototype.handle_mut())?;
}
if !prototype.is_object() {
return Err(Error::Type(String::from("Prototype is not an object.")));
}
- rooted!(in(cx) let prototype = prototype.to_object());
+ rooted!(in(*cx) let prototype = prototype.to_object());
// Steps 17-18
- rooted!(in(cx) let mut paint_function = UndefinedValue());
+ rooted!(in(*cx) let mut paint_function = UndefinedValue());
unsafe {
- get_property_jsval(cx, prototype.handle(), "paint", paint_function.handle_mut())?;
+ get_property_jsval(
+ *cx,
+ prototype.handle(),
+ "paint",
+ paint_function.handle_mut(),
+ )?;
}
if !paint_function.is_object() || unsafe { !IsCallable(paint_function.to_object()) } {
return Err(Error::Type(String::from("Paint function is not callable.")));