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/program_state.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cli/program_state.rs') diff --git a/cli/program_state.rs b/cli/program_state.rs index f47dcf0e9..a41acdec3 100644 --- a/cli/program_state.rs +++ b/cli/program_state.rs @@ -14,6 +14,7 @@ use crate::module_graph::TypeLib; use crate::source_maps::SourceMapGetter; use crate::specifier_handler::FetchHandler; use crate::version; +use deno_runtime::deno_file::BlobUrlStore; use deno_runtime::inspector::InspectorServer; use deno_runtime::permissions::Permissions; @@ -56,6 +57,7 @@ pub struct ProgramState { pub maybe_import_map: Option, pub maybe_inspector_server: Option>, pub ca_data: Option>, + pub blob_url_store: BlobUrlStore, } impl ProgramState { @@ -80,11 +82,14 @@ impl ProgramState { CacheSetting::Use }; + let blob_url_store = BlobUrlStore::default(); + let file_fetcher = FileFetcher::new( http_cache, cache_usage, !flags.no_remote, ca_data.clone(), + blob_url_store.clone(), )?; let lockfile = if let Some(filename) = &flags.lock { @@ -131,6 +136,7 @@ impl ProgramState { maybe_import_map, maybe_inspector_server, ca_data, + blob_url_store, }; Ok(Arc::new(program_state)) } @@ -257,7 +263,7 @@ impl ProgramState { match url.scheme() { // we should only be looking for emits for schemes that denote external // modules, which the disk_cache supports - "wasm" | "file" | "http" | "https" | "data" => (), + "wasm" | "file" | "http" | "https" | "data" | "blob" => (), _ => { return None; } -- cgit v1.2.3