diff options
author | Ms2ger <Ms2ger@gmail.com> | 2015-11-03 14:16:55 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-11-04 12:09:11 +0100 |
commit | 6b75078503f25a61084a3e9cae1b7d57de21772f (patch) | |
tree | ddfc15e73be407657f687f55d9c8b7bce5b9596c /components/script/dom/blob.rs | |
parent | e6aa976462fad0aafb2d59d0a590b69a8c8b5ba9 (diff) | |
download | servo-6b75078503f25a61084a3e9cae1b7d57de21772f.tar.gz servo-6b75078503f25a61084a3e9cae1b7d57de21772f.zip |
Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.
Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r-- | components/script/dom/blob.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index b42bcce573e..37a526eb15c 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -21,12 +21,12 @@ use util::str::DOMString; pub struct Blob { reflector_: Reflector, bytes: Option<Vec<u8>>, - typeString: DOMString, + typeString: String, global: GlobalField, isClosed_: Cell<bool> } -fn is_ascii_printable(string: &DOMString) -> bool { +fn is_ascii_printable(string: &str) -> bool { // Step 5.1 in Sec 5.1 of File API spec // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob string.chars().all(|c| { c >= '\x20' && c <= '\x7E' }) @@ -60,7 +60,7 @@ impl Blob { pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Root<Blob>> { //TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob - let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes()); + let bytes: Option<Vec<u8>> = Some(blobParts.0.into_bytes()); let typeString = if is_ascii_printable(&blobPropertyBag.type_) { &*blobPropertyBag.type_ } else { @@ -85,7 +85,7 @@ impl BlobMethods for Blob { // https://dev.w3.org/2006/webapi/FileAPI/#dfn-type fn Type(&self) -> DOMString { - self.typeString.clone() + DOMString(self.typeString.clone()) } // https://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo |