mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
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.
This commit is contained in:
parent
2865f39bec
commit
966ce7de8a
33 changed files with 488 additions and 33 deletions
|
@ -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<ImportMap>,
|
||||
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
|
||||
pub ca_data: Option<Vec<u8>>,
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue