mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use out parameter for generated methods returning JSVal (#34087)
* Make generated bindings that return a WebIDL `any` value use out parameters. Returning raw JSVal values makes it easier to create GC hazards in code that calls these methods. Accepting a MutableHandle argument instead ensures that the values are rooted by the caller. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
537958a3cc
commit
25a0764a37
38 changed files with 763 additions and 515 deletions
|
@ -16,7 +16,7 @@ use dom_struct::dom_struct;
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::panic::maybe_resume_unwind;
|
||||
use js::rust::{HandleValue, ParentRuntime};
|
||||
use js::rust::{HandleValue, MutableHandleValue, ParentRuntime};
|
||||
use net_traits::request::{
|
||||
CredentialsMode, Destination, ParserMetadata, RequestBuilder as NetRequestInit,
|
||||
};
|
||||
|
@ -439,9 +439,10 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
|||
cx: JSContext,
|
||||
value: HandleValue,
|
||||
options: RootedTraceableBox<StructuredSerializeOptions>,
|
||||
) -> Fallible<js::jsval::JSVal> {
|
||||
retval: MutableHandleValue,
|
||||
) -> Fallible<()> {
|
||||
self.upcast::<GlobalScope>()
|
||||
.structured_clone(cx, value, options)
|
||||
.structured_clone(cx, value, options, retval)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue