mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Clean up GlobalScope::report_an_error
This commit is contained in:
parent
a6af86824b
commit
c53d1e46b4
2 changed files with 19 additions and 15 deletions
|
@ -313,30 +313,34 @@ impl GlobalScope {
|
|||
// Step 2.
|
||||
self.in_error_reporting_mode.set(true);
|
||||
|
||||
// Steps 3-12.
|
||||
// Steps 3-6.
|
||||
// FIXME(#13195): muted errors.
|
||||
let event = ErrorEvent::new(self,
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable,
|
||||
error_info.message.as_str().into(),
|
||||
error_info.filename.as_str().into(),
|
||||
error_info.lineno,
|
||||
error_info.column,
|
||||
value);
|
||||
let event = ErrorEvent::new(
|
||||
self,
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable,
|
||||
error_info.message.as_str().into(),
|
||||
error_info.filename.as_str().into(),
|
||||
error_info.lineno,
|
||||
error_info.column,
|
||||
value,
|
||||
);
|
||||
|
||||
// Step 13.
|
||||
// Step 7.
|
||||
let event_status = event.upcast::<Event>().fire(self.upcast::<EventTarget>());
|
||||
|
||||
// Step 15
|
||||
// Step 8.
|
||||
self.in_error_reporting_mode.set(false);
|
||||
|
||||
// Step 9.
|
||||
if event_status == EventStatus::NotCanceled {
|
||||
// https://html.spec.whatwg.org/multipage/#runtime-script-errors-2
|
||||
if let Some(dedicated) = self.downcast::<DedicatedWorkerGlobalScope>() {
|
||||
dedicated.forward_error_to_worker_object(error_info);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 14
|
||||
self.in_error_reporting_mode.set(false);
|
||||
}
|
||||
|
||||
/// Get the `&ResourceThreads` for this global scope.
|
||||
|
|
|
@ -2005,7 +2005,7 @@ impl Window {
|
|||
MessageEvent::dispatch_jsval(
|
||||
this.upcast(),
|
||||
this.upcast(),
|
||||
message.handle(),
|
||||
message_clone.handle(),
|
||||
);
|
||||
});
|
||||
// FIXME(nox): Why are errors silenced here?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue