diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/blob.rs | 11 | ||||
-rw-r--r-- | components/script/dom/file.rs | 2 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 10 | ||||
-rw-r--r-- | components/script/dom/websocket.rs | 2 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 2 |
5 files changed, 13 insertions, 14 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index d8beec236a8..dcb4c68f34a 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -17,7 +17,6 @@ use ipc_channel::ipc; use net_traits::filemanager_thread::{FileManagerThreadMsg, SelectedFileId}; use num_traits::ToPrimitive; use std::ascii::AsciiExt; -use std::borrow::ToOwned; use std::cell::Cell; use std::cmp::{max, min}; use std::sync::Arc; @@ -127,16 +126,16 @@ pub struct Blob { } impl Blob { - pub fn new(global: GlobalRef, blob_impl: BlobImpl, typeString: &str) -> Root<Blob> { + pub fn new(global: GlobalRef, blob_impl: BlobImpl, typeString: String) -> Root<Blob> { let boxed_blob = box Blob::new_inherited(blob_impl, typeString); reflect_dom_object(boxed_blob, global, BlobBinding::Wrap) } - pub fn new_inherited(blob_impl: BlobImpl, typeString: &str) -> Blob { + pub fn new_inherited(blob_impl: BlobImpl, typeString: String) -> Blob { Blob { reflector_: Reflector::new(), blob_impl: blob_impl, - typeString: typeString.to_owned(), + typeString: typeString, isClosed_: Cell::new(false), } } @@ -156,7 +155,7 @@ impl Blob { }; let slice = DataSlice::from_bytes(bytes); - Ok(Blob::new(global, BlobImpl::new_from_slice(slice), &blobPropertyBag.get_typestring())) + Ok(Blob::new(global, BlobImpl::new_from_slice(slice), blobPropertyBag.get_typestring())) } /// Get a slice to inner data, this might incur synchronous read and caching @@ -252,7 +251,7 @@ impl BlobMethods for Blob { let global = self.global(); let bytes = self.get_slice_or_empty().bytes.clone(); let slice = DataSlice::new(bytes, start, end); - Blob::new(global.r(), BlobImpl::new_from_slice(slice), &relativeContentType) + Blob::new(global.r(), BlobImpl::new_from_slice(slice), relativeContentType.into()) } // https://w3c.github.io/FileAPI/#dfn-isClosed diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index c0ddd74233f..86e8888a88f 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -26,7 +26,7 @@ impl File { fn new_inherited(blob_impl: BlobImpl, name: DOMString, modified: Option<i64>, typeString: &str) -> File { File { - blob: Blob::new_inherited(blob_impl, typeString), + blob: Blob::new_inherited(blob_impl, typeString.to_owned()), name: name, // https://w3c.github.io/FileAPI/#dfn-lastModified modified: match modified { diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 4fe7512ddcc..95341751780 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -101,7 +101,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(), BlobImpl::new_from_empty_slice(), "") + Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "".to_owned()) } fn SetInterfaceAttribute(&self, _: &Blob) {} fn UnionAttribute(&self) -> HTMLElementOrLong { HTMLElementOrLong::Long(0) } @@ -179,7 +179,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(), BlobImpl::new_from_empty_slice(), "")) + Some(Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "".to_owned())) } fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {} fn GetInterfaceAttributeWeak(&self) -> Option<Root<URL>> { @@ -230,7 +230,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(), BlobImpl::new_from_empty_slice(), "") + Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "".to_owned()) } fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() } fn ReceiveObject(&self, _: *mut JSContext) -> *mut JSObject { panic!() } @@ -247,7 +247,7 @@ impl TestBindingMethods for TestBinding { } fn ReceiveSequence(&self) -> Vec<i32> { vec![1] } fn ReceiveInterfaceSequence(&self) -> Vec<Root<Blob>> { - vec![Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "")] + vec![Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "".to_owned())] } fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) } @@ -268,7 +268,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(), BlobImpl::new_from_empty_slice(), "")) + Some(Blob::new(self.global().r(), BlobImpl::new_from_empty_slice(), "".to_owned())) } fn ReceiveNullableObject(&self, _: *mut JSContext) -> *mut JSObject { ptr::null_mut() } fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> { diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 84ae5cc7ebd..dec5c509ece 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -592,7 +592,7 @@ impl Runnable for MessageReceivedTask { match ws.binary_type.get() { BinaryType::Blob => { let slice = DataSlice::from_bytes(data); - let blob = Blob::new(global.r(), BlobImpl::new_from_slice(slice), ""); + let blob = Blob::new(global.r(), BlobImpl::new_from_slice(slice), "".to_owned()); blob.to_jsval(cx, message.handle_mut()); } BinaryType::Arraybuffer => { diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 785a5928c9f..dd63a9f924e 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -1117,7 +1117,7 @@ impl XMLHttpRequest { // Step 3, 4 let slice = DataSlice::from_bytes(self.response.borrow().to_vec()); - let blob = Blob::new(self.global().r(), BlobImpl::new_from_slice(slice), &mime); + let blob = Blob::new(self.global().r(), BlobImpl::new_from_slice(slice), mime); self.response_blob.set(Some(blob.r())); blob } |