mirror of
https://github.com/servo/servo.git
synced 2025-10-15 16:00:28 +01:00
Turn on GC all the time. Fix rooting errors during parsing and storing timers. Fix borrow errors during tracing.
This commit is contained in:
parent
4051a8096d
commit
ffdc3f5b32
109 changed files with 1567 additions and 996 deletions
|
@ -5,7 +5,7 @@
|
|||
use dom::bindings::codegen::PrototypeList;
|
||||
use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH;
|
||||
use dom::bindings::conversions::{FromJSValConvertible, IDLInterface};
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::js::{JS, JSRef};
|
||||
use dom::bindings::trace::Untraceable;
|
||||
use dom::browsercontext;
|
||||
use dom::window;
|
||||
|
@ -37,7 +37,6 @@ use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative};
|
|||
use js::jsapi::{JSFunctionSpec, JSPropertySpec};
|
||||
use js::jsapi::{JS_NewGlobalObject, JS_InitStandardClasses};
|
||||
use js::jsapi::{JSString};
|
||||
use js::jsapi::{JS_AllowGC, JS_InhibitGC};
|
||||
use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType;
|
||||
use js::jsval::JSVal;
|
||||
use js::jsval::{PrivateValue, ObjectValue, NullValue, ObjectOrNullValue};
|
||||
|
@ -390,8 +389,8 @@ pub trait Reflectable {
|
|||
|
||||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: ~T,
|
||||
window: &JS<window::Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JS<window::Window>, ~T) -> JS<T>)
|
||||
window: &JSRef<window::Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, ~T) -> JS<T>)
|
||||
-> JS<T> {
|
||||
JS::new(obj, window, wrap_fn)
|
||||
}
|
||||
|
@ -637,26 +636,6 @@ pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *JSContext {
|
|||
cx_for_dom_reflector(obj.reflector().get_jsobject())
|
||||
}
|
||||
|
||||
/// Execute arbitrary code with the JS GC enabled, then disable it afterwards.
|
||||
pub fn with_gc_enabled<R>(cx: *JSContext, f: || -> R) -> R {
|
||||
unsafe {
|
||||
JS_AllowGC(cx);
|
||||
let rv = f();
|
||||
JS_InhibitGC(cx);
|
||||
rv
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute arbitrary code with the JS GC disabled, then enable it afterwards.
|
||||
pub fn with_gc_disabled<R>(cx: *JSContext, f: || -> R) -> R {
|
||||
unsafe {
|
||||
JS_InhibitGC(cx);
|
||||
let rv = f();
|
||||
JS_AllowGC(cx);
|
||||
rv
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name
|
||||
/// for details.
|
||||
#[deriving(Eq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue