mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #13057 - servo:rpe-ac, r=nox
Remove the JSAutoCompartment from report_pending_exception. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13057) <!-- Reviewable:end -->
This commit is contained in:
commit
0be94bb7cc
5 changed files with 11 additions and 10 deletions
|
@ -8,6 +8,7 @@ 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};
|
||||
|
@ -189,7 +190,8 @@ impl<'a> Drop for CallSetup<'a> {
|
|||
unsafe {
|
||||
JS_LeaveCompartment(self.cx, self.old_compartment);
|
||||
if self.handling == ExceptionHandling::Report {
|
||||
report_pending_exception(self.cx, *self.exception_compartment);
|
||||
let _ac = JSAutoCompartment::new(self.cx, *self.exception_compartment);
|
||||
report_pending_exception(self.cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@ use dom::bindings::str::USVString;
|
|||
use dom::domexception::{DOMErrorName, DOMException};
|
||||
use js::error::{throw_range_error, throw_type_error};
|
||||
use js::jsapi::HandleObject;
|
||||
use js::jsapi::JSAutoCompartment;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsapi::JSObject;
|
||||
use js::jsapi::JS_ClearPendingException;
|
||||
use js::jsapi::JS_ErrorFromException;
|
||||
use js::jsapi::JS_GetPendingException;
|
||||
|
@ -194,9 +192,8 @@ impl ErrorInfo {
|
|||
}
|
||||
|
||||
/// Report a pending exception, thereby clearing it.
|
||||
pub unsafe fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
|
||||
pub unsafe fn report_pending_exception(cx: *mut JSContext) {
|
||||
if JS_IsExceptionPending(cx) {
|
||||
let _ac = JSAutoCompartment::new(cx, obj);
|
||||
rooted!(in(cx) let mut value = UndefinedValue());
|
||||
if !JS_GetPendingException(cx, value.handle_mut()) {
|
||||
JS_ClearPendingException(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue