Remove TestBinding::global

Use global_root_from_reflector() instead.
This commit is contained in:
Anthony Ramine 2015-10-22 01:27:28 +02:00
parent f84f16384d
commit 6d72293681

View file

@ -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<Blob> {
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<TestEnum> { Some(_empty) }
fn GetInterfaceAttributeNullable(&self) -> Option<Root<Blob>> {
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<Blob> {
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<ByteString> { Some(ByteString::new(vec!())) }
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(_empty) }
fn ReceiveNullableInterface(&self) -> Option<Root<Blob>> {
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<HTMLElementOrLong> { Some(eLong(0)) }