mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Add/update comments with links to spec
Extracted out of #5649 * add more hyperlinks to associated specification for structs/methods * follow redirects and update links * replace broken links * removal of WHATWG multipage page name since the page name is not guaranteed to be stable
This commit is contained in:
parent
7f422e2076
commit
cc4a64e1fe
19 changed files with 112 additions and 35 deletions
|
@ -23,6 +23,7 @@ pub enum BlobTypeId {
|
|||
File,
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#blob
|
||||
#[dom_struct]
|
||||
pub struct Blob {
|
||||
reflector_: Reflector,
|
||||
|
@ -59,10 +60,12 @@ impl Blob {
|
|||
BlobBinding::Wrap)
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<Blob>> {
|
||||
Ok(Blob::new(global, None, ""))
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
||||
pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
|
||||
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
|
||||
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
|
||||
|
@ -77,6 +80,7 @@ impl Blob {
|
|||
}
|
||||
|
||||
impl<'a> BlobMethods for JSRef<'a, Blob> {
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-size
|
||||
fn Size(self) -> u64{
|
||||
match self.bytes {
|
||||
None => 0,
|
||||
|
@ -84,10 +88,12 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
|
|||
}
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-type
|
||||
fn Type(self) -> DOMString {
|
||||
self.typeString.clone()
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo
|
||||
fn Slice(self, start: Option<i64>, end: Option<i64>,
|
||||
contentType: Option<DOMString>) -> Temporary<Blob> {
|
||||
let size: i64 = self.Size().to_i64().unwrap();
|
||||
|
@ -135,10 +141,12 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
|
|||
}
|
||||
}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-isClosed
|
||||
//fn IsClosed(self) -> bool {
|
||||
// self.isClosed_.clone()
|
||||
//}
|
||||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-close
|
||||
//fn Close(self) {
|
||||
// TODO
|
||||
//}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue