mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
script: introduce safe wrappers for js val conversions (#38004)
Introduce a safe wrapper trait for the unsafe `ToJSValConvertible`, and use it in `script/dom` where the default `T` implementation works. Part of https://github.com/servo/servo/issues/37951 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
9e2ee0029a
commit
027954dbad
16 changed files with 149 additions and 187 deletions
|
@ -6,11 +6,11 @@ use std::ptr;
|
|||
|
||||
use html5ever::interface::QualName;
|
||||
use html5ever::{LocalName, local_name, ns};
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
|
||||
use js::jsapi::{CallArgs, CurrentGlobalOrNull, JSAutoRealm, JSObject};
|
||||
use js::rust::wrappers::{JS_SetPrototype, JS_WrapObject};
|
||||
use js::rust::{HandleObject, MutableHandleObject, MutableHandleValue};
|
||||
use script_bindings::conversions::SafeToJSValConvertible;
|
||||
use script_bindings::interface::get_desired_proto;
|
||||
|
||||
use super::utils::ProtoOrIfaceArray;
|
||||
|
@ -242,7 +242,7 @@ fn html_constructor(
|
|||
|
||||
JS_SetPrototype(*cx, element.handle(), prototype.handle());
|
||||
|
||||
result.to_jsval(*cx, MutableHandleValue::from_raw(call_args.rval()));
|
||||
result.safe_to_jsval(cx, MutableHandleValue::from_raw(call_args.rval()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue