Rewrite Blob constructor interface

This commit is contained in:
Zhen Zhang 2016-05-10 20:19:10 +08:00
parent 33fa63a3c5
commit f43009333f
5 changed files with 60 additions and 50 deletions

View file

@ -20,7 +20,7 @@ use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString};
use dom::bindings::weakref::MutableWeakRef;
use dom::blob::Blob;
use dom::blob::{Blob, DataSlice};
use dom::url::URL;
use js::jsapi::{HandleValue, JSContext, JSObject};
use js::jsval::{JSVal, NullValue};
@ -100,7 +100,7 @@ impl TestBindingMethods for TestBinding {
fn EnumAttribute(&self) -> TestEnum { TestEnum::_empty }
fn SetEnumAttribute(&self, _: TestEnum) {}
fn InterfaceAttribute(&self) -> Root<Blob> {
Blob::new(self.global().r(), Vec::new(), "")
Blob::new(self.global().r(), DataSlice::empty(), "")
}
fn SetInterfaceAttribute(&self, _: &Blob) {}
fn UnionAttribute(&self) -> HTMLElementOrLong { HTMLElementOrLong::Long(0) }
@ -178,7 +178,7 @@ impl TestBindingMethods for TestBinding {
fn SetAttr_to_automatically_rename(&self, _: DOMString) {}
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(TestEnum::_empty) }
fn GetInterfaceAttributeNullable(&self) -> Option<Root<Blob>> {
Some(Blob::new(self.global().r(), Vec::new(), ""))
Some(Blob::new(self.global().r(), DataSlice::empty(), ""))
}
fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {}
fn GetInterfaceAttributeWeak(&self) -> Option<Root<URL>> {
@ -229,7 +229,7 @@ impl TestBindingMethods for TestBinding {
fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) }
fn ReceiveEnum(&self) -> TestEnum { TestEnum::_empty }
fn ReceiveInterface(&self) -> Root<Blob> {
Blob::new(self.global().r(), Vec::new(), "")
Blob::new(self.global().r(), DataSlice::empty(), "")
}
fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
fn ReceiveObject(&self, _: *mut JSContext) -> *mut JSObject { panic!() }
@ -246,7 +246,7 @@ impl TestBindingMethods for TestBinding {
}
fn ReceiveSequence(&self) -> Vec<i32> { vec![1] }
fn ReceiveInterfaceSequence(&self) -> Vec<Root<Blob>> {
vec![Blob::new(self.global().r(), Vec::new(), "")]
vec![Blob::new(self.global().r(), DataSlice::empty(), "")]
}
fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) }
@ -267,7 +267,7 @@ impl TestBindingMethods for TestBinding {
fn ReceiveNullableByteString(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(TestEnum::_empty) }
fn ReceiveNullableInterface(&self) -> Option<Root<Blob>> {
Some(Blob::new(self.global().r(), Vec::new(), ""))
Some(Blob::new(self.global().r(), DataSlice::empty(), ""))
}
fn ReceiveNullableObject(&self, _: *mut JSContext) -> *mut JSObject { ptr::null_mut() }
fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> {