diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index 9d0b611a5d4a..4a45d43a43ec 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -43,6 +43,9 @@ path = "../canvas_traits" [dependencies.canvas] path = "../canvas" +[dependencies.plugins] +path = "../plugins" + [dependencies.azure] git = "https://github.com/servo/rust-azure" diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 40ea8f7fb33c..d4d267772668 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -248,7 +248,7 @@ fn initialize_png(width: usize, height: usize) -> (Vec, Vec String { - "compositor-reporter".to_string() + "compositor-reporter".to_owned() } impl IOCompositor { diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 0fbf07d55270..07dd9052b685 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -486,10 +486,10 @@ impl Constellation { } ConstellationMsg::GetClipboardContents(sender) => { let result = self.clipboard_ctx.as_ref().map_or( - "".to_string(), + "".to_owned(), |ctx| ctx.get_contents().unwrap_or_else(|e| { debug!("Error getting clipboard contents ({}), defaulting to empty string", e); - "".to_string() + "".to_owned() }) ); sender.send(result).unwrap(); diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 8852fe0acf81..5d00e8fc3bca 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -6,6 +6,8 @@ #![feature(iter_cmp)] #![feature(slice_bytes)] #![feature(vec_push_all)] +#![feature(plugin)] +#![plugin(plugins)] #![deny(unsafe_code)] diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index 1b9006ec00b2..70de430d0964 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -16,6 +16,9 @@ path = "../util" [dependencies.devtools_traits] path = "../devtools_traits" +[dependencies.plugins] +path = "../plugins" + [dependencies.png] git = "https://github.com/servo/rust-png" features = [ "serde-serialization" ] diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs index a27950f97b0b..57ae5265b5a1 100644 --- a/components/net/about_loader.rs +++ b/components/net/about_loader.rs @@ -21,7 +21,7 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar let chan = start_sending(start_chan, Metadata { final_url: load_data.url, content_type: Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![]))), - charset: Some("utf-8".to_string()), + charset: Some("utf-8".to_owned()), headers: None, status: Some(RawStatus(200, "OK".into())), }); @@ -37,7 +37,7 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar } _ => { start_sending(start_chan, Metadata::default(load_data.url)) - .send(Done(Err("Unknown about: URL.".to_string()))) + .send(Done(Err("Unknown about: URL.".to_owned()))) .unwrap(); return } diff --git a/components/net/cookie.rs b/components/net/cookie.rs index 7351e14e5c89..45b2b48926cb 100644 --- a/components/net/cookie.rs +++ b/components/net/cookie.rs @@ -46,7 +46,7 @@ impl Cookie { // Step 5 match PUB_DOMAINS.iter().find(|&x| domain == *x) { - Some(val) if *val == url_host => domain = "".to_string(), + Some(val) if *val == url_host => domain = "".to_owned(), Some(_) => return None, None => {} } @@ -154,7 +154,7 @@ impl Cookie { } } - if self.cookie.secure && url.scheme != "https".to_string() { + if self.cookie.secure && url.scheme != "https".to_owned() { return false; } if self.cookie.httponly && source == CookieSource::NonHTTP { diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs index 9abd20217a34..69f3eed37f6e 100644 --- a/components/net/cookie_storage.rs +++ b/components/net/cookie_storage.rs @@ -107,7 +107,7 @@ impl CookieStorage { _ => acc + ";" }) + &c.cookie.name + "=" + &c.cookie.value }; - let result = url_cookies.iter_mut().fold("".to_string(), reducer); + let result = url_cookies.iter_mut().fold("".to_owned(), reducer); info!(" === COOKIES SENT: {}", result); match result.len() { diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index ee556b0d6454..674f80325412 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -41,7 +41,7 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) { let parts: Vec<&str> = scheme_data.splitn(2, ',').collect(); if parts.len() != 2 { start_sending(start_chan, - metadata).send(Done(Err("invalid data uri".to_string()))).unwrap(); + metadata).send(Done(Err("invalid data uri".to_owned()))).unwrap(); return; } @@ -68,7 +68,7 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) { let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::>(); match bytes.from_base64() { Err(..) => { - progress_chan.send(Done(Err("non-base64 data uri".to_string()))).unwrap(); + progress_chan.send(Done(Err("non-base64 data uri".to_owned()))).unwrap(); } Ok(data) => { progress_chan.send(Payload(data)).unwrap(); diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index 1be29e321b19..d233256851ef 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -167,7 +167,7 @@ impl CORSCache for BasicCORSCache { None => { self.insert(CORSCacheEntry::new(request.origin, request.destination, new_max_age, request.credentials, - HeaderOrMethod::HeaderData(header_name.to_string()))); + HeaderOrMethod::HeaderData(header_name.to_owned()))); false } } @@ -228,13 +228,13 @@ impl CORSCache for CORSCacheSender { fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool { let (tx, rx) = channel(); - self.send(CORSCacheTaskMsg::MatchHeader(request, header_name.to_string(), tx)); + self.send(CORSCacheTaskMsg::MatchHeader(request, header_name.to_owned(), tx)); rx.recv().unwrap_or(false) } fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool { let (tx, rx) = channel(); - self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_string(), new_max_age, tx)); + self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_owned(), new_max_age, tx)); rx.recv().unwrap_or(false) } diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index dc2c11655de7..4abdff1945dd 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -155,7 +155,7 @@ impl Request { => vec![qitem(Mime(TopLevel::Image, SubLevel::Png, vec![])), // FIXME: This should properly generate a MimeType that has a // SubLevel of svg+xml (https://github.com/hyperium/mime.rs/issues/22) - qitem(Mime(TopLevel::Image, SubLevel::Ext("svg+xml".to_string()), vec![])), + qitem(Mime(TopLevel::Image, SubLevel::Ext("svg+xml".to_owned()), vec![])), QualityItem::new(Mime(TopLevel::Image, SubLevel::Star, vec![]), q(0.8)), QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.5))], Context::Form | Context::Frame | Context::Hyperlink | @@ -164,14 +164,14 @@ impl Request { => vec![qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])), // FIXME: This should properly generate a MimeType that has a // SubLevel of xhtml+xml (https://github.com/hyperium/mime.rs/issues/22) - qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])), + qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])), QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), q(0.9)), QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.8))], Context::Internal if self.context_frame_type != ContextFrameType::ContextNone => vec![qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])), // FIXME: This should properly generate a MimeType that has a // SubLevel of xhtml+xml (https://github.com/hyperium/mime.rs/issues/22) - qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])), + qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])), QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), q(0.9)), QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.8))], Context::Style diff --git a/components/net/file_loader.rs b/components/net/file_loader.rs index 9d01311b532a..b3e38bf4d711 100644 --- a/components/net/file_loader.rs +++ b/components/net/file_loader.rs @@ -29,7 +29,7 @@ fn read_block(reader: &mut File) -> Result { buf.truncate(n); Ok(ReadStatus::Partial(buf)) } - Err(e) => Err(e.description().to_string()), + Err(e) => Err(e.description().to_owned()), } } @@ -68,7 +68,7 @@ pub fn factory(load_data: LoadData, senders: LoadConsumer, classifier: Arc { let progress_chan = start_sending(senders, metadata); - progress_chan.send(Done(Err(e.description().to_string()))).unwrap(); + progress_chan.send(Done(Err(e.description().to_owned()))).unwrap(); } } } diff --git a/components/net/hsts.rs b/components/net/hsts.rs index ea8a04e16f6d..a9a793fc16da 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.rs @@ -121,7 +121,7 @@ pub fn preload_hsts_domains() -> Option { pub fn secure_url(url: &Url) -> Url { if &*url.scheme == "http" { let mut secure_url = url.clone(); - secure_url.scheme = "https".to_string(); + secure_url.scheme = "https".to_owned(); secure_url.relative_scheme_data_mut() .map(|scheme_data| { scheme_data.default_port = Some(443); diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 7a6e5e3e3cce..55e94ce3b466 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -124,7 +124,7 @@ fn load_for_consumer(load_data: LoadData, send_error(url, e, start_chan) } Err(LoadError::MaxRedirects(url)) => { - send_error(url, "too many redirects".to_string(), start_chan) + send_error(url, "too many redirects".to_owned(), start_chan) } Err(LoadError::Cors(url, msg)) | Err(LoadError::InvalidRedirect(url, msg)) | @@ -237,7 +237,7 @@ impl HttpRequestFactory for NetworkHttpRequestFactory { ) }, Err(e) => { - return Err(LoadError::Connection(url, e.description().to_string())) + return Err(LoadError::Connection(url, e.description().to_owned())) } }; @@ -267,13 +267,13 @@ impl HttpRequest for WrappedHttpRequest { let url = self.request.url.clone(); let mut request_writer = match self.request.start() { Ok(streaming) => streaming, - Err(e) => return Err(LoadError::Connection(url, e.description().to_string())) + Err(e) => return Err(LoadError::Connection(url, e.description().to_owned())) }; if let Some(ref data) = *body { match request_writer.write_all(&data) { Err(e) => { - return Err(LoadError::Connection(url, e.description().to_string())) + return Err(LoadError::Connection(url, e.description().to_owned())) } _ => {} } @@ -282,9 +282,9 @@ impl HttpRequest for WrappedHttpRequest { let response = match request_writer.send() { Ok(w) => w, Err(HttpError::Io(ref io_error)) if io_error.kind() == io::ErrorKind::ConnectionAborted => { - return Err(LoadError::ConnectionAborted(io_error.description().to_string())); + return Err(LoadError::ConnectionAborted(io_error.description().to_owned())); }, - Err(e) => return Err(LoadError::Connection(url, e.description().to_string())) + Err(e) => return Err(LoadError::Connection(url, e.description().to_owned())) }; Ok(WrappedHttpResponse { response: response }) @@ -315,7 +315,7 @@ fn set_default_accept(headers: &mut Headers) { if !headers.has::() { let accept = Accept(vec![ qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])), - qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])), + qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])), QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), Quality(900u16)), QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), Quality(800u16)), ]); @@ -374,7 +374,7 @@ fn update_sts_list_from_response(url: &Url, response: &HttpResponse, hsts_list: IncludeSubdomains::NotIncluded }; - if let Some(entry) = HSTSEntry::new(host.to_string(), include_subdomains, Some(header.max_age)) { + if let Some(entry) = HSTSEntry::new(host.to_owned(), include_subdomains, Some(header.max_age)) { info!("adding host {} to the strict transport security list", host); info!("- max-age {}", header.max_age); if header.include_subdomains { @@ -638,7 +638,7 @@ pub fn load(load_data: LoadData, return Err( LoadError::Cors( url, - "Preflight fetch inconsistent with main fetch".to_string())); + "Preflight fetch inconsistent with main fetch".to_owned())); } else { // XXXManishearth There are some CORS-related steps here, // but they don't seem necessary until credentials are implemented @@ -667,7 +667,7 @@ pub fn load(load_data: LoadData, } if redirected_to.contains(&url) { - return Err(LoadError::InvalidRedirect(doc_url, "redirect loop".to_string())); + return Err(LoadError::InvalidRedirect(doc_url, "redirect loop".to_owned())); } redirected_to.insert(doc_url.clone()); diff --git a/components/net/lib.rs b/components/net/lib.rs index c0077d2e0f0a..2d4f8309c5f1 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -8,6 +8,8 @@ #![feature(path_ext)] #![feature(plugin)] #![feature(vec_push_all)] +#![feature(plugin)] +#![plugin(plugins)] extern crate net_traits; extern crate cookie as cookie_rs; diff --git a/components/net/resource_task.rs b/components/net/resource_task.rs index f2c1cc196e36..d0fea0ac6c12 100644 --- a/components/net/resource_task.rs +++ b/components/net/resource_task.rs @@ -244,7 +244,7 @@ impl ResourceManager { _ => { debug!("resource_task: no loader for scheme {}", load_data.url.scheme); start_sending(consumer, Metadata::default(load_data.url)) - .send(ProgressMsg::Done(Err("no loader for scheme".to_string()))).unwrap(); + .send(ProgressMsg::Done(Err("no loader for scheme".to_owned()))).unwrap(); return } }; diff --git a/components/net/storage_task.rs b/components/net/storage_task.rs index 9c4934a07eed..c56efa283985 100644 --- a/components/net/storage_task.rs +++ b/components/net/storage_task.rs @@ -172,7 +172,7 @@ impl StorageManager { } fn origin_as_string(&self, url: Url) -> String { - let mut origin = "".to_string(); + let mut origin = "".to_owned(); origin.push_str(&url.scheme); origin.push_str("://"); url.domain().map(|domain| origin.push_str(&domain)); diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 04b1d3fd5217..32ce4e1714fb 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -241,6 +241,7 @@ dependencies = [ "net_traits 0.0.1", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", + "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "profile_traits 0.0.1", "script_traits 0.0.1", @@ -1086,6 +1087,7 @@ dependencies = [ "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "net_traits 0.0.1", "openssl 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "plugins 0.0.1", "png 0.1.0 (git+https://github.com/servo/rust-png)", "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "regex_macros 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",