diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index ac2497da004..9a3829f4d0e 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -1838,13 +1838,16 @@ impl GlobalScope { }; match parent { Some((parent_id, rel_pos)) => { - let parent_file_id = { - let parent_info = blobs_map - .get_mut(&parent_id) - .expect("Parent of blob whose url is requested is unknown."); - self.promote(parent_info, /* set_valid is */ false) + let parent_info = blobs_map + .get_mut(&parent_id) + .expect("Parent of blob whose url is requested is unknown."); + let parent_file_id = self.promote(parent_info, /* set_valid is */ false); + let parent_size = match parent_info.blob_impl.blob_data() { + BlobData::File(ref f) => f.get_size(), + BlobData::Memory(ref v) => v.len() as u64, + BlobData::Sliced(_, _) => panic!("Blob ancestry should be only one level."), }; - let parent_size = self.get_blob_size(&parent_id); + let parent_size = rel_pos.to_abs_range(parent_size as usize).len() as u64; let blob_info = blobs_map .get_mut(blob_id) .expect("Blob whose url is requested is unknown."); diff --git a/tests/wpt/metadata/fetch/api/basic/scheme-blob.sub.any.js.ini b/tests/wpt/metadata/fetch/api/basic/scheme-blob.sub.any.js.ini index 04f3b0fe381..dcb842c4c4c 100644 --- a/tests/wpt/metadata/fetch/api/basic/scheme-blob.sub.any.js.ini +++ b/tests/wpt/metadata/fetch/api/basic/scheme-blob.sub.any.js.ini @@ -1,5 +1,44 @@ [scheme-blob.sub.any.html] - expected: CRASH + [Fetching URL.createObjectURL(empty_blob) is OK] + expected: FAIL + + [Fetching URL.createObjectURL(empty_type_blob) is OK] + expected: FAIL + + [Blob content is not sniffed for a content type [image/png\]] + expected: FAIL + + [Blob content is not sniffed for a content type [text/xml\]] + expected: FAIL + + [Set content type to the empty string for slice with invalid content type] + expected: FAIL + + [Set content type to the empty string for slice with no content type ] + expected: FAIL + + [Blob.slice should not sniff the content for a content type] + expected: FAIL + [scheme-blob.sub.any.worker.html] - expected: CRASH + [Fetching URL.createObjectURL(empty_blob) is OK] + expected: FAIL + + [Fetching URL.createObjectURL(empty_type_blob) is OK] + expected: FAIL + + [Blob content is not sniffed for a content type [image/png\]] + expected: FAIL + + [Blob content is not sniffed for a content type [text/xml\]] + expected: FAIL + + [Set content type to the empty string for slice with invalid content type] + expected: FAIL + + [Set content type to the empty string for slice with no content type ] + expected: FAIL + + [Blob.slice should not sniff the content for a content type] + expected: FAIL