mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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.
|
// Step 2.
|
||||||
self.in_error_reporting_mode.set(true);
|
self.in_error_reporting_mode.set(true);
|
||||||
|
|
||||||
// Steps 3-12.
|
// Steps 3-6.
|
||||||
// FIXME(#13195): muted errors.
|
// FIXME(#13195): muted errors.
|
||||||
let event = ErrorEvent::new(self,
|
let event = ErrorEvent::new(
|
||||||
atom!("error"),
|
self,
|
||||||
EventBubbles::DoesNotBubble,
|
atom!("error"),
|
||||||
EventCancelable::Cancelable,
|
EventBubbles::DoesNotBubble,
|
||||||
error_info.message.as_str().into(),
|
EventCancelable::Cancelable,
|
||||||
error_info.filename.as_str().into(),
|
error_info.message.as_str().into(),
|
||||||
error_info.lineno,
|
error_info.filename.as_str().into(),
|
||||||
error_info.column,
|
error_info.lineno,
|
||||||
value);
|
error_info.column,
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
|
||||||
// Step 13.
|
// Step 7.
|
||||||
let event_status = event.upcast::<Event>().fire(self.upcast::<EventTarget>());
|
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 {
|
if event_status == EventStatus::NotCanceled {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#runtime-script-errors-2
|
||||||
if let Some(dedicated) = self.downcast::<DedicatedWorkerGlobalScope>() {
|
if let Some(dedicated) = self.downcast::<DedicatedWorkerGlobalScope>() {
|
||||||
dedicated.forward_error_to_worker_object(error_info);
|
dedicated.forward_error_to_worker_object(error_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 14
|
|
||||||
self.in_error_reporting_mode.set(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the `&ResourceThreads` for this global scope.
|
/// Get the `&ResourceThreads` for this global scope.
|
||||||
|
|
|
@ -2005,7 +2005,7 @@ impl Window {
|
||||||
MessageEvent::dispatch_jsval(
|
MessageEvent::dispatch_jsval(
|
||||||
this.upcast(),
|
this.upcast(),
|
||||||
this.upcast(),
|
this.upcast(),
|
||||||
message.handle(),
|
message_clone.handle(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue