Clean up the conversion routines

Functions returning `Root<T>` are prefixed by "root_" and the ones returning
`*const T` by "native_".

Functions taking `*mut JSObject` are now suffixed by "_from_object" and the ones
taking `&T` by "_from_reflector".
This commit is contained in:
Anthony Ramine 2015-10-25 11:11:23 +01:00
parent aa105d89b4
commit b290a3161d
10 changed files with 45 additions and 61 deletions

View file

@ -12,8 +12,7 @@ use dom::bindings::codegen::Bindings::FunctionBinding::Function;
use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
use dom::bindings::codegen::Bindings::WindowBinding::{self, FrameRequestCallback, WindowMethods};
use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::global::GlobalRef;
use dom::bindings::global::global_object_for_js_object;
use dom::bindings::global::{GlobalRef, global_root_from_reflector};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::RootedReference;
use dom::bindings::js::{JS, MutNullableHeap, Root};
@ -766,8 +765,7 @@ impl<'a, T: Reflectable> ScriptHelpers for &'a T {
#[allow(unsafe_code)]
fn evaluate_script_on_global_with_result(self, code: &str, filename: &str,
rval: MutableHandleValue) {
let this = self.reflector().get_jsobject();
let global = global_object_for_js_object(this.get());
let global = global_root_from_reflector(self);
let cx = global.r().get_cx();
let _ar = JSAutoRequest::new(cx);
let globalhandle = global.r().reflector().get_jsobject();