mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Don't return early from report_pending_exception() if the value is an unexpected object.
We will now dispatch the error event in this case as well.
This commit is contained in:
parent
c4f87f451f
commit
154b16a25d
13 changed files with 31 additions and 19 deletions
|
@ -214,15 +214,16 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool)
|
|||
JS_ClearPendingException(cx);
|
||||
let error_info = if value.is_object() {
|
||||
rooted!(in(cx) let object = value.to_object());
|
||||
let error_info = ErrorInfo::from_native_error(cx, object.handle())
|
||||
.or_else(|| ErrorInfo::from_dom_exception(object.handle()));
|
||||
match error_info {
|
||||
Some(error_info) => error_info,
|
||||
None => {
|
||||
error!("Uncaught exception: failed to extract information");
|
||||
return;
|
||||
}
|
||||
}
|
||||
ErrorInfo::from_native_error(cx, object.handle())
|
||||
.or_else(|| ErrorInfo::from_dom_exception(object.handle()))
|
||||
.unwrap_or_else(|| {
|
||||
ErrorInfo {
|
||||
message: format!("uncaught exception: unknown (can't convert to string)"),
|
||||
filename: String::new(),
|
||||
lineno: 0,
|
||||
column: 0,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
match USVString::from_jsval(cx, value.handle(), ()) {
|
||||
Ok(ConversionResult::Success(USVString(string))) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue