aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/blob.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-10-02 14:29:01 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-10-06 21:35:44 +0200
commitf38159b7d39acccef464857b101e9c8a6855aa6e (patch)
tree2dedb19401e0f2586a8e0bfa8d29f67ecc7abce5 /components/script/dom/blob.rs
parent092504b4e3c10593730e3c625f98863651b9cc91 (diff)
downloadservo-f38159b7d39acccef464857b101e9c8a6855aa6e.tar.gz
servo-f38159b7d39acccef464857b101e9c8a6855aa6e.zip
Introduce GlobalScope::get_url
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r--components/script/dom/blob.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index 997edb52d6c..fa6600224e8 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -190,6 +190,7 @@ impl Blob {
/// valid or invalid Blob URL.
fn promote(&self, set_valid: bool) -> Uuid {
let mut bytes = vec![];
+ let global_url = self.global_scope().get_url();
match *self.blob_impl.borrow_mut() {
BlobImpl::Sliced(_, _) => {
@@ -199,8 +200,7 @@ impl Blob {
}
BlobImpl::File(ref f) => {
if set_valid {
- let global = self.global();
- let origin = get_blob_origin(&global.r().get_url());
+ let origin = get_blob_origin(&global_url);
let (tx, rx) = ipc::channel().unwrap();
let msg = FileManagerThreadMsg::ActivateBlobURL(f.id.clone(), tx, origin.clone());
@@ -219,8 +219,7 @@ impl Blob {
BlobImpl::Memory(ref mut bytes_in) => mem::swap(bytes_in, &mut bytes),
};
- let global = self.global();
- let origin = get_blob_origin(&global.r().get_url());
+ let origin = get_blob_origin(&global_url);
let blob_buf = BlobBuf {
filename: None,
@@ -251,9 +250,7 @@ impl Blob {
/// Get a FileID representing sliced parent-blob content
fn create_sliced_url_id(&self, parent_id: &Uuid,
rel_pos: &RelativePos, parent_len: u64) -> Uuid {
- let global = self.global();
-
- let origin = get_blob_origin(&global.r().get_url());
+ let origin = get_blob_origin(&self.global_scope().get_url());
let (tx, rx) = ipc::channel().unwrap();
let msg = FileManagerThreadMsg::AddSlicedURLEntry(parent_id.clone(),
@@ -282,8 +279,7 @@ impl Blob {
/// Cleanups at the time of destruction/closing
fn clean_up_file_resource(&self) {
if let BlobImpl::File(ref f) = *self.blob_impl.borrow() {
- let global = self.global();
- let origin = get_blob_origin(&global.r().get_url());
+ let origin = get_blob_origin(&self.global_scope().get_url());
let (tx, rx) = ipc::channel().unwrap();
@@ -311,7 +307,7 @@ impl Drop for Blob {
fn read_file(global: GlobalRef, id: Uuid) -> Result<Vec<u8>, ()> {
let resource_threads = global.resource_threads();
let (chan, recv) = ipc::channel().map_err(|_|())?;
- let origin = get_blob_origin(&global.get_url());
+ let origin = get_blob_origin(&global.as_global_scope().get_url());
let check_url_validity = false;
let msg = FileManagerThreadMsg::ReadFile(chan, id, check_url_validity, origin);
let _ = resource_threads.send(CoreResourceMsg::ToFileManager(msg));