servo: Merge #10190 - Remove JS_SaveFrameChain and JS_RestoreFrameChain calls (from Ms2ger:framechain); r=jdm
authorMs2ger <Ms2ger@gmail.com>
Tue, 17 May 2016 10:14:14 -0700
changeset 338823 bb9c1d806c9e12e26982e251e1395940f1b01708
parent 338822 6e2d1b1a83a7ba686cf850279034585d24c93ca7
child 338824 b20b968d060e8a974c5ddf53d05624a2cfe9fcc6
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #10190 - Remove JS_SaveFrameChain and JS_RestoreFrameChain calls (from Ms2ger:framechain); r=jdm They were cargo-culted from Gecko, where they haven't been necessary for a while either. Source-Repo: https://github.com/servo/servo Source-Revision: a5cfbb226e5760cbc79519d3b518601dd817593d
servo/components/script/dom/bindings/callback.rs
servo/components/script/dom/bindings/error.rs
--- a/servo/components/script/dom/bindings/callback.rs
+++ b/servo/components/script/dom/bindings/callback.rs
@@ -8,17 +8,16 @@ use dom::bindings::error::{Error, Fallib
 use dom::bindings::global::global_root_from_object;
 use dom::bindings::reflector::Reflectable;
 use js::jsapi::GetGlobalForObjectCrossCompartment;
 use js::jsapi::JSAutoCompartment;
 use js::jsapi::{Heap, MutableHandleObject, RootedObject, RootedValue};
 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::jsapi::{JS_RestoreFrameChain, JS_SaveFrameChain};
 use js::jsval::{JSVal, UndefinedValue};
 use std::default::Default;
 use std::ffi::CString;
 use std::intrinsics::return_address;
 use std::ptr;
 use std::rc::Rc;
 
 /// The exception handling used for a call.
@@ -191,21 +190,14 @@ impl Drop for CallSetup {
     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 old_global = RootedObject::new(self.cx, self.exception_compartment.ptr);
-                let saved = JS_SaveFrameChain(self.cx);
-                {
-                    let _ac = JSAutoCompartment::new(self.cx, old_global.ptr);
-                    JS_ReportPendingException(self.cx);
-                }
-                if saved {
-                    JS_RestoreFrameChain(self.cx);
-                }
+                let _ac = JSAutoCompartment::new(self.cx, self.exception_compartment.ptr);
+                JS_ReportPendingException(self.cx);
             }
         }
     }
 }
--- a/servo/components/script/dom/bindings/error.rs
+++ b/servo/components/script/dom/bindings/error.rs
@@ -7,17 +7,16 @@
 use dom::bindings::codegen::PrototypeList::proto_id_to_name;
 use dom::bindings::conversions::ToJSValConvertible;
 use dom::bindings::global::GlobalRef;
 use dom::domexception::{DOMErrorName, DOMException};
 use js::error::{throw_range_error, throw_type_error};
 use js::jsapi::JSAutoCompartment;
 use js::jsapi::{JSContext, JSObject, RootedValue};
 use js::jsapi::{JS_IsExceptionPending, JS_ReportPendingException, JS_SetPendingException};
-use js::jsapi::{JS_RestoreFrameChain, JS_SaveFrameChain};
 use js::jsval::UndefinedValue;
 
 /// DOM exceptions that can be thrown by a native DOM method.
 #[derive(Debug, Clone, HeapSizeOf)]
 pub enum Error {
     /// IndexSizeError DOMException
     IndexSize,
     /// NotFoundError DOMException
@@ -120,24 +119,18 @@ pub unsafe fn throw_dom_exception(cx: *m
     exception.to_jsval(cx, thrown.handle_mut());
     JS_SetPendingException(cx, thrown.handle());
 }
 
 /// Report a pending exception, thereby clearing it.
 pub fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
     unsafe {
         if JS_IsExceptionPending(cx) {
-            let saved = JS_SaveFrameChain(cx);
-            {
-                let _ac = JSAutoCompartment::new(cx, obj);
-                JS_ReportPendingException(cx);
-            }
-            if saved {
-                JS_RestoreFrameChain(cx);
-            }
+            let _ac = JSAutoCompartment::new(cx, obj);
+            JS_ReportPendingException(cx);
         }
     }
 }
 
 /// Throw an exception to signal that a `JSVal` can not be converted to any of
 /// the types in an IDL union type.
 pub unsafe fn throw_not_in_union(cx: *mut JSContext, names: &'static str) {
     assert!(!JS_IsExceptionPending(cx));