Auto merge of #15300 - servo:blob-fragment, r=Wafflespeanut

Remove unused part of the return value of parse_blob_url().

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15300)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-30 06:21:46 -08:00 committed by GitHub
commit 81712560ca
3 changed files with 4 additions and 5 deletions

View file

@ -22,7 +22,7 @@ pub fn load_blob_sync
filemanager: FileManager) filemanager: FileManager)
-> Result<(Headers, Vec<u8>), NetworkError> { -> Result<(Headers, Vec<u8>), NetworkError> {
let (id, origin) = match parse_blob_url(&url) { let (id, origin) = match parse_blob_url(&url) {
Ok((id, origin, _fragment)) => (id, origin), Ok((id, origin)) => (id, origin),
Err(()) => { Err(()) => {
let e = format!("Invalid blob URL format {:?}", url); let e = format!("Invalid blob URL format {:?}", url);
return Err(NetworkError::Internal(e)); return Err(NetworkError::Internal(e));

View file

@ -35,15 +35,14 @@ pub struct BlobBuf {
/// Parse URL as Blob URL scheme's definition /// Parse URL as Blob URL scheme's definition
/// https://w3c.github.io/FileAPI/#DefinitionOfScheme /// https://w3c.github.io/FileAPI/#DefinitionOfScheme
pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin, Option<String>), ()> { pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {
let url_inner = try!(Url::parse(url.path()).map_err(|_| ())); let url_inner = try!(Url::parse(url.path()).map_err(|_| ()));
let fragment = url_inner.fragment().map(|s| s.to_string());
let id = { let id = {
let mut segs = try!(url_inner.path_segments().ok_or(())); let mut segs = try!(url_inner.path_segments().ok_or(()));
let id = try!(segs.nth(0).ok_or(())); let id = try!(segs.nth(0).ok_or(()));
try!(Uuid::from_str(id).map_err(|_| ())) try!(Uuid::from_str(id).map_err(|_| ()))
}; };
Ok((id, get_blob_origin(&ServoUrl::from_url(url_inner)), fragment)) Ok((id, get_blob_origin(&ServoUrl::from_url(url_inner))))
} }
/// Given an URL, returning the Origin that a Blob created under this /// Given an URL, returning the Origin that a Blob created under this

View file

@ -126,7 +126,7 @@ impl URL {
let origin = get_blob_origin(&global.get_url()); let origin = get_blob_origin(&global.get_url());
if let Ok(url) = ServoUrl::parse(&url) { if let Ok(url) = ServoUrl::parse(&url) {
if let Ok((id, _, _)) = parse_blob_url(&url) { if let Ok((id, _)) = parse_blob_url(&url) {
let resource_threads = global.resource_threads(); let resource_threads = global.resource_threads();
let (tx, rx) = ipc::channel().unwrap(); let (tx, rx) = ipc::channel().unwrap();
let msg = FileManagerThreadMsg::RevokeBlobURL(id, origin, tx); let msg = FileManagerThreadMsg::RevokeBlobURL(id, origin, tx);