mirror of
https://github.com/servo/servo.git
synced 2025-07-21 22:33:41 +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
|
@ -9,7 +9,7 @@ use base::id::HistoryStateId;
|
|||
use dom_struct::dom_struct;
|
||||
use js::jsapi::Heap;
|
||||
use js::jsval::{JSVal, NullValue, UndefinedValue};
|
||||
use js::rust::HandleValue;
|
||||
use js::rust::{HandleValue, MutableHandleValue};
|
||||
use net_traits::{CoreResourceMsg, IpcSend};
|
||||
use profile_traits::ipc;
|
||||
use profile_traits::ipc::channel;
|
||||
|
@ -289,11 +289,12 @@ impl History {
|
|||
|
||||
impl HistoryMethods for History {
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-history-state>
|
||||
fn GetState(&self, _cx: JSContext) -> Fallible<JSVal> {
|
||||
fn GetState(&self, _cx: JSContext, mut retval: MutableHandleValue) -> Fallible<()> {
|
||||
if !self.window.Document().is_fully_active() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
Ok(self.state.get())
|
||||
retval.set(self.state.get());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-history-length>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue