diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-08 20:33:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-08 20:33:26 -0700 |
commit | c2a22bd05e0c8282175422df26e188ef63bcc452 (patch) | |
tree | 99a1f52fbba1e7e01743d40c962012a8c2da3caf /components/script | |
parent | e50e4f99bf4668d183226251d8ea55fa36f72fe0 (diff) | |
parent | bf18225ba26da127cc8ffb574d1b95add853636a (diff) | |
download | servo-c2a22bd05e0c8282175422df26e188ef63bcc452.tar.gz servo-c2a22bd05e0c8282175422df26e188ef63bcc452.zip |
Auto merge of #12268 - izgzhen:fm-spawn, r=Manishearth
Spawn threads for requests in file manager
r? @Manishearth
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
<!-- Either: -->
- [x] There are tests for these changes OR
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12268)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/url.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 9a47be034f8..c2d7516dd6f 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -13,6 +13,7 @@ use dom::bindings::str::{DOMString, USVString}; use dom::blob::Blob; 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::{SelectedFileId, FileManagerThreadMsg}; @@ -142,17 +143,16 @@ impl URL { */ let origin = global.get_url().origin().unicode_serialization(); - match Url::parse(&url) { - Ok(url) => match parse_blob_url(&url) { - Some((id, _)) => { - let filemanager = global.resource_threads().sender(); - let id = SelectedFileId(id.simple().to_string()); - let msg = FileManagerThreadMsg::DecRef(id, origin); - let _ = filemanager.send(msg); - } - None => {} - }, - Err(_) => {} + if let Ok(url) = Url::parse(&url) { + if let Some((id, _)) = parse_blob_url(&url) { + let filemanager = global.resource_threads().sender(); + let id = SelectedFileId(id.simple().to_string()); + let (tx, rx) = ipc::channel().unwrap(); + let msg = FileManagerThreadMsg::DecRef(id, origin, tx); + let _ = filemanager.send(msg); + + let _ = rx.recv().unwrap(); + } } } |