Clean up GlobalScope::report_an_error

This commit is contained in:
Anthony Ramine 2017-09-18 09:40:45 +02:00
parent a6af86824b
commit c53d1e46b4
2 changed files with 19 additions and 15 deletions

View file

@ -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.

View file

@ -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?