aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/callback.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-12-29 13:39:12 +0100
committerMs2ger <Ms2ger@gmail.com>2017-01-06 12:56:35 +0100
commitcb47a7e403e494dd17b69a5e6b46dd9c0300dd67 (patch)
tree4deae8ab3637b6b9b5b3b5368bd59c8f69a92972 /components/script/dom/bindings/callback.rs
parent839b7fe8ef57501ec876d66728e8d6ea9c1757f6 (diff)
downloadservo-cb47a7e403e494dd17b69a5e6b46dd9c0300dd67.tar.gz
servo-cb47a7e403e494dd17b69a5e6b46dd9c0300dd67.zip
Implement the entry global.
Partial fix for #10963.
Diffstat (limited to 'components/script/dom/bindings/callback.rs')
-rw-r--r--components/script/dom/bindings/callback.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index 30a6dfd5a2d..efe1b8a5681 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -7,6 +7,7 @@
use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::js::Root;
use dom::bindings::reflector::DomObject;
+use dom::bindings::settings_stack::AutoEntryScript;
use dom::globalscope::GlobalScope;
use js::jsapi::{Heap, MutableHandleObject};
use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject};
@@ -16,6 +17,7 @@ use js::jsapi::JS_GetProperty;
use js::jsval::{JSVal, UndefinedValue};
use std::default::Default;
use std::ffi::CString;
+use std::mem::drop;
use std::ptr;
use std::rc::Rc;
@@ -156,6 +158,9 @@ pub struct CallSetup {
old_compartment: *mut JSCompartment,
/// The exception handling used for the call.
handling: ExceptionHandling,
+ /// https://heycam.github.io/webidl/#es-invoking-callback-functions
+ /// steps 8 and 18.2.
+ entry_script: Option<AutoEntryScript>,
}
impl CallSetup {
@@ -167,11 +172,13 @@ impl CallSetup {
let global = unsafe { GlobalScope::from_object(callback.callback()) };
let cx = global.get_cx();
+ let aes = AutoEntryScript::new(&global);
CallSetup {
exception_global: global,
cx: cx,
old_compartment: unsafe { JS_EnterCompartment(cx, callback.callback()) },
handling: handling,
+ entry_script: Some(aes),
}
}
@@ -190,6 +197,7 @@ impl Drop for CallSetup {
self.exception_global.reflector().get_jsobject().get());
report_pending_exception(self.cx, true);
}
+ drop(self.entry_script.take().unwrap());
}
}
}