mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
refactor: propagate CanGc arguments through callers (#35591)
Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
parent
02199520f2
commit
b0b0289014
74 changed files with 403 additions and 275 deletions
|
@ -105,7 +105,12 @@ pub(crate) type Fallible<T> = Result<T, Error>;
|
|||
pub(crate) type ErrorResult = Fallible<()>;
|
||||
|
||||
/// Set a pending exception for the given `result` on `cx`.
|
||||
pub(crate) fn throw_dom_exception(cx: SafeJSContext, global: &GlobalScope, result: Error) {
|
||||
pub(crate) fn throw_dom_exception(
|
||||
cx: SafeJSContext,
|
||||
global: &GlobalScope,
|
||||
result: Error,
|
||||
can_gc: CanGc,
|
||||
) {
|
||||
#[cfg(feature = "js_backtrace")]
|
||||
unsafe {
|
||||
capture_stack!(in(*cx) let stack);
|
||||
|
@ -159,7 +164,7 @@ pub(crate) fn throw_dom_exception(cx: SafeJSContext, global: &GlobalScope, resul
|
|||
|
||||
unsafe {
|
||||
assert!(!JS_IsExceptionPending(*cx));
|
||||
let exception = DOMException::new(global, code, CanGc::note());
|
||||
let exception = DOMException::new(global, code, can_gc);
|
||||
rooted!(in(*cx) let mut thrown = UndefinedValue());
|
||||
exception.to_jsval(*cx, thrown.handle_mut());
|
||||
JS_SetPendingException(*cx, thrown.handle(), ExceptionStackBehavior::Capture);
|
||||
|
@ -349,7 +354,7 @@ impl Error {
|
|||
Error::JSFailed => (),
|
||||
_ => unsafe { assert!(!JS_IsExceptionPending(*cx)) },
|
||||
}
|
||||
throw_dom_exception(cx, global, self);
|
||||
throw_dom_exception(cx, global, self, CanGc::note());
|
||||
unsafe {
|
||||
assert!(JS_IsExceptionPending(*cx));
|
||||
assert!(JS_GetPendingException(*cx, rval));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue