aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/callback.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-07-05 20:20:23 +0200
committerMs2ger <Ms2ger@gmail.com>2016-07-05 20:20:23 +0200
commit72540009d5a1350f81fed05f3b6bb350489566f2 (patch)
tree75ac6736046df60355c314b02df24228d0b576e1 /components/script/dom/bindings/callback.rs
parent061cf054e7fe5019ef43c6fc13e49791fc25d99c (diff)
downloadservo-72540009d5a1350f81fed05f3b6bb350489566f2.tar.gz
servo-72540009d5a1350f81fed05f3b6bb350489566f2.zip
Reuse report_pending_exception in CallSetup.
Diffstat (limited to 'components/script/dom/bindings/callback.rs')
-rw-r--r--components/script/dom/bindings/callback.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index cc1266d27ab..c34598a26be 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -4,15 +4,14 @@
//! Base classes to work with IDL callbacks.
-use dom::bindings::error::{Error, Fallible};
+use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::global::global_root_from_object;
use dom::bindings::reflector::Reflectable;
use js::jsapi::GetGlobalForObjectCrossCompartment;
-use js::jsapi::JSAutoCompartment;
+use js::jsapi::JS_GetProperty;
use js::jsapi::{Heap, MutableHandleObject, RootedObject};
use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject};
use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment};
-use js::jsapi::{JS_GetProperty, JS_IsExceptionPending, JS_ReportPendingException};
use js::jsval::{JSVal, UndefinedValue};
use js::rust::RootedGuard;
use std::default::Default;
@@ -189,13 +188,8 @@ impl<'a> Drop for CallSetup<'a> {
fn drop(&mut self) {
unsafe {
JS_LeaveCompartment(self.cx, self.old_compartment);
- }
- let need_to_deal_with_exception = self.handling == ExceptionHandling::Report &&
- unsafe { JS_IsExceptionPending(self.cx) };
- if need_to_deal_with_exception {
- unsafe {
- let _ac = JSAutoCompartment::new(self.cx, *self.exception_compartment);
- JS_ReportPendingException(self.cx);
+ if self.handling == ExceptionHandling::Report {
+ report_pending_exception(self.cx, *self.exception_compartment);
}
}
}