aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/error.rs
diff options
context:
space:
mode:
authorCYBAI <cyb.ai.815@gmail.com>2020-01-24 12:43:49 +0900
committerCYBAI <cyb.ai.815@gmail.com>2020-02-16 09:55:10 +0900
commit403ffcf1eb5c659626f70dec72f76aaf7782986d (patch)
treedf2f2e06ed557fcaac17862791a6c1db1f8a7b57 /components/script/dom/bindings/error.rs
parent795dab71fffe98434308732e4cb8ee682f28e465 (diff)
downloadservo-403ffcf1eb5c659626f70dec72f76aaf7782986d.tar.gz
servo-403ffcf1eb5c659626f70dec72f76aaf7782986d.zip
Always pass InRealm to GlobalScope::from_context to avoid getting null global
Diffstat (limited to 'components/script/dom/bindings/error.rs')
-rw-r--r--components/script/dom/bindings/error.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index dc03b660824..b88a6cabed3 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -14,6 +14,7 @@ use crate::dom::bindings::conversions::{
use crate::dom::bindings::str::USVString;
use crate::dom::domexception::{DOMErrorName, DOMException};
use crate::dom::globalscope::GlobalScope;
+use crate::realms::InRealm;
use crate::script_runtime::JSContext as SafeJSContext;
#[cfg(feature = "js_backtrace")]
use backtrace::Backtrace;
@@ -231,7 +232,7 @@ 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) {
+pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool, realm: InRealm) {
if !JS_IsExceptionPending(cx) {
return;
}
@@ -285,7 +286,7 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool)
}
if dispatch_event {
- GlobalScope::from_context(cx).report_an_error(error_info, value.handle());
+ GlobalScope::from_context(cx, realm).report_an_error(error_info, value.handle());
}
}