mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +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
|
@ -21,6 +21,7 @@ use deno_core::ModuleId;
|
|||
use deno_core::ModuleLoader;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_core::RuntimeOptions;
|
||||
use deno_file::BlobUrlStore;
|
||||
use log::debug;
|
||||
use std::env;
|
||||
use std::rc::Rc;
|
||||
|
@ -66,6 +67,7 @@ pub struct WorkerOptions {
|
|||
pub no_color: bool,
|
||||
pub get_error_class_fn: Option<GetErrorClassFn>,
|
||||
pub location: Option<Url>,
|
||||
pub blob_url_store: BlobUrlStore,
|
||||
}
|
||||
|
||||
impl MainWorker {
|
||||
|
@ -129,6 +131,11 @@ impl MainWorker {
|
|||
ops::reg_json_sync(js_runtime, "op_close", deno_core::op_close);
|
||||
ops::reg_json_sync(js_runtime, "op_resources", deno_core::op_resources);
|
||||
ops::url::init(js_runtime);
|
||||
ops::file::init(
|
||||
js_runtime,
|
||||
options.blob_url_store.clone(),
|
||||
options.location.clone(),
|
||||
);
|
||||
ops::fs_events::init(js_runtime);
|
||||
ops::fs::init(js_runtime);
|
||||
ops::io::init(js_runtime);
|
||||
|
@ -298,6 +305,7 @@ mod tests {
|
|||
no_color: true,
|
||||
get_error_class_fn: None,
|
||||
location: None,
|
||||
blob_url_store: BlobUrlStore::default(),
|
||||
};
|
||||
|
||||
MainWorker::from_options(main_module, permissions, &options)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue