summaryrefslogtreecommitdiff
path: root/runtime/js
AgeCommit message (Collapse)Author
2021-11-29Revert "fix(test): Improve reliability of `deno test`'s op sanitizer with ↵Bartek Iwańczuk
timers (#12908)" (#12929) This reverts commit d335343a79afbcfe719109af510fe7a1dd0df2e8.
2021-11-28fix(test): Improve reliability of `deno test`'s op sanitizer with timers ↵Andreu Botella
(#12908) Although not easy to replicate in the wild, the `deno test` op sanitizer can fail when there are intervals that started before a test runs, since the op sanitizer can end up running in the time between the timer op for an interval's run resolves and the op for the next run starts. This change fixes that by adding a new macrotask callback that will run after the timer macrotask queue has drained. This ensures that there is a timer op if there are any timers which are unresolved by the time the op sanitizer runs.
2021-11-28feat(runtime): add op_set_exit_code (#12911)Ben Noordhuis
Set the exit code to use if none is provided to Deno.exit(), or when Deno exits naturally. Needed for process.exitCode Node compat. Paves the way for #12888.
2021-11-25feat(core): Add ability to "ref" and "unref" pending ops (#12889)Bartek Iwańczuk
This commit adds an ability to "ref" or "unref" pending ops. Up to this point Deno had a notion of "async ops" and "unref async ops"; the former keep event loop alive, while the latter do not block event loop from finishing. It was not possible to change between op types after dispatching, one had to decide which type to use before dispatch. Instead of storing ops in two separate "FuturesUnordered" collections, now ops are stored in a single collection, with supplemental "HashSet" storing ids of promises that were "unrefed". Two APIs were added to "Deno.core": "Deno.core.refOp(promiseId)" which allows to mark promise id to be "refed" and keep event loop alive (the default behavior) "Deno.core.unrefOp(promiseId)" which allows to mark promise id as "unrefed" which won't block event loop from exiting
2021-11-23feat(test): Add more overloads for "Deno.test" (#12749)Bartek Iwańczuk
This commit adds 4 more overloads to "Deno.test()" API. ``` // Deno.test(function testName() { }); export function test(fn: (t: TestContext) => void | Promise<void>): void; // Deno.test("test name", { only: true }, function() { }); export function test( name: string, options: Omit<TestDefinition, "name">, fn: (t: TestContext) => void | Promise<void>, ): void; // Deno.test({ name: "test name" }, function() { }); export function test( options: Omit<TestDefinition, "fn">, fn: (t: TestContext) => void | Promise<void>, ): void; // Deno.test({ only: true }, function testName() { }); export function test( options: Omit<TestDefinition, "fn" | "name">, fn: (t: TestContext) => void | Promise<void>, ): void; ```
2021-11-22fix(runtime): support reading /proc using readFile (#12839)Luca Casonato
2021-11-20fix(test): do not throw on error.errors.map (#12810)Yacine Hmito
In tests, the function to format errors would assume that any error with a property `errors` would be an `AggregateError`, and therefore the property `errors` would contain an error. This is not necessarily the case.
2021-11-09feat(core): streams (#12596)Aaron O'Mullan
This allows resources to be "streams" by implementing read/write/shutdown. These streams are implicit since their nature (read/write/duplex) isn't known until called, but we could easily add another method to explicitly tag resources as streams. `op_read/op_write/op_shutdown` are now builtin ops provided by `deno_core` Note: this current implementation is simple & straightforward but it results in an additional alloc per read/write call Closes #12556
2021-11-03feat(ext/web): BYOB support for ReadableStream (#12616)Leo Kettmeir
This commit introduces support for BYOB readers in the WHATWG Streams API implementation.
2021-10-29feat: stabilize Deno.startTls (#12581)Luca Casonato
This commit stabilizes `Deno.startTls` and removes `certFile` from the `StartTlsOptions`.
2021-10-26feat(runtime): add Deno.addSignalListener API (#12512)Yoshiya Hinosawa
2021-10-13fix(runtime/ops/worker_host): move permission arg parsing to Rust (#12297)Nayeem Rahman
2021-10-13chore: fix flaky steps_invalid_usage tests (#12422)David Sherret
2021-10-12chore: upgrade crates based on deno ast 0.3 (#12403)David Sherret
2021-10-11fix(runtime): Declare `Window.self` and `DedicatedWorkerGlobalScope.name` ↵Andreu Botella
with `util.writable()` (#12378) `Window`'s `self` property and `DedicatedWorkerGlobalScope`'s `name` property are defined as Web IDL read-only attributes with the `[Replaceable]` extended attribute, meaning that their setter will redefine the property as a data property with the set value, rather than changing some internal state. Deno currently defines them as read-only data properties instead. Given that Web IDL requires all attributes to be accessor properties rather than data properties, but Deno exposes almost all of those properties as either read-only or writable data properties, it makes sense to expose `[Replaceable]` properties as writable as well – as is already the case with `WindowOrWorkerGlobalScope`'s `performance` property.
2021-10-11feat: provide ops details for ops sanitizer failures (#12188)Casper Beyer
2021-10-11feat(unstable/test): imperative test steps API (#12190)David Sherret
2021-10-10refactor(metrics): move to core (#12386)Aaron O'Mullan
Avoids overhead of wrapping ops (and allocs when inspecting async-op futures)
2021-10-10feat: Stabilize Deno.kill and Deno.Process.kill (#12375)Ryan Dahl
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-10-10feat: stabilize Deno.resolveDns (#12368)Satya Rohith
2021-10-08refactor: deduplicate `defineEventHandler` util (#12367)Andreu Botella
2021-10-07fix(runtime): Getting `navigator.hardwareConcurrency` on workers shouldn't ↵Andreu Botella
throw (#12354)
2021-10-05chore: various op cleanup (#12329)Leo K
2021-10-01fix(runtime/js/workers): throw errors instead of using an op (#12249)Nayeem Rahman
2021-09-30fix(runtime/testing): format aggregate errors (#12183)Casper Beyer
2021-09-30fix: worker environment permissions should accept an array (#12250)David Sherret
2021-09-29feat: stabilize URLPattern API (#12256)Luca Casonato
2021-09-25cleanup(runtime): flatten op_kill's args (#12214)Aaron O'Mullan
2021-09-25fix(ext/webidl): correctly apply [SymbolToStringTag] to interfaces (#11851)李瑞丰
Co-authored-by: Luca Casonato <hello@lcas.dev> Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2021-09-18fix(cli/fmt_errors): Abbreviate long data URLs in stack traces (#12127)Nayeem Rahman
Co-authored-by: Mike White <mike.white@auctane.com>
2021-09-16perf(runtime/fs): optimize readFile by using a single large buffer (#12057)Aaron O'Mullan
* perf(runtime/fs): optimize readFile by using a single large buffer * handle extended/truncated files during read Allocate an extra byte in our read buffer to detect "overflow" then fallback to unsized readAll for remainder of extended file, this is a slowpath that should rarely happen in practice
2021-09-16fix(ext/crypto): use DataError in importKey() (#12071)Divy Srivastava
2021-09-13feat(unstable): allow specifing gid and uid for subprocess (#11586)Leo K
2021-09-13feat: stabilise Deno.upgradeWebSocket (#12024)Bartek Iwańczuk
2021-09-12refactor(runtime): Use `util.nonEnumerable` to define `console` (#11982)Andreu Botella
A comment in `runtime.js` reads that `console` seems to be "the only one that should be writable and non-enumerable", which explains why it is declared with `util.writable` but then has its property descriptor's `enumerable` key changed to false. But it is not in fact true that `console` is the only global property for which this holds, and it wasn't even when this behavior was introduced in denoland#9013. All WebIDL interfaces are also writable and non-enumerable – the only difference here being that `console` is a namespace rather than an interface. Since WebIDL interfaces are defined with `util.nonEnumerable`, and `console` uses the same descriptor keys, this PR changes the definition of `console` to use `util.nonEnumerable` as well.
2021-09-08feat: add URLPattern API (#11941)Luca Casonato
This adds support for the URLPattern API. The API is added in --unstable only, as it has not yet shipped in any browser. It is targeted for shipping in Chrome 95. Spec: https://wicg.github.io/urlpattern/ Co-authored-by: crowlKats < crowlkats@toaxl.com >
2021-09-07chore: add better error message for signal API on Windows (#11935)Bartek Iwańczuk
2021-09-06BREAKING(unstable): Remove Deno.Signals enum, Deno.signals.* (#11909)Ryan Dahl
2021-09-06Don't drop messages from workers that have already been closed (#11913)Andreu Botella
When `worker.terminate()` is called, the spec requires that the corresponding port message queue is emptied, so no messages can be received after the call, even if they were sent from the worker before it was terminated. The spec doesn't require this of `self.close()`, and since Deno uses different channels to send messages and to notify that the worker was closed, messages might still arrive after the worker is known to be closed, which are currently being dropped. This change fixes that. The fix involves two parts: one on the JS side and one on the Rust side. The JS side was using the `#terminated` flag to keep track of whether the worker is known to be closed, without distinguishing whether further messages should be dropped or not. This PR changes that flag to an enum `#state`, which can be one of `"RUNNING"`, `"CLOSED"` or `"TERMINATED"`. The Rust side was removing the `WorkerThread` struct from the workers table when a close control was received, regardless of whether there were any messages left to read, which made any subsequent calls to `op_host_recv_message` to return `Ok(None)`, as if there were no more mesasges. This change instead waits for both a close control and for the message channel's sender to be closed before the worker thread is removed from the table.
2021-09-05refactor(testing): use discrete report functions (#11917)Casper Beyer
2021-09-04refactor(testing): redirect console output via reporter (#11911)Casper Beyer
This feeds console output to the reporter and handles silencing there instead of in the JavaScript code.
2021-09-02feat(fmt): add basic JS doc formatting (#11902)David Sherret
2021-08-31feat(workers): Make the `Deno` namespace configurable and unfrozen (#11888)Andreu Botella
This is the worker counterpart of PR #11062.
2021-08-25feat: ArrayBuffer in structured clone transfer (#11840)Luca Casonato
2021-08-24feat(unstable): Add file locking APIs (#11746)Tilman Roeder
This commit adds following unstable APIs: - Deno.flock() - Deno.flockSync() - Deno.funlock() - Deno.funlockSync()
2021-08-20chore: upgrade dlint and run `prefer-primordials` rule (#11777)Yusuke Tanaka
2021-08-16feat(runtime): support classic workers for internal testing (#11338)Andreu Botella
This commit implements classic workers, but only when the `--enable-testing-features-do-not-use` flag is provided. This change is not user facing. Classic workers are used extensively in WPT tests. The classic workers do not support loading from disk, and do not support TypeScript. Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-10feat: add experimental WebSocketStream API (#10365)Leo K
This commit adds the experimental WebSocketStream API when using the --unstable flag. The explainer for the API can be found here: https://github.com/ricea/websocketstream-explainer
2021-08-09feat(extensions/web): add structuredClone function (#11572)Leo K
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-06feat: ffi to replace plugins (#11152)Elias Sjögreen
This commit removes implementation of "native plugins" and replaces it with FFI API. Effectively "Deno.openPlugin" API was replaced with "Deno.dlopen" API.