summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
AgeCommit message (Collapse)Author
2021-06-21refactor(core): always attach inspector to isolate (#11042)Bartek Iwańczuk
This commit changes "deno_core::JsRuntime" to always create "deno_core::JsRuntimeInspector" instance.
2021-06-17chore: upgrade Rust to 1.53.0 (#11021)Yusuke Tanaka
2021-06-10refactor: merge deno_file crate into deno_web (#10914)Bartek Iwańczuk
This refactor makes it so there's one less crate to publish on each release.
2021-05-27feat(cli): add origin data dir to deno info (#10589)crowlKats
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com> Co-authored-by: Luca Casonato <lucacasonato@yahoo.com> Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2021-05-26refactor: move JsRuntimeInspector to deno_core (#10763)Bartek Iwańczuk
This commit moves implementation of "JsRuntimeInspector" to "deno_core" crate. To achieve that following changes were made: * "Worker" and "WebWorker" no longer own instance of "JsRuntimeInspector", instead it is now owned by "deno_core::JsRuntime". * Consequently polling of inspector is no longer done in "Worker"/"WebWorker", instead it's done in "deno_core::JsRuntime::poll_event_loop". * "deno_core::JsRuntime::poll_event_loop" and "deno_core::JsRuntime::run_event_loop", now accept "wait_for_inspector" boolean that tells if event loop should still be "pending" if there are active inspector sessions - this change fixes the problem that inspector disconnects from the frontend and process exits once the code has stopped executing.
2021-05-26refactor: Rewrite Inspector implementation (#10725)Bartek Iwańczuk
This commit refactors implementation of inspector. The intention is to be able to move inspector implementation to "deno_core". Following things were done to make that possible: * "runtime/inspector.rs" was split into "runtime/inspector/mod.rs" and "runtime/inspector/server.rs", separating inspector implementation from Websocket server implementation. * "DenoInspector" was renamed to "JsRuntimeInspector" and reference to "server" was removed from the structure, making it independent of Websocket server used to connect to Chrome Devtools. * "WebsocketSession" was renamed to "InspectorSession" and rewritten in such a way that it's not tied to Websockets anymore; instead it accepts a pair of "proxy" channel ends that allow to integrate the session with different "transports". * "InspectorSession" was renamed to "LocalInspectorSession" to better indicate that it's an "in-memory" session and doesn't require Websocket server. It was also rewritten in such a way that it uses "InspectorSession" from previous point instead of reimplementing "v8::inspector::ChannelImpl" trait; this is done by using the "proxy" channels to communicate with the V8 session. Consequently "LocalInspectorSession" is now a frontend to "InspectorSession". This introduces a small inconvenience that awaiting responses for "LocalInspectorSession" requires to concurrently poll worker's event loop. This arises from the fact that "InspectorSession" is now owned by "JsRuntimeInspector", which in turn is owned by "Worker" or "WebWorker". To ease this situation "Worker::with_event_loop" helper method was added, that takes a future and concurrently polls it along with the event loop (using "tokio::select!" macro inside a loop).
2021-05-23feat(extensions): BroadcastChannel WPT conformanceBen Noordhuis
Replaces the file-backed provider by an in-memory one because proper file locking is a hard problem that detracts from the proof of concept. Teach the WPT runner how to extract tests from .html files because all the relevant tests in test_util/wpt/webmessaging/broadcastchannel are inside basics.html and interface.html.
2021-05-23feat(extensions): add BroadcastChannelBen Noordhuis
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl> Fixes: #10354
2021-05-11feat(runtime/worker): Structured cloning worker message passing (#9323)Tim Ramlot
This commit upgrade "Worker.postMessage()" implementation to use structured clone algorithm instead of non-spec compliant JSON serialization.
2021-05-10feat: add WebStorage API (#7819)crowlKats
This commit introduces localStorage and sessionStorage.
2021-05-02refactor(runtime): use Extensions (#10461)Aaron O'Mullan
2021-04-30refactor(core): provide builtins as an Extension (#10449)Aaron O'Mullan
2021-04-30refactor(core): initialize extensions in runtime constructor (#10421)Aaron O'Mullan
This ensures that provided extensions are all correctly setup and ready to use once the JsRuntime constructor returns Note: this will also initialize ops for to-be-snapshotted runtimes
2021-04-28core: introduce extensions (#9800)Aaron O'Mullan
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware). This allows for: - `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers - op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...) - `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...) In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
2021-04-25refactor(core): move op cache sync responsibility to rust space (#10340)Aaron O'Mullan
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of core to require users to call `Deno.core.ops()` in JS space. So instead we're introducing a `JsRuntime::sync_ops_cache()` method, once we have runtime extensions a new runtime will ensure the ops cache is setup (for the provided extensions) and then loading/unloading plugins should be the only operations that require op cache syncs
2021-04-21fix: do not panic on not found cwd (#10238)Satya Rohith
2021-04-12refactor(deno): remove concept of bin & json ops (#10145)Aaron O'Mullan
2021-04-08feat: native HTTP bindings (#9935)Bartek Iwańczuk
Co-authered-by: Luca Casonato <lucacasonato@yahoo.com> Co-authered-by: Ben Noordhuis <info@bnoordhuis.nl> Co-authered-by: Ryan Dahl <ry@tinyclouds.org>
2021-04-07feat: blob URL support (#10045)Luca Casonato
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.
2021-03-26remove macro_use (#9884)Ryan Dahl
2021-03-12chore: split web op crate (#9635)Luca Casonato
This commit starts splitting out the deno_web op crate into multiple smaller crates. This commit splits out WebIDL and URL API, but in the future I want to split out each spec into its own crate. That means we will have (in rough order of loading): `webidl`, `dom`, `streams`, `console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and `webgpu` crates.
2021-03-04fix(runtime/web_worker): Don't block self.onmessage with TLA (#9619)Nayeem Rahman
This commit rewrites implementation of "JsRuntime::mod_evaluate". Event loop is no longer polled automatically and users must manually drive event loop forward after calling "mod_evaluate". Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-03-02refactor(op_crates/web): Move URL parsing to Rust (#9276)Nayeem Rahman
2021-03-01feat: WebGPU API (#7977)crowlKats
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-02-21feat(unstable): per op metrics (#9240)Luca Casonato
2021-02-17Make ModuleSpecifier a type alias, not wrapper struct (#9531)Ryan Dahl
2021-01-10update copyright to 2021 (#9081)Ryan Dahl
2021-01-07feat: add --location=<href> and globalThis.location (#7369)Nayeem Rahman
2021-01-06refactor: move WebSocket API to an op_crate (#9026)Luca Casonato
2021-01-05feat(cli/standalone): support runtime flags for deno compile (#8738)Nayeem Rahman
2020-12-21feat(unstable): record raw coverage into a directory (#8642)Casper Beyer
2020-12-20Revert "fix: TLA in web worker (#8809)" (#8839)Bartek Iwańczuk
This reverts commit e924bbdf3606e83ff9eef3a8ed640c4ecc34444f.
2020-12-20fix: TLA in web worker (#8809)Bartek Iwańczuk
Implementors of `deno_core::JsRuntime` might want to do additional actions during each turn of event loop, eg. `deno_runtime::Worker` polls inspector, `deno_runtime::WebWorker` receives/dispatches messages from/to worker host. Previously `JsRuntime::mod_evaluate` was implemented in such fashion that it only polled `JsRuntime`'s event loop. This behavior turned out to be wrong in the example of `WebWorker` which couldn't receive/dispatch messages because its implementation of event loop was never called. This commit rewrites "mod_evaluate" to return a handle to receiver that resolves when module's promise resolves. It is now implementors responsibility to poll event loop after calling `mod_evaluate`.
2020-12-16refactor: rewrite ops to use ResourceTable2 (#8512)Bartek Iwańczuk
This commit migrates all ops to use new resource table and "AsyncRefCell". Old implementation of resource table was completely removed and all code referencing it was updated to use new system.
2020-12-13refactor: deno_runtime crate (#8640)Bartek Iwańczuk
This commit moves Deno JS runtime, ops, permissions and inspector implementation to new "deno_runtime" crate located in "runtime/" directory. Details in "runtime/README.md". Co-authored-by: Ryan Dahl <ry@tinyclouds.org>