aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/promisenativehandler.rs
diff options
context:
space:
mode:
authorTipowol <void.indifferent@gmail.com>2020-04-05 19:54:30 +0200
committerTipowol <void.indifferent@gmail.com>2020-04-05 19:54:30 +0200
commit8a3bf880e98a946e45d4659b09a80b032b5d1734 (patch)
treedc68aa5f7677816f36608fad6ab1a045710d988e /components/script/dom/promisenativehandler.rs
parentae49473c25d61452d1cd02db03bc9760b6cd95c2 (diff)
downloadservo-8a3bf880e98a946e45d4659b09a80b032b5d1734.tar.gz
servo-8a3bf880e98a946e45d4659b09a80b032b5d1734.zip
Add InRealm argument to Callback trait
Diffstat (limited to 'components/script/dom/promisenativehandler.rs')
-rw-r--r--components/script/dom/promisenativehandler.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs
index c7e0ded5b4d..217bcc851c2 100644
--- a/components/script/dom/promisenativehandler.rs
+++ b/components/script/dom/promisenativehandler.rs
@@ -6,13 +6,14 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::globalscope::GlobalScope;
+use crate::realms::InRealm;
use dom_struct::dom_struct;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use malloc_size_of::MallocSizeOf;
pub trait Callback: JSTraceable + MallocSizeOf {
- fn callback(&self, cx: *mut JSContext, v: HandleValue);
+ fn callback(&self, cx: *mut JSContext, v: HandleValue, realm: InRealm);
}
#[dom_struct]
@@ -38,17 +39,22 @@ impl PromiseNativeHandler {
)
}
- fn callback(callback: &Option<Box<dyn Callback>>, cx: *mut JSContext, v: HandleValue) {
+ fn callback(
+ callback: &Option<Box<dyn Callback>>,
+ cx: *mut JSContext,
+ v: HandleValue,
+ realm: InRealm,
+ ) {
if let Some(ref callback) = *callback {
- callback.callback(cx, v)
+ callback.callback(cx, v, realm)
}
}
- pub fn resolved_callback(&self, cx: *mut JSContext, v: HandleValue) {
- PromiseNativeHandler::callback(&self.resolve, cx, v)
+ pub fn resolved_callback(&self, cx: *mut JSContext, v: HandleValue, realm: InRealm) {
+ PromiseNativeHandler::callback(&self.resolve, cx, v, realm)
}
- pub fn rejected_callback(&self, cx: *mut JSContext, v: HandleValue) {
- PromiseNativeHandler::callback(&self.reject, cx, v)
+ pub fn rejected_callback(&self, cx: *mut JSContext, v: HandleValue, realm: InRealm) {
+ PromiseNativeHandler::callback(&self.reject, cx, v, realm)
}
}