From 966ce7de8a23f63d0f30b1748fe69ccaf07519e0 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 7 Apr 2021 15:22:14 +0200 Subject: feat: blob URL support (#10045) This commit adds blob URL support. Blob URLs are stored in a process global storage, that can be accessed from all workers, and the module loader. Blob URLs can be created using `URL.createObjectURL` and revoked using `URL.revokeObjectURL`. This commit does not add support for `fetch`ing blob URLs. This will be added in a follow up commit. --- cli/specifier_handler.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/specifier_handler.rs') diff --git a/cli/specifier_handler.rs b/cli/specifier_handler.rs index 9f329819e..58815e15c 100644 --- a/cli/specifier_handler.rs +++ b/cli/specifier_handler.rs @@ -306,7 +306,9 @@ impl SpecifierHandler for FetchHandler { } })?; let url = &source_file.specifier; - let is_remote = !(url.scheme() == "file" || url.scheme() == "data"); + let is_remote = !(url.scheme() == "file" + || url.scheme() == "data" + || url.scheme() == "blob"); let filename = disk_cache.get_cache_filename_with_extension(url, "meta"); let maybe_version = if let Some(filename) = filename { if let Ok(bytes) = disk_cache.get(&filename) { @@ -569,6 +571,7 @@ pub mod tests { use crate::file_fetcher::CacheSetting; use crate::http_cache::HttpCache; use deno_core::resolve_url_or_path; + use deno_runtime::deno_file::BlobUrlStore; use tempfile::TempDir; macro_rules! map ( @@ -593,6 +596,7 @@ pub mod tests { CacheSetting::Use, true, None, + BlobUrlStore::default(), ) .expect("could not setup"); let disk_cache = deno_dir.gen_cache; -- cgit v1.2.3