diff options
author | Zhen Zhang <izgzhen@gmail.com> | 2016-07-15 01:02:21 +0800 |
---|---|---|
committer | Zhen Zhang <izgzhen@gmail.com> | 2016-07-15 20:33:51 +0800 |
commit | fdc3a8e3ac7ea5512e6fa09be892cd67ff6e8657 (patch) | |
tree | 51410a9abbf6d58aee8df62bd84d9737952c75dd /components/script/dom/url.rs | |
parent | 4b78b9adab916cc4fdde6248e785030b79f406da (diff) | |
download | servo-fdc3a8e3ac7ea5512e6fa09be892cd67ff6e8657.tar.gz servo-fdc3a8e3ac7ea5512e6fa09be892cd67ff6e8657.zip |
Put Blob URL online
Diffstat (limited to 'components/script/dom/url.rs')
-rw-r--r-- | components/script/dom/url.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 961d3c2fd29..81c806de806 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -15,8 +15,8 @@ use dom::urlhelper::UrlHelper; use dom::urlsearchparams::URLSearchParams; use ipc_channel::ipc; use net_traits::IpcSend; -use net_traits::blob_url_store::parse_blob_url; -use net_traits::filemanager_thread::{FileOrigin, SelectedFileId, FileManagerThreadMsg}; +use net_traits::blob_url_store::{get_blob_origin, parse_blob_url}; +use net_traits::filemanager_thread::{SelectedFileId, FileManagerThreadMsg}; use std::borrow::ToOwned; use std::default::Default; use url::quirks::domain_to_unicode; @@ -117,7 +117,7 @@ impl URL { pub fn CreateObjectURL(global: GlobalRef, blob: &Blob) -> DOMString { /// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround /// and should not be trusted. See issue https://github.com/servo/servo/issues/11722 - let origin = URL::get_blob_origin(&global.get_url()); + let origin = get_blob_origin(&global.get_url()); if blob.IsClosed() { // Generate a dummy id @@ -141,10 +141,10 @@ impl URL { NOTE: The first step is unnecessary, since closed blobs do not exist in the store */ - let origin = global.get_url().origin().unicode_serialization(); + let origin = get_blob_origin(&global.get_url()); if let Ok(url) = Url::parse(&url) { - if let Some((id, _)) = parse_blob_url(&url) { + if let Ok((id, _, _)) = parse_blob_url(&url) { let filemanager = global.resource_threads().sender(); let id = SelectedFileId(id.simple().to_string()); let (tx, rx) = ipc::channel().unwrap(); @@ -172,18 +172,6 @@ impl URL { result } - - /* NOTE(izgzhen): WebKit will return things like blob:file:///XXX - while Chrome will return blob:null/XXX - This is not well-specified, and I prefer the WebKit way here - */ - fn get_blob_origin(url: &Url) -> FileOrigin { - if url.scheme() == "file" { - "file://".to_string() - } else { - url.origin().unicode_serialization() - } - } } impl URLMethods for URL { |