mirror of
https://github.com/servo/servo.git
synced 2025-06-18 21:34:30 +00:00
Invert conditional and return early from report_pending_exception
This commit is contained in:
parent
3916d1d613
commit
f064d9ad83
1 changed files with 42 additions and 42 deletions
|
@ -202,7 +202,8 @@ impl ErrorInfo {
|
|||
/// The `dispatch_event` argument is temporary and non-standard; passing false
|
||||
/// prevents dispatching the `error` event.
|
||||
pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool) {
|
||||
if JS_IsExceptionPending(cx) {
|
||||
if !JS_IsExceptionPending(cx) { return; }
|
||||
|
||||
rooted!(in(cx) let mut value = UndefinedValue());
|
||||
if !JS_GetPendingException(cx, value.handle_mut()) {
|
||||
JS_ClearPendingException(cx);
|
||||
|
@ -249,7 +250,6 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool)
|
|||
.report_an_error(error_info, value.handle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Throw an exception to signal that a `JSVal` can not be converted to any of
|
||||
/// the types in an IDL union type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue