diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 6e78e4e3316..e0b044b28a3 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -16,7 +16,7 @@ use dom::bindings::codegen::UnionTypes::EventOrUSVString; use dom::bindings::codegen::UnionTypes::EventOrUSVString::eUSVString; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::eLong; -use dom::bindings::global::{GlobalField, GlobalRef}; +use dom::bindings::global::{GlobalRef, global_root_from_reflector}; use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::Reflector; @@ -32,7 +32,6 @@ use util::str::DOMString; #[dom_struct] pub struct TestBinding { reflector_: Reflector, - global: GlobalField, } impl TestBindingMethods for TestBinding { @@ -71,8 +70,7 @@ impl TestBindingMethods for TestBinding { fn EnumAttribute(&self) -> TestEnum { _empty } fn SetEnumAttribute(&self, _: TestEnum) {} fn InterfaceAttribute(&self) -> Root { - let global = self.global.root(); - Blob::new(global.r(), None, "") + Blob::new(global_root_from_reflector(self).r(), None, "") } fn SetInterfaceAttribute(&self, _: &Blob) {} fn UnionAttribute(&self) -> HTMLElementOrLong { eLong(0) } @@ -128,8 +126,7 @@ impl TestBindingMethods for TestBinding { fn SetAttr_to_automatically_rename(&self, _: DOMString) {} fn GetEnumAttributeNullable(&self) -> Option { Some(_empty) } fn GetInterfaceAttributeNullable(&self) -> Option> { - let global = self.global.root(); - Some(Blob::new(global.r(), None, "")) + Some(Blob::new(global_root_from_reflector(self).r(), None, "")) } fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {} fn GetObjectAttributeNullable(&self, _: *mut JSContext) -> *mut JSObject { ptr::null_mut() } @@ -158,8 +155,7 @@ impl TestBindingMethods for TestBinding { fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) } fn ReceiveEnum(&self) -> TestEnum { _empty } fn ReceiveInterface(&self) -> Root { - let global = self.global.root(); - Blob::new(global.r(), None, "") + Blob::new(global_root_from_reflector(self).r(), None, "") } fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() } fn ReceiveObject(&self, _: *mut JSContext) -> *mut JSObject { panic!() } @@ -184,8 +180,7 @@ impl TestBindingMethods for TestBinding { fn ReceiveNullableByteString(&self) -> Option { Some(ByteString::new(vec!())) } fn ReceiveNullableEnum(&self) -> Option { Some(_empty) } fn ReceiveNullableInterface(&self) -> Option> { - let global = self.global.root(); - Some(Blob::new(global.r(), None, "")) + Some(Blob::new(global_root_from_reflector(self).r(), None, "")) } fn ReceiveNullableObject(&self, _: *mut JSContext) -> *mut JSObject { ptr::null_mut() } fn ReceiveNullableUnion(&self) -> Option { Some(eLong(0)) }