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
|
@ -5,7 +5,6 @@
|
|||
use std::ptr;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{
|
||||
ESClass, GetBuiltinClass, IsArrayBufferObject, JS_DeleteUCProperty,
|
||||
JS_GetOwnUCPropertyDescriptor, JS_GetStringLength, JS_IsArrayBufferViewObject, JSObject,
|
||||
|
@ -20,6 +19,7 @@ use net_traits::indexeddb_thread::{
|
|||
IndexedDBThreadMsg, SyncOperation,
|
||||
};
|
||||
use profile_traits::ipc;
|
||||
use script_bindings::conversions::SafeToJSValConvertible;
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::codegen::Bindings::IDBDatabaseBinding::IDBObjectStoreParameters;
|
||||
|
@ -236,7 +236,7 @@ impl IDBObjectStore {
|
|||
rooted!(in(*cx) let input_val = current_val.to_string());
|
||||
unsafe {
|
||||
let string_len = JS_GetStringLength(*input_val) as u64;
|
||||
string_len.to_jsval(*cx, return_val);
|
||||
string_len.safe_to_jsval(cx, return_val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue