Auto merge of #12649 - Ms2ger:update-script, r=Manishearth

Some fixes to the script crate.

<!-- 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/12649)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-29 04:42:18 -05:00 committed by GitHub
commit 74d3b87c3e
3 changed files with 6 additions and 7 deletions

View file

@ -178,7 +178,7 @@ impl ErrorInfo {
}) })
} }
fn from_dom_exception(cx: *mut JSContext, object: HandleObject) -> Option<ErrorInfo> { fn from_dom_exception(object: HandleObject) -> Option<ErrorInfo> {
let exception = match root_from_object::<DOMException>(object.get()) { let exception = match root_from_object::<DOMException>(object.get()) {
Ok(exception) => exception, Ok(exception) => exception,
Err(_) => return None, Err(_) => return None,
@ -215,7 +215,7 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
rooted!(in(cx) let object = value.to_object()); rooted!(in(cx) let object = value.to_object());
let error_info = ErrorInfo::from_native_error(cx, object.handle()) let error_info = ErrorInfo::from_native_error(cx, object.handle())
.or_else(|| ErrorInfo::from_dom_exception(cx, object.handle())); .or_else(|| ErrorInfo::from_dom_exception(object.handle()));
let error_info = match error_info { let error_info = match error_info {
Some(error_info) => error_info, Some(error_info) => error_info,
None => { None => {

View file

@ -10,7 +10,6 @@
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(custom_derive)] #![feature(custom_derive)]
#![feature(fnbox)] #![feature(fnbox)]
#![feature(iter_arith)]
#![feature(mpsc_select)] #![feature(mpsc_select)]
#![feature(nonzero)] #![feature(nonzero)]
#![feature(on_unimplemented)] #![feature(on_unimplemented)]

View file

@ -120,7 +120,7 @@ pub unsafe fn new_rt_and_cx() -> Runtime {
// Pre barriers aren't working correctly at the moment // Pre barriers aren't working correctly at the moment
DisableIncrementalGC(runtime.rt()); DisableIncrementalGC(runtime.rt());
set_gc_zeal_options(runtime.cx()); set_gc_zeal_options(runtime.rt());
// Enable or disable the JITs. // Enable or disable the JITs.
let rt_opts = &mut *RuntimeOptionsRef(runtime.rt()); let rt_opts = &mut *RuntimeOptionsRef(runtime.rt());
@ -400,7 +400,7 @@ unsafe extern fn trace_rust_roots(tr: *mut JSTracer, _data: *mut os::raw::c_void
#[allow(unsafe_code)] #[allow(unsafe_code)]
#[cfg(feature = "debugmozjs")] #[cfg(feature = "debugmozjs")]
unsafe fn set_gc_zeal_options(cx: *mut JSContext) { unsafe fn set_gc_zeal_options(rt: *mut JSRuntime) {
use js::jsapi::{JS_DEFAULT_ZEAL_FREQ, JS_SetGCZeal}; use js::jsapi::{JS_DEFAULT_ZEAL_FREQ, JS_SetGCZeal};
let level = match PREFS.get("js.mem.gc.zeal.level").as_i64() { let level = match PREFS.get("js.mem.gc.zeal.level").as_i64() {
@ -411,9 +411,9 @@ unsafe fn set_gc_zeal_options(cx: *mut JSContext) {
Some(frequency) if frequency >= 0 => frequency as u32, Some(frequency) if frequency >= 0 => frequency as u32,
_ => JS_DEFAULT_ZEAL_FREQ, _ => JS_DEFAULT_ZEAL_FREQ,
}; };
JS_SetGCZeal(cx, level, frequency); JS_SetGCZeal(rt, level, frequency);
} }
#[allow(unsafe_code)] #[allow(unsafe_code)]
#[cfg(not(feature = "debugmozjs"))] #[cfg(not(feature = "debugmozjs"))]
unsafe fn set_gc_zeal_options(_: *mut JSContext) {} unsafe fn set_gc_zeal_options(_: *mut JSRuntime) {}