1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

658 commits

Author SHA1 Message Date
Yoshiya Hinosawa
c7dcf1cbdd
chore: bump crate version for 1.15.3 (#12531) 2021-10-25 15:48:01 +09:00
Bert Belder
6a96560986
fix(ext/net): fix TLS bugs and add 'op_tls_handshake' (#12501)
A bug was fixed that could cause a hang when a method was
called on a TlsConn object that had thrown an exception earlier.

Additionally, a bug was fixed that caused TlsConn.write() to not
completely flush large buffers (>64kB) to the socket.

The public `TlsConn.handshake()` API is scheduled for inclusion in the
next minor release. See https://github.com/denoland/deno/pull/12467.
2021-10-20 01:30:04 +02:00
Bartek Iwańczuk
1cd9272a91
chore: release crates for v1.15.2 (#12478) 2021-10-18 20:30:00 +02:00
Nayeem Rahman
7a22df9b76
fix(runtime/ops/worker_host): move permission arg parsing to Rust (#12297) 2021-10-13 13:04:44 -04:00
David Sherret
d5a7a6d575
chore: fix flaky steps_invalid_usage tests (#12422) 2021-10-13 08:55:12 -04:00
Satya Rohith
fb094ae026
chore: bump crate version for 1.15.0 (#12406) 2021-10-12 22:16:15 +05:30
David Sherret
9b1f0c8ba3
chore: upgrade crates based on deno ast 0.3 (#12403) 2021-10-12 09:58:04 -04:00
Andreu Botella
fbcbbd7ae3
fix(runtime): Declare Window.self and DedicatedWorkerGlobalScope.name 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-11 18:50:18 +02:00
Casper Beyer
1683044ed9
feat: provide ops details for ops sanitizer failures (#12188) 2021-10-11 17:00:33 +02:00
David Sherret
426ebf854a
feat(unstable/test): imperative test steps API (#12190) 2021-10-11 09:45:02 -04:00
Feng Yu
668b400ff2
feat(runtime): improve error messages of runtime fs (#11984)
This commit annotates errors returned from FS Deno APIs to include
paths that were passed to the API calls.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-10-11 15:21:18 +02:00
Aaron O'Mullan
5a8a989b78
refactor(metrics): move to core (#12386)
Avoids overhead of wrapping ops (and allocs when inspecting async-op futures)
2021-10-10 17:20:30 +02:00
Ryan Dahl
6ac0337165
feat: Stabilize Deno.kill and Deno.Process.kill (#12375)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-10-10 15:48:26 +02:00
Satya Rohith
29f9e14457
feat: stabilize Deno.resolveDns (#12368) 2021-10-10 15:46:11 +05:30
Aaron O'Mullan
6b43e862fd
feat(runtime): allow passing extensions via Worker options (#12362) 2021-10-08 17:03:49 +02:00
Andreu Botella
74e5b68682
refactor: deduplicate defineEventHandler util (#12367) 2021-10-08 09:53:31 +02:00
Andreu Botella
e8b3ffd155
fix(runtime): Getting navigator.hardwareConcurrency on workers shouldn't throw (#12354) 2021-10-07 19:39:33 +02:00
Bert Belder
822047b845
fix(runtime): don't equate SIGINT to SIGKILL on Windows (#12356) 2021-10-07 16:31:02 +02:00
Aaron O'Mullan
678a881f63
refactor(runtime): Worker bootstrap options (#12299) 2021-10-05 22:41:14 +02:00
Leo K
77a00ce1fb
chore: various op cleanup (#12329) 2021-10-05 22:38:27 +02:00
Bartek Iwańczuk
d67e858506
chore: merge v1.14.3 into main (#12327) 2021-10-05 21:40:39 +02:00
Luca Casonato
64a7187238
chore: remove No*Permissions structs (#12316)
These are confusing. They say they are "for users that don't care about
permissions", but that isn't correct. `NoTimersPermissions` disables
permissions instead of enabling them.

I would argue that implementors should decide what permissions they want
themselves, and not take our opinionated permissions struct.
2021-10-04 22:56:24 +02:00
Nayeem Rahman
b354eaa247
fix(runtime/js/workers): throw errors instead of using an op (#12249) 2021-10-01 11:30:55 +02:00
Casper Beyer
6bf5c850e6
fix(runtime/testing): format aggregate errors (#12183) 2021-09-30 21:54:56 +02:00
David Sherret
c3e441c5b5
fix: worker environment permissions should accept an array (#12250) 2021-09-30 15:50:59 -04:00
Andreu Botella
cdb252af0a
feat: support serializing WebAssembly.Module objects (#12140) 2021-09-29 10:47:24 +02:00
Luca Casonato
5b526e5d17
feat: stabilize URLPattern API (#12256) 2021-09-29 10:42:32 +02:00
Aaron O'Mullan
e8901281da
chore: bump crate versions for 1.14.2 (#12253) 2021-09-28 12:19:03 +02:00
Luca Casonato
ff3a17b72d
fix: subprocess kill support on windows (#12134) 2021-09-27 12:18:02 +02:00
Aaron O'Mullan
4e2b59f9df
cleanup(runtime): flatten op_kill's args (#12214) 2021-09-25 01:33:15 +02:00
Ryan Dahl
683a38e47c
refactor: Remove unused code (#12210) 2021-09-25 00:35:35 +02:00
Aaron O'Mullan
d0e14ae82c
chore(runtime): minor comment improvement (#12191) 2021-09-24 22:25:45 +02:00
李瑞丰
46245b830a
fix(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-25 02:07:22 +09:00
Nayeem Rahman
faefe2300d
fix(cli/permissions): ensure revoked permissions are no longer granted (#12159)
Fixes #12153
2021-09-24 15:48:15 +10:00
Ryan Dahl
80a9a37df1
refactor: Remove depreated Worker::execute_module (#12203) 2021-09-23 21:46:22 -04:00
Aaron O'Mullan
a33ee087ce
perf(ops): optimize permission check (#11800)
* perf(ops): optimize permission check

Removes the overhead of permission check on access granted (should be common case):

Delta measured on `perf_now` from `deno_common` bench:
- before: `528ns/op
- after: `166ns/op`

So ~3x faster
2021-09-23 00:45:58 +02:00
Andreu Botella
5c5f4ea1d6
fix(workers): Don't panic when a worker's parent thread stops running (#12156)
This panic could happen in the following cases:

- A non-fatal error being thrown from a worker, that doesn't terminate
  the worker's execution, but propagates to the main thread without
  being handled, and makes the main thread terminate.
- A nested worker being alive while its parent worker gets terminated.
- A race condition if the main event loop terminates the worker as part
  of its last task, but the worker doesn't fully terminate before the
  main event loop stops running.

This panic happens because a worker's event loop should have pending ops
as long as the worker isn't closed or terminated – but if an event loop
finishes running while it has living workers, its associated
`WorkerThread` structs will be dropped, closing the channels that keep
those ops pending.

This change adds a `Drop` implementation to `WorkerThread`, which
terminates the worker without waiting for a response. This fixes the
panic, and makes it so nested workers are automatically terminated once
any of their ancestors is closed or terminated.

This change also refactors a worker's termination code into a
`WorkerThread::terminate()` method.

Closes #11342.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-09-22 18:02:15 +02:00
Kitson Kelly
2a56cd545c
chore: bump crate versions for 1.14.1 (#12172) 2021-09-22 06:53:47 +10:00
MikaelUrankar
8375f5464b
fix(runtime/ops/signal.rs): Add FreeBSD signal definitions (#12084) 2021-09-21 09:16:05 -04:00
Satya Rohith
923c5432e0
chore: bump deno_net (#12157) 2021-09-21 09:20:21 +05:30
Nayeem Rahman
75ca013f07
fix(cli/fmt_errors): Abbreviate long data URLs in stack traces (#12127)
Co-authored-by: Mike White <mike.white@auctane.com>
2021-09-18 15:40:04 +02:00
Bartek Iwańczuk
f840906943
fix(core): prevent multiple main module loading (#12128)
This commit fixes a problem where loading and executing multiple 
modules leads to all of the having "import.meta.main" set to true.

Following Rust APIs were deprecated:
- deno_core::JsRuntime::load_module
- deno_runtime::Worker::execute_module
- deno_runtime::WebWorker::execute_module

Following Rust APIs were added:
- deno_core::JsRuntime::load_main_module
- deno_core::JsRuntime::load_side_module
- deno_runtime::Worker::execute_main_module
- deno_runtime::Worker::execute_side_module
- deno_runtime::WebWorker::execute_main_module

Trying to load multiple "main" modules into the runtime now results in an
error. If user needs to load additional "non-main" modules they should use
APIs for "side" module.
2021-09-18 03:44:53 +02:00
Squirrel
4b79e5a459
chore: Remove unused deps from Cargo.toml files (#12106) 2021-09-17 14:39:32 +02:00
Aaron O'Mullan
00948a6d68
perf(runtime/fs): optimize readFile by using a single large buffer (#12057)
* 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-16 20:28:15 +02:00
Divy Srivastava
868f38d452
fix(ext/crypto): use DataError in importKey() (#12071) 2021-09-16 09:58:29 +02:00
David Sherret
16c27fce1f
chore: bump crate versions for 0.14 (#12072) 2021-09-14 15:38:35 -04:00
David Sherret
5e2c5d0afa
fix: permission prompt stuffing on Windows (#11969) 2021-09-14 08:37:27 -04:00
Leo K
a655a0f3e4
feat(unstable): allow specifing gid and uid for subprocess (#11586) 2021-09-13 19:26:23 +02:00
Bartek Iwańczuk
a95ca9dc70
feat: stabilise Deno.upgradeWebSocket (#12024) 2021-09-13 14:06:12 +02:00
Ryan Dahl
13991e5995
refactor: Remove duplicated colors.rs file (#11990) 2021-09-12 12:04:17 -04:00
Andreu Botella
676565c711
refactor(runtime): Use util.nonEnumerable to define console (#11982)
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-12 00:20:30 +02:00
Yusuke Tanaka
87052927af
chore: upgrade Rust to 1.55.0 (#11965) 2021-09-09 21:15:21 -04:00
Ryan Dahl
fb35cd0ef4
fix: permission prompt stuffing (#11931)
Fixes #9750
2021-09-09 08:38:47 -04:00
Bartek Iwańczuk
85e316bd6b
chore: release deno_http 0.8.0 (#11956) 2021-09-08 19:32:19 +02:00
Luca Casonato
e07f28d301
feat: add URLPattern API (#11941)
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-08 11:14:29 +02:00
David Sherret
e3a484ae44
fix: remove windows-only panic when calling Deno.kill (#11948) 2021-09-07 18:45:13 -04:00
Casper Beyer
d85ccce65b
fix(runtime): return error instead of panicking for windows signals (#11940) 2021-09-07 17:34:46 +02:00
David Sherret
2c2e3ec1ca
refactor(lsp): use deno_ast and cache swc ASTs (#11780) 2021-09-07 10:39:32 -04:00
Bartek Iwańczuk
a5bcf7033e
chore: add better error message for signal API on Windows (#11935) 2021-09-07 13:17:44 +02:00
Ryan Dahl
c132c8690b
BREAKING(unstable): Remove Deno.Signals enum, Deno.signals.* (#11909) 2021-09-06 10:05:33 -04:00
Andreu Botella
b7c2902c97
Don't drop messages from workers that have already been closed (#11913)
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-06 11:05:02 +02:00
Casper Beyer
01bfb7d913
refactor(testing): use discrete report functions (#11917) 2021-09-05 22:42:35 +02:00
Casper Beyer
ce79cb5797
refactor(testing): redirect console output via reporter (#11911)
This feeds console output to the reporter and handles silencing there
instead of in the JavaScript code.
2021-09-04 15:16:35 +02:00
David Sherret
987716798f
feat(fmt): add basic JS doc formatting (#11902) 2021-09-02 18:28:12 -04:00
Luca Casonato
1bf7b90ca8
chore: update dependencies (#11856)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-09-02 23:38:44 +02:00
Andreu Botella
c49eee551f
feat(workers): Make the Deno namespace configurable and unfrozen (#11888)
This is the worker counterpart of PR #11062.
2021-08-31 19:33:03 +02:00
Sean Michael Wykes
dccf4cbe36
feat(fetch): mTLS client certificates for fetch() (#11721)
This commit adds support for specifying client certificates when using fetch, by means of `Deno.createHttpClient`.
2021-08-25 14:25:12 +02:00
Luca Casonato
5d814a4c24
feat: ArrayBuffer in structured clone transfer (#11840) 2021-08-25 13:48:53 +02:00
Bartek Iwańczuk
f84cd9403d
refactor: cleanup Inspector and InspectorServer implementations (#11837) 2021-08-25 13:39:23 +02:00
Tilman Roeder
93d83a84db
feat(unstable): Add file locking APIs (#11746)
This commit adds following unstable APIs:
- Deno.flock()
- Deno.flockSync()
- Deno.funlock()
- Deno.funlockSync()
2021-08-24 15:21:31 +02:00
David Sherret
6db8cbb650
chore: release crates for 1.13.2 (#11820) 2021-08-23 15:48:08 -04:00
Ikko Ashimine
d81128109f
refactor: fix typo in web_worker.rs (#11792) 2021-08-20 22:14:48 +02:00
Yusuke Tanaka
4ae57d185e
chore: upgrade dlint and run prefer-primordials rule (#11777) 2021-08-20 01:14:20 +02:00
Luca Casonato
a66218d457
fix(runtime): event loop panics in classic workers (#11756)
Classic worker scripts are now executed in the context of a Tokio
runtime. This does mean we can not spawn more tokio runtimes in
"op_worker_sync_fetch". We instead spawn a new thread there, that can
create a new Tokio runtime that we can use to block the worker thread.
2021-08-18 15:19:22 +02:00
David Sherret
a66a7bebbe
chore: release crates for 1.13.1 (#11729) 2021-08-16 16:49:14 -04:00
Andreu Botella
ddbb7b83f2
feat(runtime): support classic workers for internal testing (#11338)
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-16 14:29:54 +02:00
Aaron O'Mullan
2ca454b402
refactor(ops): return BadResource errors in ResourceTable calls (#11710)
* refactor(ops): return BadResource errors in ResourceTable calls

Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
2021-08-15 13:29:19 +02:00
Bartek Iwańczuk
57aea228e8
build: allow deno_runtime crate to build in docs.rs (#11602) 2021-08-11 18:01:30 +02:00
David Sherret
15a763152f
chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
Ryan Dahl
a0285e2eb8
Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00
Bartek Iwańczuk
548e466112
chore: release crates (#11628) 2021-08-10 14:19:42 +02:00
Bartek Iwańczuk
b9a8111a00
refactor: --unsafely-ignore-certificate-errors (#11629) 2021-08-10 13:19:45 +02:00
Leo K
2db381eba9
feat: add experimental WebSocketStream API (#10365)
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-10 00:28:17 +02:00
TheAifam5
353a4a1af3
feat: Add --unsafely-treat-insecure-origin-as-secure flag to disable SSL verification (#11324)
This commit adds "--unsafely-treat-insecure-origin-as-secure" flag 
that allows to disable SSL verification for all domains, or specific
domains if they were passed as an argument to the flag.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-08-09 16:53:21 +02:00
Leo K
16ae4a0d57
feat(extensions/web): add structuredClone function (#11572)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-09 10:39:00 +02:00
Justin Chase
02c74fb709
feat(tls): Optionally support loading native certs (#11491)
This commit adds "DENO_TLS_CA_STORE" env variable to support 
optionally loading certificates from the users local certificate store. 
This will allow them to successfully connect via tls with corporate 
and self signed certs provided they have them installed in their keystore. 
It also allows them to deal with revoked certs by simply updating 
their keystore without having to upgrade Deno.

Currently supported values are "mozilla", "system" or empty value.
2021-08-07 14:49:38 +02:00
Elias Sjögreen
33c8d790c3
feat: ffi to replace plugins (#11152)
This commit removes implementation of "native plugins" and replaces
it with FFI API.

Effectively "Deno.openPlugin" API was replaced with "Deno.dlopen" API.
2021-08-06 23:28:10 +02:00
Bartek Iwańczuk
0d1a522a03
revert: allow URL for permissions (#11600)
Revert changes to "net" permissions in regards to handling URLs 
introduced in 15b0e61de.
2021-08-06 21:10:04 +02:00
Benjamin Gruenbaum
2b53602d3c
feat: support AbortSignal in writeFile (#11568) 2021-08-06 10:21:29 -07:00
Leo K
15b0e61de5
feat(runtime): allow URL for permissions (#11578) 2021-08-06 15:04:00 +02:00
Leo K
2ac031d6fd
feat(unstable): clean environmental variables for subprocess (#11571)
This commit adds "Deno.RunOptions.clearEnv" option, that allows
to clear environmental variables from parent process before spawning
a subprocess.
2021-08-04 21:47:43 +02:00
David Sherret
1cd95dd8b5
chore: surface import map JSON parse error to user (#11573) 2021-08-03 15:29:12 -04:00
David Sherret
d7d452efc1
chore: format toml files internally (#11563) 2021-08-02 10:19:27 -04:00
Bartek Iwańczuk
3a2e94492b
feat: stabilize Deno.serveHttp() (#11544)
This commit moves "Deno.serveHttp()" and related types
to stable namespace.
2021-08-02 14:40:46 +02:00
Yusuke Tanaka
8f00b5542c
chore: upgrade Rust to 1.54.0 (#11554) 2021-07-30 15:03:41 +02:00
Ben Noordhuis
c909faf9e6
chore(core): use oneshot channel in mod_evaluate() (#11556)
Oneshot is more appropriate because mod_evaluate() only sends a single
value.

It also makes it easier to use it correctly. As an embedder, I wasn't
sure if I'm expected to drain the channel or not.
2021-07-30 13:36:43 +02:00
Divy Srivastava
2b13bb6945
feat(runtime): implement navigator.hardwareConcurrency (#11448)
This commit implements "navigator.hardwareConcurrency" API, which
supersedes "Deno.systemCpuInfo()" API (which was removed in this commit).
2021-07-29 21:45:11 +02:00
Satya Rohith
d0ec29b493
chore: release deno_fetch (#11549) 2021-07-29 21:59:44 +05:30
Satya Rohith
7f3a34eeb8
feat(extensions/fetch): extend init options (#11528) 2021-07-28 04:34:08 +05:30
Bartek Iwańczuk
f9bb7949b8
chore: release crates (#11519) 2021-07-26 15:45:40 +02:00
Yusuke Tanaka
865d9ddd51
refactor: use primordials in runtime, extensions and core (#11500) 2021-07-26 13:52:59 +02:00
Aaron O'Mullan
3e08b6ae89
cleanup(runtime): remove last references to Deno.core.sharedQueue (#11503)
`Deno.core.sharedQueue` was killed in #9843
2021-07-23 10:53:51 -07:00
Luca Casonato
78fc9a4c60
fix: support --cert flag for tls connect APIs (#11484) 2021-07-22 12:28:46 +02:00
Bartek Iwańczuk
9b9becf1ae
fix: panic for non-WS connections to inspector (#11466) 2021-07-20 15:41:36 +02:00
Bartek Iwańczuk
cd445a2a0d
chore: release crates (#11454) 2021-07-19 20:20:42 +02:00
Andreu Botella
240545282a
fix(workers): silently ignore non-existent worker IDs (#11417)
Fixes #11416
2021-07-17 08:51:06 +10:00
Casper Beyer
69ca44d8e2
refactor(cli/tools/test_runner): split reporter into distinct stages (#11395)
This splits up the reporter into smaller functions, one for each
distinct event that happens during the testing process.
2021-07-14 21:05:16 +02:00
Casper Beyer
9cb48bd8fe
refactor(runtime): apply permissions as a hook during registration (#11347) 2021-07-14 00:11:02 +02:00
Bartek Iwańczuk
642dd3d3c4
chore: release crates (#11378) 2021-07-13 02:16:49 +02:00
Luca Casonato
f649960f87
refactor: deno_http op crate (#11335) 2021-07-12 12:44:49 +02:00
Ryan Dahl
511c48a03a
Revert "Remove unstable native plugins (#10908)"
This reverts commit 7dd4090c2a.
2021-07-11 18:12:26 -07:00
Andreu Botella
eea6000ef6
fix: align DedicatedWorkerGlobalScope event handlers to spec (#11353) 2021-07-10 23:32:10 +02:00
Luca Casonato
ab079a8d63
chore: update crates (#11332) 2021-07-09 17:15:50 +02:00
Bartek Iwańczuk
27e1b4cb5a
feat(core): return v8::Value from JsRuntime::execute_script (#11129)
This commit changes return type of JsRuntime::execute_script to include
v8::Value returned from evaluation.

When embedding deno_core it is sometimes useful to be able to inspect
script evaluation value without the hoops of adding ops to store the
value on the OpState.

v8::Global<v8::Value> is used so consumers don't have to pass
scope themselves.
2021-07-08 18:56:53 +02:00
Leo K
5e092b19fe
feat(runtime/http): server side websocket support (#10359)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-07-08 13:33:01 +02:00
Luca Casonato
215f6f2c9e
chore: update wgpu to 0.9.0 (#11315) 2021-07-08 11:07:49 +02:00
David Sherret
7fc0e8ec8c
chore: use parking_lot for synchronization primitives to align with tokio (#11289)
parking_lot is already transitively used in tokio via the "full" cargo feature
2021-07-06 23:48:01 -04:00
Luca Casonato
bdfad23dd0
feat: support SharedArrayBuffer sharing between workers (#11040)
This commit adds support for sharing SABs between workers.
2021-07-06 19:42:52 +02:00
Divy Srivastava
570309d795
feat(crypto): implement generateKey() and sign() (#9614)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-07-06 14:16:04 +02:00
Casper Beyer
e8258e0210
feat(test): add --shuffle flag to randomize test ordering (#11163) 2021-07-05 21:20:33 -04:00
Casper Beyer
407de8b834
fix(runtime): ignored tests should not cause permission changes (#11278) 2021-07-05 18:36:43 +02:00
Yusuke Tanaka
0a33cc1951
chore: upgrade Tokio to 1.8.0 (#11281) 2021-07-05 15:50:56 +02:00
Jimmy Wärting
2c0b0e45b7
refactor: asynchronous blob backing store (#10969)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-07-05 15:34:37 +02:00
Casper Beyer
c4cc353d59
refactor(runtime): reduce duplication in test harness (#11274) 2021-07-05 10:26:57 +02:00
Simon Rask
a8f9ac654d
fix: primordials in extensions/net and runtime/js (#11270) 2021-07-04 17:26:38 +02:00
Bartek Iwańczuk
5addba2abc
refactor: use primordials in runtime/, part2 (#11248) 2021-07-04 00:17:52 +02:00
Andreu Botella
ffa75be480
feat: enable WebAssembly.instantiateStreaming and wasm async compilation (#11200)
The WebAssembly streaming APIs used to be enabled, but used to take
buffer sources as their first argument (see #6154 and #7259). This
change re-enables them, requiring a Promise<Response> instead, as well as
enabling asynchronous compilation of WebAssembly modules.
2021-07-03 23:33:36 +02:00
Luca Casonato
bf39b883d6
refactor: introduce primordials for ext/web (#11228) 2021-07-03 21:32:28 +02:00
Simon Rask
51de4e1f7c
refactor: use primordials for 13_buffer.js and 30_fs.js (#11247) 2021-07-03 17:17:23 +02:00
Bartek Iwańczuk
6137c8046d
refactor: use primordials in runtime/, part1 (#11241) 2021-07-03 16:58:08 +02:00
Bartek Iwańczuk
7dd4090c2a
Remove unstable native plugins (#10908)
This commit removes implementation of native plugins
alongside the unstable "Deno.openPlugin()" API.
2021-07-02 16:11:23 +02:00
Luca Casonato
0385a99052
v1.11.3
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2021-07-02 00:13:40 +02:00
Bartek Iwańczuk
3e21ffc935
feat(inspector): improve inspector prompt in Chrome Devtools (#11187)
This commit improves how Deno inspector presents itself in Chrome Devtools.
2021-06-30 18:01:11 +02:00
Bert Belder
5db9f627e3
chore: get rid of REPL timeout (#11175)
* Get rid of timeout
* Use tokio channel and reduce calls to run_event_loop

Co-authored-by: David Sherret <dsherret@gmail.com>
2021-06-29 14:39:28 -04:00
Bartek Iwańczuk
38a7128cdd
feat: Add "deno_net" extension (#11150)
This commits moves implementation of net related APIs available on "Deno"
namespace to "deno_net" extension.

Following APIs were moved:
- Deno.listen()
- Deno.connect()
- Deno.listenTls()
- Deno.serveHttp()
- Deno.shutdown()
- Deno.resolveDns()
- Deno.listenDatagram()
- Deno.startTls()
- Deno.Conn
- Deno.Listener
- Deno.DatagramConn
2021-06-29 01:43:03 +02:00
Bartek Iwańczuk
30cba24848
chore: release deno_core (#11164) 2021-06-28 20:59:23 +02:00
Bartek Iwańczuk
9e875b2a23
fix(http): remove unwrap() in HTTP bindings (#11130) 2021-06-28 00:19:40 +02:00
Andreu Botella
5bf7da91f1
fix(runtime/http): Encode and decode headers as byte strings in the HTTP server (#11144) 2021-06-27 02:29:01 +02:00
Bartek Iwańczuk
7b9737b9f4
feat(inspector): pipe console messages between terminal and inspector (#11134)
This commit adds support for piping console messages to inspector.

This is done by "wrapping" Deno's console implementation with default
console provided by V8 by the means of "Deno.core.callConsole" binding.

Effectively each call to "console.*" methods calls a method on Deno's
console and V8's console.
2021-06-27 02:27:50 +02:00
Luca Casonato
40b083c540
fix: specify AbortSignal for native http requests (#11126) 2021-06-26 00:01:25 +02:00
Yoshiya Hinosawa
d832d2bfd1
chore(ext/console): deprecate Deno.customInspect (#10035)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-06-25 16:19:18 +09:00
Yoshiya Hinosawa
606611708c
fix(runtime/signal): use op_async_unref for op_signal_poll (#11097) 2021-06-25 13:15:35 +09:00
Benjamin Gruenbaum
20b0a5125a
feat(core): support AbortSignal in readFile (#10943) 2021-06-22 11:45:26 -04:00
Luca Casonato
6261c89e04
feat: transfer MessagePort between workers (#11076)
Add support for transferring `MessagePort`s between workers.
2021-06-22 16:30:16 +02:00
Yoshiya Hinosawa
4e3ec47857
fix(runtime): fix signal promise API (#11069) 2021-06-22 15:17:44 +09:00
Tomofumi Chiba
4f1b1903cf
feat(fetch): add programmatic proxy (#10907)
This commit adds new options to unstable "Deno.createHttpClient" API.

"proxy" and "basicAuth" options were added that allow to use custom proxy
when client instance is passed to "fetch" API.
2021-06-22 05:21:57 +02:00
Muthu Kumar
388274e02e
fix: move stable/unstable types/APIs to their correct places (#10880)
- Moved ppid and memoryUsage types from deno.unstable to deno.ns.
- Moved sleepSync to unstable object, shutdown to stable object.
2021-06-22 03:03:00 +02:00
Bartek Iwańczuk
9105892ec8
refactor: unify JavaScript script execution method (#11043)
This commit renames "JsRuntime::execute" to "JsRuntime::execute_script". Additionally
same renames were applied to methods on "deno_runtime::Worker" and
"deno_runtime::WebWorker".

A new macro was added to "deno_core" called "located_script_name" which
returns the name of Rust file alongside line no and col no of that call site.
This macro is useful in combination with "JsRuntime::execute_script"
and allows to provide accurate place where "one-off" JavaScript scripts
are executed for internal runtime functions.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2021-06-22 01:45:41 +02:00
Kitson Kelly
cda15f2a98
feat: Deno namespace configurable and unfrozen (#11062)
Closes #11033
2021-06-22 07:17:35 +10:00
Luca Casonato
f9ff981daf
feat: MessageChannel and MessagePort (#11051)
This commit introduces support for MessageChannel and MessagePort.
MessagePorts can be transfered across other MessagePorts.
2021-06-21 19:53:52 +02:00
Bartek Iwańczuk
a2f939b99c
refactor(core): always attach inspector to isolate (#11042)
This commit changes "deno_core::JsRuntime" to always create
"deno_core::JsRuntimeInspector" instance.
2021-06-21 19:37:51 +02:00
Bartek Iwańczuk
90e3abe8f9
chore: release crates (#11068) 2021-06-21 16:37:34 +02:00
Yusuke Tanaka
b0c04a7941
chore: upgrade Tokio to 1.7.1 (#11045) 2021-06-19 15:37:07 +02:00
Yusuke Tanaka
8031644e65
chore: upgrade Rust to 1.53.0 (#11021) 2021-06-17 15:56:30 -04:00
Yusuke Tanaka
a8007059b7
chore: upgrade Tokio to 1.7.0 (#11008) 2021-06-16 16:39:51 +02:00
Bartek Iwańczuk
ba91a727a6
chore: release crates (#10976) 2021-06-15 22:14:58 +02:00
Ryan Dahl
9c42b5e03b
Remove various unnecessary allow(clippy) declarations (#10971) 2021-06-15 19:22:28 +02:00
Luca Casonato
4cbc4a7eb3
fix: make WHATWG streams more compliant (#10967) 2021-06-15 13:46:02 +02:00
Bartek Iwańczuk
1246a433f8
fix: poll connection after writing response chunk in Deno.serveHttp() (#10961)
This commit changes "op_http_response_write" to first send response chunk
and then poll the underlying HTTP connection.

Previously after writing a chunk of response HTTP connection wasn't polled
and thus data wasn't written to the socket until after next op interacting 
with the connection.
2021-06-14 22:10:55 +02:00
Bartek Iwańczuk
1e1959f6fa
fix: hang in Deno.serveHttp() (#10923)
Waiting on next request in Deno.serveHttp() API hanged
when responses were using ReadableStream. This was caused
by op_http_request_next op that was never woken after
response was fully written. This commit adds waker field to
DenoService which is called after response is finished.
2021-06-14 14:52:49 +02:00
Bartek Iwańczuk
6091ea098a
refactor: merge deno_file crate into deno_web (#10914)
This refactor makes it so there's one less crate to publish on each release.
2021-06-10 15:26:10 +02:00
Kitson Kelly
e779ea9565
fix(runtime): early binding to dispatchEvent in workers (#10904) 2021-06-09 22:21:02 +10:00
Bartek Iwańczuk
3a96fe55a0
chore: release crates (#10896) 2021-06-08 20:34:18 +02:00
David Sherret
6ee983b127
chore(tools): Fix stdout buffer of launched process getting full causing tools/lint.js to hang on Windows (#10888)
Also fix Windows only clippy issues.
2021-06-07 22:29:47 -04:00
Satya Rohith
b6400a25a0
refactor(runtime): move performance API to timers extension (#10818)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-06-07 14:19:33 +02:00
Luca Casonato
1fb2e23a67
feat(fetch): implement abort (#10863)
This commit introduces fetch aborting via an AbortSignal.
2021-06-06 15:37:17 +02:00
Casper Beyer
3f9187c366
feat(extensions/crypto): implement subtle.digest (#10796)
Co-authored-by: Yacine Hmito yacinehmito@users.noreply.github.com
2021-06-06 12:57:10 +02:00
Andreu Botella
62bf403157
feat(web): Implement TextDecoderStream and TextEncoderStream (#10842) 2021-06-06 03:23:16 +02:00
Luca Casonato
c73ef5fa14
refactor(web): use encoding_rs for text encoding (#10844)
This commit removes all JS based text encoding / text decoding. Instead
encoding now happens in Rust via encoding_rs (already in tree). This
implementation retains stream support, but adds the last missing
encodings. We are incredibly close to 100% WPT on text encoding now.

This should reduce our baseline heap by quite a bit.
2021-06-05 23:10:07 +02:00
Leo K
bb0c90cadb
fix(crypto): change Crypto to interface (#10853)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-06-05 22:56:59 +02:00
Leo K
b748415baf
fix(streams): expose ReadableByteStreamController & TransformStreamDefaultController (#10855) 2021-06-05 19:32:05 +02:00
Leo K
083f5c3454
refactor(crypto): validate max random bytes in Rust (#10857) 2021-06-05 19:30:20 +02:00
Elad Keyshawn
4b3d55b449
webutil: replace cloneValue impl with serialize/deserialize (#10215)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-06-05 15:57:51 +02:00
Bartek Iwańczuk
5457e741fa
fix: hang in op_http_next_request (#10836)
This commit adds "CancelHandle" to "ConnResource" and changes
"op_http_next_request" to await for the cancel signal. In turn
when async iterating over "Deno.HttpConn" the iterator breaks
upon closing of the resource.
2021-06-04 01:32:36 +02:00
Casper Beyer
55e962b688
feat(cli): support URL overload for Deno.chdir (#10793) 2021-06-03 16:32:18 +02:00
Casper Beyer
ece56d9935
feat(runtime): support URL overloads for Deno.symlink and Deno.symlinkSync (#10664) 2021-06-03 16:16:00 +02:00
Casper Beyer
dc69b03339
feat(runtime): support URL overloads for Deno.rename/Deno.renameSync (#10512) 2021-06-03 16:14:37 +02:00
Yoshiya Hinosawa
595700c993
feat: add FsWatcher interface (#10798) 2021-06-01 15:35:06 +09:00
Bert Belder
f891368057 v1.10.3 / 2021.05.31
- feat(lsp): diagnostics for deno types and triple-slash refs (#10699)
 - feat(lsp): provide X-Deno-Warning as a diagnostic (#10680)
 - feat(lsp): show hints from `deno_lint` in addition to messages
   (#10739)
 - feat(lsp): support formatting json and markdown files (#10180)
 - fix(cli): always allow documentation modules to be checked (#10581)
 - fix(cli): canonicalize coverage dir (#10364)
 - fix(cli): don't statically error on dynamic unmapped bare specifiers
   (#10618)
 - fix(cli): empty tsconfig.json file does not cause error (#10734)
 - fix(cli): support source maps with Deno.emit() and bundle (#10510)
 - fix(cli/dts): fix missing error class (NotSupported) in types (#10713)
 - fix(cli/install): support `file:` scheme URLs (#10562)
 - fix(cli/test): don't use reserved symbol `:` in specifier (#10751)
 - fix(cli/test): ensure coverage dir exists (#10717)
 - fix(cli/upgrade): modify download size paddings (#10639)
 - fix(runtime/http): expose nextRequest() errors in respondWith()
   (#10384)
 - fix(runtime/http): fix empty blob response (#10689)
 - fix(serde_v8): remove intentional deserialization error on non-utf8
   strings (#10156)
 - fix(ext/fetch): fix error message of Request constructor (#10772)
 - fix(ext/fetch): make prototype properties writable (#10769)
 - fix(ext/fetch): remove unimplemented Request attributes (#10784)
 - fix(ext/file): update File constructor following the spec (#10760)
 - fix(ext/webstorage): use opstate for sqlite connection (#10692)
 - fix(lsp): deps diagnostics include data property (#10696)
 - fix(lsp): ignore type definition not found diagnostic (#10610)
 - fix(lsp): local module import added by code action now includes the
   file extension (#10778)
 - fix(lsp): make failed to load config error descriptive (#10685)
 - fix(lsp): memoize script versions per tsc request (#10601)
 - fix(lsp): re-enable the per resource configuration without a deadlock
   (#10625)
 - docs(cli): update getting started for clarity (#10694)
 - docs(cli/dts) replace `read()` with `readSync()` (#10732)
 - docs(cli/dts): fix plugin example (#10647)
 - docs(cli/dts): fix typo in `TestDefinition.only` description (#10697)
 - docs(cli/dts): fix unix socket examples (#10705)
 - docs(cli/dts): make worker example pass (#10703)
 - docs(cli/dts): tag test permission example as typescript (#10753)
 - docs(permissions): fix grammatical error in permissions docs (#10755)
 - docs(runtime): fix fetch API usage of HTTP server (#10777)
 - docs(testing): fix misspelling (#10683)
 - docs(typescript): fix typo in faqs (#10682)
 -----BEGIN PGP SIGNATURE-----
 
 iQFJBAABCgAzFiEERCcr7u+ib5W/fkyWeneIey4u1GEFAmC1RbwVHGJlcnRiZWxk
 ZXJAZ21haWwuY29tAAoJEHp3iHsuLtRhXJsH/RETkMkLj1rZSdQWaOdVnRmP02pb
 QmbmtfPVtM0Xvh+zL23Jk2fU2cJPRsf71U260QMyzxE8LVDZ58k9KFID24MdB3b/
 J6Y5zLxyhkzc1EutN+D09y2nwrvJv3UKOls2ZLXtZ/HEmqQVOmqlGIaPIGxiQOPO
 yAWXKXid/hZ41xDygJpL6FEmemnVlOzPHX/AeccKcyQos7CUUqcNocReUklZcje6
 1IEEe6NcAi7x7hRB6lfjtXIZRcEjMD21ZmLsyKEH6YOJfoPzlR0uKYJR0i0ZO5Hr
 H4erWA9R3OJDwvx5DhCGxyqW6IuD4A3HGChHtcANdH+RWTyHquqgDSzpeHA=
 =Hhjk
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFJBAABCgAzFiEERCcr7u+ib5W/fkyWeneIey4u1GEFAmC1TdsVHGJlcnRiZWxk
 ZXJAZ21haWwuY29tAAoJEHp3iHsuLtRhYVEH/iHbk8AXA5xF8kV+q2R0IhRrtZjV
 8VjDiC1nTGfIJcjXxoUVa1VaYQlfxNxcKPc/PSoW/oUwSoS0I9QvAxPY81dPYNUe
 TtiJjf7fNWssu04TK/5rillRuag3e+AGrR605uK2A1b0Y/qlOumtaGN48TXcbyFt
 p/p4zXT9TSC+/cOxZFNjnh+UVwpqOJxWxXBBtzrsDcsBfdvOCy/fo7qwjmqbe/q4
 BDXNAG4AYHtg5X94b8bEgPDutUjk5HY08KA0EvVffGD0c3czvaF3lO7p8FHt95/3
 rG+hS02OxUWRe8rltZk6s1mItypig4EyWWoiUJMaPt8zTz1t9rdy+M0oEpY=
 =bAil
 -----END PGP SIGNATURE-----

Merge v1.10.3 into main (#10801)
2021-05-31 20:58:03 +00:00
Bert Belder
1567c1013c
v1.10.3 2021-05-31 20:20:42 +00:00
Casper Beyer
330cd6b7ea
feat(cli): support URL overloads for Deno.utime and Deno.utimeSync (#10792) 2021-05-31 20:05:57 +02:00
Yusuke Tanaka
475bc35646
chore: upgrade Tokio to 1.6.1 (#10782) 2021-05-31 16:37:35 +02:00
Luca Casonato
283e7ca92b
chore: release web extension@0.38.0 (#10773) 2021-05-31 16:37:35 +02:00
Yoshiya Hinosawa
7b1fd3d146
fix(runtime/http): fix empty blob response (#10689) 2021-05-31 16:37:32 +02:00
Nayeem Rahman
218ba031f0
fix(runtime/http): expose nextRequest() errors in respondWith() (#10384) 2021-05-31 16:37:30 +02:00
Yusuke Tanaka
22426fee1e
chore: update deno_lint binary used in CI to v0.5.0 (#10652) 2021-05-31 16:37:28 +02:00
Yusuke Tanaka
5f92f35bee
chore: upgrade Tokio to 1.6.1 (#10782) 2021-05-29 13:18:24 +02:00
Luca Casonato
d95056c10b
chore: release web extension@0.38.0 (#10773) 2021-05-29 00:19:26 +02:00
Kitson Kelly
59237d195f
feat(cli): upgrade to TypeScript 4.3 (#9960) 2021-05-28 09:33:11 +10:00
crowlKats
b21fa78a1e
feat(cli): add origin data dir to deno info (#10589)
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-27 14:23:12 +09:00
Bartek Iwańczuk
e5beb800c9
refactor: move JsRuntimeInspector to deno_core (#10763)
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-26 21:07:12 +02:00
Bartek Iwańczuk
e9edd7e14d
refactor: Rewrite Inspector implementation (#10725)
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-26 17:47:33 +02:00
Ben Noordhuis
af1546391c feat(extensions): BroadcastChannel WPT conformance
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-23 15:16:42 +02:00
Ben Noordhuis
8cf7f966f2 feat(extensions): add BroadcastChannel
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: #10354
2021-05-23 15:16:42 +02:00
Yoshiya Hinosawa
4a9b40b717
fix(runtime/http): fix empty blob response (#10689) 2021-05-21 10:11:53 +09:00
Nayeem Rahman
b43b639f45
fix(runtime/http): expose nextRequest() errors in respondWith() (#10384) 2021-05-19 21:39:52 +09:00
Yusuke Tanaka
cda09c166f
chore: update deno_lint binary used in CI to v0.5.0 (#10652) 2021-05-18 17:24:01 +02:00
Luca Casonato
5887dd3c95
chore: release crates (#10661)
For the Deno 1.10.2 release.
2021-05-17 17:34:35 +02:00
Luca Casonato
94eabfeeba
chore: update dependencies (#10660) 2021-05-17 14:44:40 +02:00
Casper Beyer
910935c071
feat(runtime): support urls for Deno.realPath and Deno.realPathSync (#10626) 2021-05-17 06:31:21 +02:00
Yusuke Tanaka
be2347ddc2
chore: upgrade Tokio to 1.6.0 (#10637) 2021-05-15 15:13:10 +02:00
Bartek Iwańczuk
de706961dc
chore: release crates (#10596) 2021-05-11 23:14:24 +02:00
Tim Ramlot
635253bd3a
feat(runtime/worker): Structured cloning worker message passing (#9323)
This commit upgrade "Worker.postMessage()" implementation to use 
structured clone algorithm instead of non-spec compliant JSON serialization.
2021-05-11 21:09:09 +02:00
Bert Belder
640d431b35
fix(tls): flush send buffer in the background after closing TLS stream (#10146)
In #9118, TLS streams were split into a "read half" and a "write half"
using tokio::io::split() to allow concurrent Conn#read() and
Conn#write() calls without one blocking the other. However, this
introduced a bug: outgoing data gets discarded when the TLS stream is
gracefully closed, because the read half is closed too early, before all
TLS control data has been received.

Fixes: #9692
Fixes: #10049
Fixes: #10296
Fixes: denoland/deno_std#750
2021-05-11 03:11:26 +02:00
Ryan Dahl
18c75f0e42
Switch grant/deny prompt to yes/no (#10547) 2021-05-10 07:11:34 -04:00
crowlKats
dfe528198d
feat: add WebStorage API (#7819)
This commit introduces localStorage and sessionStorage.
2021-05-10 12:02:47 +02:00
Aaron O'Mullan
d5f39fd121
cleanup(ops): remove unused ZeroCopyBuf arg-types (#10530) 2021-05-08 14:37:42 +02:00
Elias Sjögreen
4ed1428c34
fix: align plugin api with Extension (#10427) 2021-05-07 09:45:07 -04:00
Aaron O'Mullan
1e8e44f4c3
refactor(ops): replace ZeroCopyBuf arg by 2nd generic deserializable arg (#10448) 2021-05-06 19:32:03 +02:00
Luca Casonato
f208e6a26f
chore: update wgpu and realign to spec (#9760) 2021-05-06 16:48:45 +02:00
Aaron O'Mullan
d21380728f
fix(core): error registration could pollute constructors (#10422)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-05-03 17:30:41 +02:00
Aaron O'Mullan
8377957666
refactor(runtime): use Extensions (#10461) 2021-05-02 19:22:57 -04:00
Aaron O'Mullan
948d7dd287
cleanup(runtime): re-export deno_timers like all other deno crates (#10464) 2021-05-02 08:28:36 -04:00
Aaron O'Mullan
578f2ba45e
refactor(core): provide builtins as an Extension (#10449) 2021-04-30 21:08:29 -04:00
Andy Hayden
684c357136
Rename crate_ops to extensions (#10431) 2021-04-30 15:51:48 -04:00
Aaron O'Mullan
5ec478b5fa
refactor(core): initialize extensions in runtime constructor (#10421)
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-30 10:38:35 -04:00
Aaron O'Mullan
8922639c1d
refactor(core.js): provide window.__bootstrap (#10423) 2021-04-30 08:13:23 -04:00
Aaron O'Mullan
e89295b176
refactor(extensions): reintroduce builder (#10412) 2021-04-28 18:16:45 -04:00
Casper Beyer
c455c28b83
feat(test): run test modules in parallel (#9815)
This commit adds support for running test in parallel.

Entire test runner functionality has been rewritten
from JavaScript to Rust and a set of ops was added to support reporting in Rust.

A new "--jobs" flag was added to "deno test" that allows to configure 
how many threads will be used. When given no value it defaults to 2.
2021-04-28 20:17:04 +02:00
Aaron O'Mullan
0260b488fb
core: introduce extensions (#9800)
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-28 18:41:50 +02:00
Satya Rohith
2bd087ab1b
chore: upgrade dprint plugins (#10397) 2021-04-28 10:08:51 -04:00
Bert Belder
299518d935 fix(tls): throw meaningful error when hostname is invalid (#10387)
`InvalidDNSNameError` is thrown when a string is not a valid hostname,
e.g. it contains invalid characters, or starts with a numeric digit. It
does not involve a (failed) DNS lookup.
2021-04-26 23:40:45 +02:00
Ryan Dahl
9c3da280e0
remove #![deny(warnings)] (#10376)
Prefer RUSTFLAGS="-D warnings" to prevent warnings, but cannot 
enable yet due to #10378.
2021-04-26 10:10:57 -04:00
Casper Beyer
f3751e498f
feat(cli): add test permissions to Deno.test (#10188)
This commits adds adds "permissions" option to the test definitions 
which allows tests to run with different permission sets than 
the process's permission.

The change will only be in effect within the test function, once the 
test has completed the original process permission set is restored.

Test permissions cannot exceed the process's permission.
You can only narrow or drop permissions, failure to acquire a 
permission results in an error being thrown and the test case will fail.
2021-04-25 23:38:59 +02:00
Nayeem Rahman
fb1ccc3d88
refactor(cli): rename Deno.emit() bundle options to "module" and "classic" (#10332) 2021-04-26 06:54:57 +10:00
Aaron O'Mullan
83bece56b0
refactor(core): move op cache sync responsibility to rust space (#10340)
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-25 22:00:05 +02:00
Luca Casonato
52d316f143
chore: release crates (#10327)
Release crates for the cli 1.9.2 release.
2021-04-23 15:05:12 +02:00
Luca Casonato
0cef6aca86
chore: update dependencies (#10325)
This updates swc_* crates to latest, and various other deps.
2021-04-23 13:37:09 +02:00
Nayeem Rahman
8a416a5ba2
fix(runtime/js/http): cancel body on response failure (#10225) 2021-04-23 12:34:04 +02:00
Aaron O'Mullan
ff9ff4a377
refactor(core): simplify error handling (#10297)
- register builtin v8 errors in core.js so consumers don't have to
- remove complexity of error args handling (consumers must provide a 
  constructor with custom args, core simply provides msg arg)
2021-04-21 20:50:50 -04:00
Satya Rohith
3b78f6c449
fix: do not panic on not found cwd (#10238) 2021-04-21 17:52:00 +02:00
Bartek Iwańczuk
3432833574
chore: release crates (#10269)
* Revert "tooling(bench_util): benching and profiling utilities (#10223)"

This reverts commit 733a000305.

* Upgrade notify
2021-04-21 00:15:39 +02:00
Satya Rohith
15ffdd2624
fix(runtime): include HTTP op in WebWorker (#10207) 2021-04-20 16:26:31 +02:00
Luca Casonato
9e6cd91014
chore: align fetch to spec (#10203)
This commit aligns the `fetch` API and the `Request` / `Response`
classes belonging to it to the spec. This commit enables all the
relevant `fetch` WPT tests. Spec compliance is now at around 90%.

Performance is essentially identical now (within 1% of 1.9.0).
2021-04-20 14:47:22 +02:00
Yoshiya Hinosawa
8424647d22
chore: update copyright headers (#10243) 2021-04-20 14:27:36 +09:00
Kitson Kelly
b6203cb465
revert: Conn type changes in #10012 and #10061 (#10255)
Fixes #10200 (again)

This reverts commit 9c7c9a35c1 and a8057e3e06.
2021-04-20 10:12:33 +10:00
Luca Casonato
fe59e7ae60
fix(rt/http): correct URL in Request (#10256)
This commit fixes the URL returned from `request.url` in the HTTP server
to be fully qualified. This previously existed, but was removed and
accidentially not readded during optimizations of the HTTP ops.

Returning a non fully qualified URL from `Request#url` is not spec
compliant.
2021-04-19 17:07:44 +02:00
Liam Murphy
4786e1d92d
fix(runtime): handle race condition in postMessage where worker has terminated (#10239)
The panic was caused by the lack of an error class mapping for
futures::channel::TrySendError, but it shouldn't have been throwing an error in
the first place - when a worker has terminated, postMessage should just return.
The issue was that the termination message hadn't yet been recieved, so it was
carrying on with trying to send the message. This adds another check on the Rust
side for if the channel is closed, and if it is the worker is treated as
terminated.
2021-04-19 16:57:02 +02:00
Kitson Kelly
9c7c9a35c1
fix(#10200): weaken types so non-breaking (#10205)
Fixes #10200
2021-04-16 22:34:29 +10:00
Ryan Dahl
fe9cee620a
fix(#10182): hang during http server response (#10197) 2021-04-15 18:48:56 -04:00
Luca Casonato
353e79c796
chore: align FormData to spec (#10169)
This PR aligns `FormData` to spec. All WPT tests are passing.
2021-04-14 22:49:16 +02:00
Ben Noordhuis
5214acd3d9
refactor: move timers to deno_timers op crate (#10179)
Move timers out of runtime/ and into a standalone op crate.
2021-04-14 21:10:48 +02:00
Aaron O'Mullan
83f6d4bf94
perf(js/http): avoid v8 deopt in async iterator (#10160) 2021-04-14 07:56:14 -04:00
Bartek Iwańczuk
1be65bbe4f
chore: release crates (#10164) 2021-04-13 18:22:48 +02:00
Nayeem Rahman
df49a8462c
fix(cli/dts): Make respondWith() return a Promise (#10128) 2021-04-13 07:41:47 -04:00
crowlKats
8b59d9f7bc
feat(permissions): allow env permission to take values (#9825) 2021-04-13 13:25:21 +02:00
Luca Casonato
dabce813e0
perf: lazy header instantiation for HTTP requests (#10150)
This commit introduces a performance optimization for the native HTTP
server. From my testing it is about 2-6% faster than `main`. Request
headers in the HTTP servers are now lazilly instatated when they are
accessed, rather than being preemptively wrapped in the `Headers` class.
2021-04-13 02:46:33 +02:00
Aaron O'Mullan
46b1c653c0
refactor(deno): remove concept of bin & json ops (#10145) 2021-04-12 15:55:05 -04:00
Nayeem Rahman
a20504642d
fix(runtime/js/http): Correctly parse user response headers (#10076) 2021-04-12 10:24:45 -04:00
Casper Beyer
9d53dab4df
feat(runtime): add truncate and truncateSync methods to Deno.File (#10130) 2021-04-12 14:32:58 +02:00
Casper Beyer
da9219341f
feat(runtime): add stat and statSync methods to Deno.File (#10107) 2021-04-12 13:33:05 +02:00
Aaron O'Mullan
5c2a8cdbdc
perf(runtime): optimize PermissionState::check (#9993) 2021-04-12 13:24:41 +02:00
Casper Beyer
875ac73f1e
feat(runtime): stabilize Deno.fstat and Deno.fstatSync (#10108)
This commit stabilizes Deno.fstat and Deno.fstatSync 
which are well known system calls and have a stable interface.
2021-04-12 11:27:38 +02:00
Aaron O'Mullan
bf99039ea9
feat: Add Deno.memoryUsage() (#9986) 2021-04-12 10:47:44 +02:00
crowlKats
fefe93c91b
feat(runtime/permissions): prompt fallback (#9376)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-04-12 11:15:43 +09:00
Nayeem Rahman
8b49d948f5
fix(runtime/js/timers): Use (0, eval) instead of eval() (#10103) 2021-04-12 01:40:42 +02:00
Casper Beyer
f5a9474952
feat: stabilize Deno.ftruncate and Deno.ftruncateSync (#10126)
This stabilizes Deno.ftruncate and Deno.ftruncateSync.

This is a well known system call and the interface is 
not going to change. Implicitly requires write permissions 
as the file has to be opened with write to be truncated.
2021-04-11 14:05:22 +02:00
Luca Casonato
8d55d8b6be
feat(unstable): ALPN config in listenTls (#10065)
This commit adds the ability for users to configure ALPN protocols when
calling `Deno.listenTls`.
2021-04-10 22:04:44 +02:00
Aaron O'Mullan
1c6602b85b
runtime/inspector: pretend to be node (#10115)
Also change frontend URL from inspector.html to js_app.html
2021-04-10 13:12:59 -04:00
crowlKats
e7b7129b7a
feat(permissions): allow run permission to take values (#9833)
This commit adds allowlist support to `--allow-run` flag.

Additionally `Deno.permissions.query()` allows to query for specific
programs within allowlist.
2021-04-10 00:12:00 +02:00
Ryan Dahl
c6e7a243d5
API change: Deno.startHttp -> Deno.serveHttp (#10087) 2021-04-09 11:54:27 -04:00
Bartek Iwańczuk
70af812876
feat: native HTTP bindings (#9935)
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-08 18:34:15 -04:00
Luca Casonato
4e70ff80c2
chore: update deps (#10058)
This commit updates crate dependencies.
2021-04-08 18:46:14 +02:00
Inteon
d050b491b1
fix(core): error handling in examples (#9867) 2021-04-08 18:04:02 +02:00
Satya Rohith
543080de55
fix(runtime/readFile*): close resources on error during read (#10059)
This commit ensures readFile, readFileSync, readTextFile,
and readTextFileSync does not leak resources on error.
2021-04-08 16:36:52 +02:00
Luca Casonato
966ce7de8a
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.
2021-04-07 15:22:14 +02:00
Luca Casonato
00e63306cb
refactor: add deno_file op crate (#10019)
Also enables WPT for FileReader.
2021-04-06 12:55:05 +02:00
Aaron O'Mullan
ff5d072702
refactor: rewrite "net" ops to use serde_v8 (#10028) 2021-04-06 10:33:43 +02:00
Luca Casonato
da60e2afcb
chore: deprecate Deno.Buffer and read/write utils (#9793)
This commit marks the `Deno.Buffer` / `Deno.readAll` /
`Deno.readAllSync` / `Deno.writeAll` / `Deno.writeAllSync` utils as
deprecated, and schedules them for removal in Deno 2.0. These
utilities are implemented in pure JS, so should not be part of the
Deno namespace.

These utilities are now available in std/io/buffer and std/io/util:
https://github.com/denoland/deno_std/pull/808.

This additionallty removes all internal dependance on Deno.Buffer.
2021-04-06 00:05:36 +02:00
Aaron O'Mullan
2aed322dd5
refactor: convert ops to use serde_v8 (#10009)
This commit rewrites most of the ops to use "serde_v8" instead
of "json" serialization.
2021-04-05 18:40:24 +02:00
Aaron O'Mullan
824bd2f5c3
refactor: Switch op_now to be a json-op (#9974) 2021-04-03 20:35:28 +02:00
upendra1997
8257f51d7e
fix(permissions): don't panic when no input is given (#9894)
Fixes #9633 

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-04-03 07:49:51 +11:00
Aaron O'Mullan
058579da56
refactor(ops): remove variadic buffers (#9944) 2021-04-02 09:47:57 -04:00
Kitson Kelly
df1d36a759 chore: bump dependent crates for cli (#9964) 2021-04-02 22:22:08 +11:00
Aaron O'Mullan
fec1b2a5a4
refactor: new optimized op-layer using serde_v8 (#9843)
- Improves op performance.
- Handle op-metadata (errors, promise IDs) explicitly in the op-layer vs
  per op-encoding (aka: out-of-payload).
- Remove shared queue & custom "asyncHandlers", all async values are
  returned in batches via js_recv_cb.
- The op-layer should be thought of as simple function calls with little
  indirection or translation besides the conceptually straightforward
  serde_v8 bijections.
- Preserve concepts of json/bin/min as semantic groups of their
  inputs/outputs instead of their op-encoding strategy, preserving these
  groups will also facilitate partial transitions over to v8 Fast API for the
  "min" and "bin" groups
2021-03-31 10:37:38 -04:00
Aaron O'Mullan
940b3a26bd
chore: Add missing copyright headers (#9910) 2021-03-27 01:33:06 +01:00
Ryan Dahl
f46e39c5c5
remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
Yusuke Tanaka
e7954413e1
upgrade: Rust 1.51.0 (#9895) 2021-03-25 19:17:37 +01:00
Bartek Iwańczuk
c08284ab9d
chore: release crates (#9847) 2021-03-21 16:10:08 +01:00
Nayeem Rahman
dd12a668e7
refactor(runtime/permissions): Rename permission structs (#9841) 2021-03-21 08:49:58 -04:00
Inteon
1251c89321
refactor: Move bin ops to deno_core and unify logic with json ops (#9457)
This commit moves implementation of bin ops to "deno_core" crates
as well as unifying logic between bin ops and json ops to reuse
as much code as possible (both in Rust and JavaScript).
2021-03-20 17:51:08 +01:00
Ryan Dahl
0d26a82ea9
upgrade: tokio 1.4.0 (#9842) 2021-03-20 11:51:27 -04:00
crowlKats
0f9c929b3a
fix(op_crates/webgpu): create instance only when required (#9771)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-03-20 00:43:54 +01:00
crowlKats
2d55090d8c
refactor(runtime/ops/worker_host): simplify worker perms handling (#9835) 2021-03-19 13:27:41 -04:00
Divy Srivastava
91ca58fb26
chores: enforce type ResourceId across codebase (#9837) 2021-03-19 13:25:37 -04:00
crowlKats
197305908b
normalize rids (#9832) 2021-03-18 20:55:31 -04:00
Aaron O'Mullan
7d12dd1899
fix: fallback to default UA and CA data for Deno.createHttpClient() (#9830) 2021-03-18 23:54:26 +01:00
crowlKats
b59151f39e
move runtime ops to serde ops (#9828) 2021-03-18 14:42:01 -04:00
Luca Casonato
62716422b9
chore(console): distinguish between log levels (#9824)
Change `Console.#printFunc` to pass a log level as the second argument
(0 = debug, 3 = error), instead of a boolean for `isErr`. This does not
change the Deno runtime behaviour at all.
2021-03-18 19:25:25 +01:00
Inteon
20627c9136
refactor: update minimal ops & rename to buffer ops (#9719)
This commit rewrites "dispatch_minimal" into "dispatch_buffer".

It's part of an effort to unify JS interface for ops for both json
and minimal (buffer) ops.

Before this commit "minimal ops" could be either sync or async
depending on the return type from the op, but this commit changes
it to have separate signatures for sync and async ops (just like 
in case of json ops).
2021-03-18 14:10:27 +01:00
crowlKats
0e70d9e59b
refactor: clean up permission handling (#9367) 2021-03-17 17:45:12 -04:00
Casper Beyer
b2a1ad0611
chore: Upgrade rustyline to 8.0.0 (#9781)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-03-15 14:08:41 +01:00
Casper Beyer
7286eea75c
fix(runtime): do not require deno namespace in workers for crypto (#9784) 2021-03-14 20:01:55 +01:00
Yusuke Tanaka
c8fbf6d38a
chore: upgrade to tokio 1.3.0 (#9778) 2021-03-14 10:03:24 -04:00
Luca Casonato
fbec6e39c7
chore: bump crates (#9769) 2021-03-12 22:29:07 +01:00
Luca Casonato
0770449c93
refactor: move Console to op_crates/console (#9770) 2021-03-12 21:23:59 +01:00
Luca Casonato
e83ff62ccb
chore: split web op crate (#9635)
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-12 16:17:18 +01:00
Bartek Iwańczuk
cdc0b6958d
chore: release crates (#9731) 2021-03-09 20:12:13 +01:00
Nayeem Rahman
0bc488c85c
fix(runtime/js): add navigator interface objects (#9685) 2021-03-08 13:27:49 +01:00
Tobias Nießen
ceeebe46ee
chore: fix decendents in runtime readme (#9718) 2021-03-08 13:23:46 +01:00