0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

1154 commits

Author SHA1 Message Date
Bartek Iwańczuk
204c46dcc1
chore: forward v1.26.2 to main (#16331)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>

<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
-->

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17 23:11:16 +02:00
Cre3per
cf1be5e76f
fix: add error cause in recursive cause tail (#16306) 2022-10-16 21:16:46 +02:00
Bartek Iwańczuk
edaba4d06b
chore: upgrade rusty_v8 to 0.53.1 (#16303)
This commit fixes startup time regression, caused by update
to rusty_v8 v0.50.0.
2022-10-16 13:26:06 +02:00
Andreu Botella
8a736d7dc7
fix(docs): Documentation improvements related to JsRealm. (#16247) 2022-10-15 22:44:51 +02:00
Bartek Iwańczuk
e32719c291
refactor(core): use isolate get_data/set_data instead of slots (#16286) 2022-10-15 16:01:01 +02:00
Bartek Iwańczuk
8283d37c51
bench: avoid port collision (#16285) 2022-10-15 13:35:04 +02:00
Bartek Iwańczuk
e7d7585065
chore: upgrade rusty_v8 to 0.53.0 (#16272) 2022-10-15 01:53:13 +02:00
Luca Casonato
1ab3691b09
feat(core): add Deno.core.writeAll(rid, chunk) (#16228)
This commit adds a new op_write_all to core that allows writing an
entire chunk in a single async op call. Internally this calls
`Resource::write_all`.

The `writableStreamForRid` has been moved to `06_streams.js` now, and
uses this new op. Various other code paths now also use this new op.

Closes #16227
2022-10-10 10:28:35 +02:00
Luca Casonato
3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Jakub Łabor
7c3df66be7
feat(core): Reorder extension initialization (#16136) 2022-10-07 14:38:06 +02:00
Bartek Iwańczuk
5733de8a2e
chore: upgrade rusty_v8 to 0.52.0 (#16183) 2022-10-07 09:21:56 +05:30
denobot
afeacb8328
chore: forward v1.26.1 release commit to main (#16178)
This is the release commit being forwarded back to main for 1.26.1

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.26.1 && git checkout -b forward_v1.26.1 upstream/forward_v1.26.1
```

Don't need this PR? Close it.

cc @cjihrig

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06 16:49:40 -04:00
Divy Srivastava
0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Marcos Casagrande
569287b15b
perf(ext/fetch): consume body using ops (#16038)
This commit adds a fast path to `Request` and `Response` that
make consuming request bodies much faster when using `Body#text`,
`Body#arrayBuffer`, and `Body#blob`, if the body is a FastStream.
Because the response bodies for `fetch` are FastStream, this speeds up
consuming `fetch` response bodies significantly.
2022-10-04 15:48:50 +02:00
Darshan Sen
bac3a1210f
fix(serde_v8): serialize objects with numeric keys correctly (#15946)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
2022-10-02 22:18:31 +02:00
Luca Casonato
20c7300412
refactor(ext/http): remove op_http_read (#16096)
We can use Resource::read_return & op_read instead. This allows HTTP
request bodies to participate in FastStream.

To make this work, `readableStreamForRid` required a change to allow non
auto-closing resources to be handled. This required some minor changes
in our FastStream paths in ext/http and ext/flash.
2022-09-30 07:54:12 +02:00
denobot
d8827514ff
1.26.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-29 00:10:44 +02:00
Guilherme Bernal
6c55772f0d
feat(core): add Deno.core.setPromiseHooks (#15475) 2022-09-28 16:09:33 +02:00
Satya Rohith
b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
Aapo Alasuutari
b5dfcbbcbe
feat(ops): Fallible fast ops (#15989) 2022-09-23 08:25:37 +05:30
David Sherret
1b04ff0782
chore: forward v1.25.4 release commit to main (#16001) 2022-09-22 15:58:43 -04:00
Aaron O'Mullan
388e880dd0
examples(core): panik (#15983) 2022-09-22 11:00:13 +05:30
Aapo Alasuutari
707e9e3580
feat(ops): Automatic fast ops creation (#15527) 2022-09-22 10:05:24 +05:30
Divy Srivastava
3864961364
perf(core): use single ObjectTemplate for ops in initialize_ops (#15959) 2022-09-19 20:43:34 +05:30
Ben Noordhuis
b1b418b81a
chore: fix clippy warnings (#15944)
Stop allowing clippy::derive-partial-eq-without-eq and fix warnings
about deriving PartialEq without also deriving Eq.

In one case I removed the PartialEq because it a) wasn't necessary,
and b) sketchy because it was comparing floating point numbers.

IMO, that's a good argument for enforcing the lint rule, because it
would most likely have been caught during review if it had been enabled.
2022-09-19 10:25:03 +02:00
Darshan Sen
e7934432ce
chore: upgrade rusty_v8 to v0.50.0 (#15762)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-17 11:55:19 +02:00
Ryan Dahl
684841a18c
upgrade deps (#15914) 2022-09-16 19:11:30 -04:00
Colin Ihrig
ee208c1b20
chore: forward v1.25.3 release commit to main (#15919)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-09-15 16:24:06 -04:00
Divy Srivastava
a54d5654a2
perf: optimize URL serialization (#15663) 2022-09-10 09:15:16 +05:30
denobot
3bce2af0eb
chore: forward v1.25.2 release commit to main (#15831)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-09-09 20:31:43 +09:00
Leo Kettmeir
93cbac69e8
chore: update url crate to 2.3.1 (#15818) 2022-09-08 19:04:59 +02:00
David Sherret
9e6917426a
fix: upgrade deno_ast to 0.19 (#15808) 2022-09-07 15:06:18 -04:00
Divy Srivastava
429759fe8b
chore: bump url crate to 2.3.0 (#15800) 2022-09-07 19:07:46 +05:30
Colin Ihrig
3b1204eb2d
fix(core): make errors more resistant to tampering (#15789)
This commit makes error objects more resistant to
prototype tampering.

This bug was found when updating the deno_std Node compatibility
layer to Node 18. The Node test 'parallel/test-assert-fail.js'
was breaking std's assertion library.

Refs: https://github.com/denoland/deno_std/pull/2585
2022-09-07 09:11:16 -04:00
Divy Srivastava
027d4d433d
perf(ops): inline &[u8] arguments and enable fast API (#15731) 2022-09-07 16:21:47 +05:30
Divy Srivastava
d57f9d560d
fix(ext/flash): use utf8 length as Content-Length (#15793) 2022-09-07 16:21:30 +05:30
Aapo Alasuutari
199e6f2a38
fix(core): opAsync leaks a promise on type error (#15795) 2022-09-07 13:50:30 +05:30
Divy Srivastava
d2a408f452
perf(runtime): short-circuit queue_async_op for Poll::Ready (#15773) 2022-09-06 23:08:37 +05:30
Giovanny Gutiérrez
2929ddabaa
fix(core): Register external references for imports to the SnapshotCreator (#15621)
Several functions used for handling of dynamic imports and "import.meta"
object were not registered as external references and caused V8 to crash
during snapshotting. These functions are now registered as external refs
and aborts are no longer happening.
2022-09-06 14:35:04 +02:00
Nayeem Rahman
118dd47ad0
fix(watch): ignore unload errors on drop (#15782) 2022-09-06 13:18:23 +02:00
Nayeem Rahman
4f8dea100e
refactor(test): grab runTests() and runBenchmarks() from __bootstrap (#15420) 2022-09-02 19:44:45 +02:00
Garcia
4ec213b0aa
fix(ext/timers): create primordial eval (#15110) 2022-09-02 17:55:44 +02:00
Nayeem Rahman
a74b2ecf37
fix(repl): don't terminate on unhandled error events (#15548) 2022-09-02 12:43:39 +02:00
denobot
658d2cdff2
chore: forward v1.25.1 release commit to main (#15735)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-09-02 07:42:47 +02:00
Andreu Botella
307d84cfa5
refactor(core): Move optional callbacks from JsRuntimeState to ContextState (#15599)
The `JsRuntimeState` struct stores a number of JS callbacks that are
used either in the event loop or when interacting with V8. Some of
these callback fields are vectors of callbacks, and therefore could
plausibly store at least one callback per realm. However, some of
those fields are `Option<v8::Global<v8::Function>>`, which would make
the callbacks set by a realm override the one that might have been set
by a different realm.

As it turns out, all of the current such optional callbacks
(`js_promise_reject_cb`, `js_format_exception_cb` and
`js_wasm_streaming_cb`) are only used from inside a realm, and
therefore this change makes it so such callbacks can only be set from
inside a realm, and will only affect that realm.
2022-09-01 23:01:05 +02:00
Geert-Jan Zwiers
58e76098e6
fix(serde_v8): no panic on reading large text file (#15494)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-09-01 22:20:11 +02:00
Divy Srivastava
e267ec6ed5
chore(serde_v8): take mutable reference in ToV8::to_v8 (#15707) 2022-09-01 15:54:40 +05:30
Divy Srivastava
a7558196a7
perf: use fast api for core.isProxy (#15682) 2022-08-30 14:31:36 +05:30
Divy Srivastava
8e1c0e5141
perf(runtime): optimize allocations in read/write checks (#15631) 2022-08-27 20:50:05 +05:30
Bartek Iwańczuk
8986e2ced4
v1.25.0 2022-08-25 00:20:07 +02:00
Bartek Iwańczuk
86ef743c0f
chore: upgrade rusty_v8 to v0.49.0 (#15547) 2022-08-23 14:51:04 +02:00
Geert-Jan Zwiers
ecf3b51fd9
refactor(core/runtime): clean up extra type cast (#15539) 2022-08-23 09:24:17 +05:30
Giovanny Gutiérrez
5ea51702bd
fix: Free up JsRuntime state global handles before snapshot (#15491) 2022-08-21 21:03:56 +02:00
Nayeem Rahman
97954003cc
feat: queueMicrotask() error handling (#15522)
Adds error event dispatching for queueMicrotask(). Consequently unhandled errors are now reported with Deno.core.terminate(), which is immune to the existing quirk with plainly thrown errors (#14158).
2022-08-21 20:16:42 +02:00
Mathias Lafeldt
e96933bc16
chore: use Rust 1.63.0 (#15464) 2022-08-21 19:31:14 +02:00
Divy Srivastava
906aa78af3
feat(ops): V8 Fast Calls (#15291) 2022-08-21 17:37:53 +05:30
Nayeem Rahman
e39d4e3e7f
fix(core/runtime): always cancel termination in exception handling (#15514) 2022-08-21 13:57:10 +02:00
Divy Srivastava
cd21cff299
feat(ext/flash): An optimized http/1.1 server (#15405)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-08-18 17:35:02 +05:30
Bartek Iwańczuk
5a4f84a0e1
chore: upgrade rusty_v8 to 0.48.1 (#15310) 2022-08-15 14:12:11 +02:00
denobot
e4a5f9952f
chore: forward v1.24.3 release commit to main (#15462)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-08-11 16:47:03 -04:00
Aapo Alasuutari
2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params).

Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple:

```
opSync("op_foo", param1, param2);
// -> turns to
ops.op_foo(param1, param2);
```

This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path.

Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11 15:56:56 +02:00
Nayeem Rahman
25a1cc1b28
refactor(core): unwrap sync ops in rust (#15449) 2022-08-11 11:57:20 +02:00
Andreu Botella
f16fe44303
feat(core): Add support for async ops in realms (#14734)
Pull request #14019 enabled initial support for realms, but it did not
include support for async ops anywhere other than the main realm. The
main issue was that the `js_recv_cb` callback, which resolves promises
corresponding to async ops, was only set for the main realm, so async
ops in other realms would never resolve. Furthermore, promise ID's are
specific to each realm, which meant that async ops from other realms
would result in a wrong promise from the main realm being resolved.

This change creates a `ContextState` struct, similar to
`JsRuntimeState` but stored in a slot of each `v8::Context`, which
contains a `js_recv_cb` callback for each realm. Combined with a new
list of known realms, which stores them as `v8::Weak<v8::Context>`,
and a change in the `#[op]` macro to pass the current context to
`queue_async_op`, this makes it possible to send the results of
promises for different realms to their realm, and prevent the ID's
from getting mixed up.

Additionally, since promise ID's are no longer unique to the isolate,
having a single set of unrefed ops doesn't work. This change therefore
also moves `unrefed_ops` from `JsRuntimeState` to `ContextState`, and
adds the lengths of the unrefed op sets for all known realms to get
the total number of unrefed ops to compare in the event loop.

Co-authored-by: Luis Malheiro <luismalheiro@gmail.com>
2022-08-10 20:04:20 +02:00
denobot
cf33720a85
chore: forward v1.24.2 release commit to main (#15410) 2022-08-05 00:10:47 +02:00
Zach
00b51ca94b
core: remove heapStats type definition (#15393) 2022-08-03 14:41:44 +02:00
Nayeem Rahman
96290f1a66
refactor(core/error): use evaluated call sites for formatting (#15369) 2022-08-01 17:17:55 +02:00
Zicklag
d81c5b51b3
core: Add types for Deno.core.print() (#15283) 2022-07-31 22:15:29 +02:00
Bartek Iwańczuk
20a89d46c4
fix(core): BorrowMutError in nested error (#15352) 2022-07-30 16:09:42 +02:00
Colin Ihrig
088bc52db0
Forward 1.24.1 to main (#15333) (#15336)
1.24.1 (#15333)

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-07-29 08:44:46 -04:00
Arthur Silva
5d263c932f
serde_v8: improvements to avoid hitting unimplemented codepaths (#13915) 2022-07-28 12:46:10 +02:00
Bartek Iwańczuk
3d40eee4b2
chore: upgrade rusty_v8 to 0.47.1 (#15324) 2022-07-27 18:45:26 +05:30
Bartek Iwańczuk
2e1d6d3508
refactor(core): remove unneeded ops for uncaughtException (#15296) 2022-07-25 01:10:56 +02:00
Bartek Iwańczuk
504d2936ec
fix: unhandledrejection handling for sync throw in top level (#15279)
Fixes an edge in "unhandledrejection" event that prevent synchronous
errors being surfaced when throw from a top-level scope.
2022-07-23 00:40:42 +02:00
Divy Srivastava
4db650ddd5
Revert "feat(ops): V8 Fast Calls (#15122)" (#15276)
This reverts commit 03dc3b8972.
2022-07-22 19:06:32 +05:30
Divy Srivastava
03dc3b8972
feat(ops): V8 Fast Calls (#15122)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-22 17:54:22 +05:30
denobot
f0e01682cc
1.24.0 (#15262)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-07-21 01:28:00 +02:00
Bartek Iwańczuk
d53936eb7d
Reland "feat: add "unhandledrejection" event support" (#15211) 2022-07-20 20:28:19 +02:00
Bartek Iwańczuk
1bdf5a2081
chore: upgrade rusty_v8 to 0.47.0 (#15247) 2022-07-19 21:36:15 +02:00
David Sherret
0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
Bartek Iwańczuk
9eb70bdb5f
reland: "fix(core): unhandled rejection in top-level scope" (#15236)
Reland #15204
2022-07-18 21:20:38 +02:00
Bartek Iwańczuk
999cbfb52b
feat: import.meta.resolve() (#15074)
This commit adds new "import.meta.resolve()" API which
allows to resolve specifiers relative to the module the API
is called in. This API supports resolving using import maps.
2022-07-18 20:05:26 +02:00
Bartek Iwańczuk
0f6b455c96
Revert "fix(core): unhandled rejection in top-level scope (#15204)" (#15226)
This reverts commit 48a7312f38.
2022-07-18 12:52:54 +02:00
Bartek Iwańczuk
f9b692e68e
Revert "feat: add "unhandledrejection" event support (#12994) (#15080)" (#15210)
This reverts commit 1a7259b04b.
2022-07-15 01:06:20 +02:00
Bartek Iwańczuk
1a7259b04b
feat: add "unhandledrejection" event support (#12994) (#15080)
Relanding #12994 

This commit adds support for "unhandledrejection" event.

This event will trigger event listeners registered using:

"globalThis.addEventListener("unhandledrejection")
"globalThis.onunhandledrejection"
This is done by registering a default handler using
"Deno.core.setPromiseRejectCallback" that allows to
handle rejected promises in JavaScript instead of Rust.

This commit will make it possible to polyfill
"process.on("unhandledRejection")" in the Node compat
layer.

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-07-14 22:39:20 +02:00
Bartek Iwańczuk
48a7312f38
fix(core): unhandled rejection in top-level scope (#15204)
Update "deno_core" to not forward rejection of top level module
if it was already handled by appropriate handlers.

Co-authored-by: Colin Ihrig cjihrig@gmail.com
2022-07-14 21:01:08 +02:00
Bartek Iwańczuk
2423f83ca8
chore: upgrade rusty_v8 to v0.46.0 (#15200) 2022-07-14 12:03:31 +02:00
Colin Ihrig
7610764980
chore: forward v1.23.4 release commit to main (#15172)
1.23.4 (#15168)

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-07-12 17:08:36 -04:00
David Sherret
687c712be3
fix: upgrade deno_ast to 0.17 (#15152) 2022-07-11 14:10:12 -04:00
Andreu Botella
018ad9b3a4
chore(web, worker): Use DetachedBuffer for postMessage ops (#15133)
This commit uses `DetachedBuffer` instead of `ZeroCopyBuf` in the ops
that back `Worker.prototype.postMessage` and
`MessagePort.prototype.postMessage`. This is done because the
serialized buffer is then copied to the destination isolate, even
though it is internal to runtime code and not used for anything else,
so detaching it and transferring it instead saves an unnecessary copy.
2022-07-11 17:27:33 +02:00
Andreu Botella
83c9714fb2
chore(core): Deduplicate code related to op_event_loop_has_more_work (#15147)
The `op_event_loop_has_more_work` op, introduced in #14830, duplicates
code from `JsRuntime::poll_event_loop`. That PR also added the unused
method `JsRuntime::event_loop_has_work`, which is another duplication
of that same code, and which isn't used anywhere.

This change deduplicates this by renaming
`JsRuntime::event_loop_has_work` to `event_loop_pending_state`, and
making it the single place to determine what in the event loop is
pending. This result is then returned in a struct which is used both
in the event loop and in the `op_event_loop_has_more_work` op.
2022-07-11 12:08:37 +02:00
Aapo Alasuutari
3da182b0b8
fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop middleware calls (#15116) 2022-07-09 11:49:20 +02:00
Divy Srivastava
20cbd7f0f8
perf(ext/ffi): leverage V8 Fast Calls (#15125) 2022-07-08 23:19:09 +05:30
Divy Srivastava
b3b3018273
chore: upgrade rusty_v8 to 0.45.0 (#15123) 2022-07-08 18:25:54 +02:00
Bartek Iwańczuk
870eb0df81
fix(core): deflake WASM termination test (#15103) 2022-07-07 16:28:29 +02:00
Andreu Botella
f0ef15ff07
refactor(core): Use &mut Isolate as an argument in JsRealm methods (#15093)
Currently almost every `JsRealm` method has a `&mut JsRuntime`
argument. This argument, however, is only used to get the runtime's
corresponding isolate. Given that a mutable reference to the
corresponding `v8::Isolate` can be reached from many more places than
a mutable reference to the `JsRuntime` (for example, by derefing a V8
scope), changing that will make `JsRealm` usable from many more places
than it currently is.
2022-07-06 00:45:10 +02:00
Arthur Silva
cdba53a73d
feat(core): Re-export v8 use_custom_libcxx feature (#14475) 2022-07-05 23:01:41 +02:00
David Sherret
1cc59e6c5c chore: unpin pin project to fix cargo publish (#15085) 2022-07-05 14:24:40 -04:00
denobot
ef312e0050 1.23.3 (#15081)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-07-05 14:24:40 -04:00
Bartek Iwańczuk
06934db883
Revert "feat: add "unhandledrejection" event support (#12994)" (#15075)
This reverts commit f7af0b01a5.
2022-07-04 23:34:39 +02:00
Bartek Iwańczuk
f7af0b01a5
feat: add "unhandledrejection" event support (#12994)
This commit adds support for "unhandledrejection" event.

This event will trigger event listeners registered using:

"globalThis.addEventListener("unhandledrejection")
"globalThis.onunhandledrejection"
This is done by registering a default handler using
"Deno.core.setPromiseRejectCallback" that allows to
handle rejected promises in JavaScript instead of Rust.

This commit will make it possible to polyfill
"process.on("unhandledRejection")" in the Node compat
layer.

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
2022-07-04 21:14:58 +02:00
Bartek Iwańczuk
b8b82c3ea4
chore: use Rust 1.62.0 (#15028) 2022-07-01 15:28:06 +02:00
João Avelino Bellomo Filho
77c25beaa5
fix(core): handle exception from Wasm termination (#15014)
Co-authored-by: Augusto Lenz <augustollenz@gmail.com>
2022-07-01 09:51:29 +02:00
Nugine
a27acbc2ec
fix(core): remove unsafe in OpsTracker (#15025) 2022-07-01 00:43:25 +02:00
David Sherret
3d8ba30ea0
chore: forward 1.23.2 to main (#15027)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-30 18:01:08 -04:00
Divy Srivastava
79c5b84eab
chore: upgrade rusty_v8 to 0.44.3 (#15019) 2022-06-30 14:17:39 +05:30
Colin Ihrig
0f6a5c5fc2
feat(web): add beforeunload event (#14830)
This commit adds the 'beforeunload' event.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-28 10:49:30 -04:00
Aapo Alasuutari
00f4521b20
feat(ext/ffi): Thread safe callbacks (#14942) 2022-06-28 14:53:36 +05:30
Luca Casonato
8d82ba7299
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-06-26 00:13:24 +02:00
Andreu Botella
38505db391
fix(modules): Immediately resolve follow-up dyn imports to a dyn imported module (#14958)
When a dynamically imported module gets resolved, any code that comes after an
await import() to that module will continue running. However, if that is the
last code in the evaluation of another dynamically imported module, that second
module will not resolve until the next iteration of the event loop, even though
it does not depend on the event loop at all.

When the event loop is being blocked by a long-running operation, such as a
long-running timer, or by an async op that might never end, such as with workers
or BroadcastChannels, that will result in the second dynamically imported module
not being resolved for a while, or ever.

This change fixes this by running the dynamic module loading steps in a loop
until no more dynamic modules can be resolved.
2022-06-25 20:56:29 +02:00
Divy Srivastava
18c9a7ad64
fix(core): don't panic on non-existent cwd (#14957)
Co-authored-by: cjihrig <cjihrig@gmail.com>
2022-06-25 09:21:58 +05:30
Kayla Washburn
215f3d4c8e
v1.23.1 (#14954)
1.23.1 (#14952)

Co-authored-by: aslilac <aslilac@users.noreply.github.com>
Co-authored-by: Kayla Washburn <mckayla@hey.com>

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: aslilac <aslilac@users.noreply.github.com>
2022-06-23 15:27:41 -06:00
Bartek Iwańczuk
13f47ec41b
chore: upgrade rusty_v8 to 0.44.2 (#14947) 2022-06-23 15:49:28 +02:00
David Sherret
ca4385ad68
fix: upgrade swc via deno_ast 0.16 (#14930) 2022-06-22 15:42:08 -04:00
Nayeem Rahman
79b42808a4
perf(core): Cache source lookups (#14816)
Keep a cache for source maps and source lines. 

We sort of already had a cache argument for source map lookup 
functions but we just passed an empty map instead of storing it. 

Extended it to cache source line lookups as well and plugged it 
into runtime state.
2022-06-20 14:42:20 +02:00
Christian Dürr
94d369ebc6
docs: Improve mod_evaluate documentation (#14827) 2022-06-20 14:40:57 +02:00
denobot
e7ea4edc8a
1.23.0 (#14878)
* 1.23.0

* docs(Releases.md): update a few items for 1.23

* docs(Releases.md): revert bad formatting

Co-authored-by: aslilac <aslilac@users.noreply.github.com>
Co-authored-by: McKayla Washburn <mckayla@hey.com>
2022-06-15 17:02:18 -06:00
Ryan Dahl
d0dec8d36b
chore: upgrade various deps (#14876)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-15 13:48:53 -04:00
Ryan Dahl
3d2394954c
upgrade: v8 10.4.132.5 (#14874) 2022-06-15 12:30:19 -04:00
Colin Ihrig
cf866c5ad3
chore: Forward v1.22.3 to main (#14835)
* 1.22.3 (#14832)
* chore: pin swc versions to fix cargo publish

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-06-09 16:57:16 -04:00
Bartek Iwańczuk
99f525a66c
refactor(core): SourceMapGetter doesn't need Send + Sync (#14808) 2022-06-07 17:26:08 +02:00
Nayeem Rahman
9385a91312
refactor(core): Move Deno.core bindings to ops (#14793) 2022-06-07 11:25:10 +02:00
Nayeem Rahman
e3eae662f3
fix: Format non-error exceptions (#14604)
This commit adds "Deno.core.setFormatExceptionCallback" which
can be used to provide custom formatting for errors. It is useful
in cases when user throws something that is non-Error (eg.
a string, plain object, etc).
2022-06-06 20:26:57 +02:00
Bartek Iwańczuk
de562b0215
chore: Forward v1.22.2 to main (#14785) 2022-06-02 22:29:41 +02:00
Andreu Botella
01e5bbadac
test(core): Test that sync ops return/throw objects in the right realm (#14750)
This behavior was introduced in #14019 but wasn't properly tested in
that PR.
2022-05-30 13:18:32 +02:00
Kitson Kelly
1c44f4060e
1.22.1
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2022-05-27 17:36:43 +10:00
Mark Ladyshau
402b497299
fix(core): rethrow exception during structured cloning serialization (#14671)
- Introduced optional callback for Deno.core.serialize API, that returns
cloning error if there is one.
- Removed try/catch in seralize structured clone function and throw error from
callback.
- Removed "Object with a getter that throws" assertion from WPT.
2022-05-26 17:14:38 +02:00
Bartek Iwańczuk
3aa6d5d8b0
chore: upgrade rusty_v8 to 0.43.1 (#14713) 2022-05-26 13:13:01 +02:00
Aaron O'Mullan
5e62ee31d7
fix(core): op metrics op_names mismatch (#14716) 2022-05-24 22:21:32 +02:00
David Sherret
1fcecb6789
refactor: upgrade to deno_ast 0.15 (#14680) 2022-05-20 16:40:55 -04:00
denobot
5ad8919d64
1.22.0 (#14657)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-05-18 20:35:16 +05:30
Aaron O'Mullan
9766399a3f
fix(core): support classifying ENOTDIR (#14646) 2022-05-17 19:20:57 +02:00
Divy Srivastava
68bf43fca7
feat(core): deterministic snapshots (#14037) 2022-05-17 20:49:55 +05:30
Aaron O'Mullan
8744ee883e
perf(core): optimize encode on large strings (#14619)
Follow up to serde_v8's #14450
2022-05-15 17:52:32 +02:00
Aaron O'Mullan
f5c31b56e3
Revert "core: don't include_str extension js code (#10786)" (#14614)
This reverts commit 10e50a1207

Alternative to #13217, IMO the tradeoffs made by #10786 aren't worth it.

It breaks abstractions (crates being self-contained, deno_core without snapshotting etc...) and causes pain points / gotchas for both embedders & devs for a relatively minimal gain in incremental build time ...

Closes #11030
2022-05-15 13:27:56 +02:00
Divy Srivastava
20ee3110d8
chore: upgrade rusty_v8 to 0.42.1 (#14597) 2022-05-14 15:26:31 +05:30
Andreu Botella
3e7afb8918
chore(runtime): Make some ops in ext and runtime infallible. (#14589)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-13 10:36:31 +02:00
Aaron O'Mullan
c6063e390a
feat(ops): infallible / result-free ops (#14585) 2022-05-12 19:13:25 +02:00
Aaron O'Mullan
5e6d3d42c7
feat(ops): #[op(v8)] (#14582) 2022-05-12 19:06:42 +02:00
Bert Belder
89b428234c
1.21.3 (#14584) 2022-05-12 18:43:00 +02:00
Aaron O'Mullan
d0f5cd6a06
fix(core): avoid panic on non-string Error.name (#14529)
Fixes #14518
2022-05-08 23:03:00 +02:00
Bartek Iwańczuk
bcd875030a
refactor(core): add AssertedModuleType enum (#14501)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-05-07 18:46:35 +02:00
Colin Ihrig
23c77df664
1.21.2 (#14508)
1.21.2
2022-05-05 19:37:27 -04:00
Bartek Iwańczuk
45a4d75296
refactor(core): use Box<u8> for ModuleSource.code instead of a String (#14487) 2022-05-05 13:16:25 +02:00
Luca Casonato
242273e69b
chore: update deps (#14416) 2022-05-05 12:41:59 +02:00
Bartek Iwańczuk
3f08a40412
refactor: add core.formatLocationFilename, remove op_format_filename (#14474)
This commit moves "op_format_location" to "core/ops_builtin.rs"
and removes "Deno.core.createPrepareStackTrace" in favor of
"Deno.core.prepareStackTrace".

Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-03 19:45:57 +02:00
Leo Kettmeir
de2004dec5
Forward 1.21.1 (#14428) 2022-04-28 23:32:42 +02:00
Nayeem Rahman
9853c96cc4
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and 
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
2022-04-27 01:06:10 +02:00
Nayeem Rahman
74175c039a
refactor(core): Remove ErrWithV8Handle (#14394) 2022-04-26 15:28:42 +02:00
Aaron O'Mullan
12f7581ed9
cleanup(serde_v8): disambiguate ZeroCopyBuf (#14380) 2022-04-25 16:56:47 +02:00
Luca Casonato
1ad8c11bc9
chore: bump crates (#14365) 2022-04-22 16:54:42 +02:00
Divy Srivastava
57f7e07c13
Reland "perf(http): optimize ReadableStreams backed by a resource" (#14346) 2022-04-22 16:19:08 +05:30
denobot
29c8cd8aae
1.21.0 (#14336)
Co-authored-by: ry <ry@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-04-20 21:50:16 -04:00
Bartek Iwańczuk
03019e7781
Revert various PRs related to "ext/http" (#14339)
* Revert "feat(ext/http): stream auto resp body compression (#14325)"
* Revert "core: introduce `resource.read_return` (#14331)"
* Revert "perf(http): optimize `ReadableStream`s backed by a resource (#14284)"
2022-04-21 02:22:55 +02:00
Ryan Dahl
78c9cd9789
upgrade: rusty_v8 0.42.0 (#14334) 2022-04-20 19:13:31 -04:00
Divy Srivastava
2612b6f20f
core: introduce resource.read_return (#14331) 2022-04-20 18:39:13 +02:00
David Sherret
a64e63c361
perf: move Deno.writeTextFile and like functions to Rust (#14221)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-04-18 18:00:14 -04:00
Andreu Botella
19bb82aa40
feat(core): Add initial support for realms (#14019)
This commit adds tentative support for multiple realms in "deno_core". 

It adds the "JsRealm" API that adds methods like "JsRuntime"'s 
"handle_scope", "global_object" and "execute_script" specific to the realm.
2022-04-17 13:53:08 +02:00
Bartek Iwańczuk
a87be28a46
feat: Better formatting for AggregateError (#14285)
This commit adds "aggregated" field to "deno_core::JsError" that stores
instances of "JsError" recursively to properly handle "AggregateError"
formatting. Appropriate logics was added to "PrettyJsError" and
"console" API to format AggregateErrors.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-04-16 16:12:26 +02:00
Nayeem Rahman
8b31fc23cd
refactor: Move source map lookups to core (#14274)
The following transformations gradually faced by "JsError" have all been 
moved up front to "JsError::from_v8_exception()": 

- finding the first non-"deno:" source line; 
- moving "JsError::script_resource_name" etc. into the first error stack 
in case of syntax errors; 
- source mapping "JsError::script_resource_name" etc. when wrapping 
the error even though the frame locations are source mapped earlier; 
- removing "JsError::{script_resource_name,line_number,start_column,end_column}"
entirely in favour of "js_error.frames.get(0)". 

We also no longer pass a js-side callback to "core/02_error.js" from cli. 
I avoided doing this on previous occasions because the source map lookups 
were in an awkward place.
2022-04-15 16:08:09 +02:00
Bartek Iwańczuk
244926e83c
feat(test): format user code output (#14271)
This commit changes "deno test" to better denote user output coming
from test cases.

This is done by printing "---- output ----" and "---- output end ----"
markers if an output is produced. The output from "console" and
"Deno.core.print" is captured, as well as direct writes to "Deno.stdout"
and "Deno.stderr".

To achieve that new APIs were added to "deno_core" crate, that allow
to replace an existing resource with a different one (while keeping resource
ids intact). Resources for stdout and stderr are replaced by pipes.

Co-authored-by: David Sherret <dsherret@gmail.com>
2022-04-15 14:24:41 +02:00
David Sherret
0e4574b2e3
chore: forward v1.20.6 release commit to main (#14288) 2022-04-14 15:50:48 -04:00
Nayeem Rahman
7d50a5fd43
refactor(core/error): Clarify JsError message fields (#14269) 2022-04-13 16:41:39 +02:00
Nayeem Rahman
4d18f558e4
feat(ext/web): Add error events for event listener and timer errors (#14159)
- feat: Add handleable error event for even listener errors
- feat: Add handleable error event for setTimeout()/setInterval() errors
- feat: Add Deno.core.destructureError()
- feat: Add Deno.core.terminate()
- fix: Don't throw listener errors from dispatchEvent()
- fix: Use biased mode when selecting between mod_evaluate() and
  run_event_loop() results
2022-04-13 11:50:57 +02:00
David Sherret
a4c1e1bdcf
fix: upgrade to swc_ecmascript 0.143 (#14238) 2022-04-08 12:31:47 -04:00
Aaron O'Mullan
f5f7b56aca
refactor(core): OpCtx (#14228) 2022-04-08 10:32:48 +02:00
David Sherret
b2aaf708ab
chore: forward v1.20.5 release commit to main (#14232) 2022-04-07 14:40:20 -04:00
Bartek Iwańczuk
6c25b5135d
chore: update tokio, tokio-util and libc dependencies (#14174) 2022-04-02 19:54:40 +02:00
Aaron O'Mullan
13b9fc9304
feat(serde_v8): DetachedBuffer (#14102) 2022-04-02 13:35:57 +02:00
Aaron O'Mullan
25b6b2ed66
feat(ops): #[op(unstable)] (#14124) 2022-04-02 00:09:21 +02:00
David Sherret
7fec7c834c
1.20.4 (#14168) 2022-03-31 15:48:35 -04:00
Divy Srivastava
b18216a0d4
perf: micro-optimize core.encode (#14120) 2022-03-27 13:10:54 +05:30
Luca Casonato
37b0ec454c
chore: forward v1.20.3 release commit to main (#14121) 2022-03-25 18:53:55 +01:00
Kitson Kelly
cff1e92ecf 1.20.2 2022-03-24 14:47:06 +11:00
Andreu Botella
49be140d2b
chore(core): Remove a note that is no longer relevant. (#14069)
This note about how `v8::SnapshotCreator::create_blob` must not be
called from a `HandleScope` stopped being relevant in #6801, and was
now attached to code that had nothing to do with `HandleScope`s.
2022-03-22 22:57:15 +01:00
Aaron O'Mullan
f81334d5bd
feat(core): disableable extensions & ops (#14063)
Streamlines a common middleware pattern and provides foundations for avoiding variably sized v8::ExternalReferences & enabling fully monomorphic op callpaths
2022-03-22 16:39:58 +01:00
Filip Kieres
d2b7192c1b
feat(core): Add JsRuntime::get_module_namespace to access the namespace object of a module (#14026) 2022-03-22 14:32:32 +01:00
David Sherret
49012cbc33
feat: upgrade to swc_ecmascript 0.137.0 (#14067) 2022-03-22 09:19:53 -04:00
Andreu Botella
12d28dffc6
fix(fetch): Fix uncaught rejection panic with WebAssembly.instantiateStreaming (#13925)
When an exception is thrown during the processing of streaming WebAssembly,
`op_wasm_streaming_abort` is called. This op calls into V8, which synchronously
rejects the promise and calls into the promise rejection handler, if applicable.
But calling an op borrows the isolate's `JsRuntimeState` for the duration of the
op, which means it is borrowed when V8 calls into `promise_reject_callback`,
which tries to borrow it again, panicking.

This change changes `op_wasm_streaming_abort` from an op to a binding
(`Deno.core.abortWasmStreaming`). Although that binding must borrow the
`JsRuntimeState` in order to access the `WasmStreamingResource` stored in the
`OpTable`, it also takes ownership of that `WasmStreamingResource` instance,
which means it can drop any borrows of the `JsRuntimeState` before calling into
V8.
2022-03-22 11:33:29 +01:00
Aaron O'Mullan
c5792d6d1d
fix(core): variadic opSync/opAsync (#14062) 2022-03-21 18:04:57 +01:00
Aaron O'Mullan
d0a7305676
cleanup(core): drop op_void_async's state arg (#14045) 2022-03-20 14:54:38 +01:00
Divy Srivastava
5e82bcf0e4
chore(core): update deno_core README (#14042)
Co-authored-by: Andreu Botella <andreu@andreubotella.com>
2022-03-20 16:08:35 +05:30
Aaron O'Mullan
52459faf0b
fix(ops): throw TypeError on op return failure (#14033)
Fixes #14028
2022-03-19 15:59:44 +01:00
Aapo Alasuutari
ad8e238348
chore(core,ext): minor JS optimisations (#13950) 2022-03-19 18:26:54 +09:00
Ryan Dahl
fce60f2cc2
v1.20.1 2022-03-16 21:40:31 -04:00
Ryan Dahl
418c1eb4b3
v1.20.0 2022-03-16 16:07:35 -04:00
Aaron O'Mullan
895e474295
cleanup(core): recursive get & ensure helpers (#13972) 2022-03-16 09:04:38 +01:00
Aaron O'Mullan
bd481bf095
feat(ops): optional OpState (#13954) 2022-03-16 00:33:46 +01:00
Andreu Botella
672f66dde1
perf(web): Optimize TextDecoder by adding a new U16String type (#13923) 2022-03-16 00:22:00 +01:00
Aaron O'Mullan
bb53135ed8
cleanup(core): OpPair => OpDecl (#13952) 2022-03-15 23:43:17 +01:00
Aaron O'Mullan
60466de5d5
cleanup(core): remove void_op_a?sync (#13953)
In favour of `op_void_sync` & `op_void_async`
2022-03-15 22:58:03 +01:00
Aaron O'Mullan
07d8431f10
fix(core): nuke Deno.core.ops pre-snapshot (#13970)
To avoid OOB & other ExternalReference snapshot serialization issues

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2022-03-15 22:50:17 +01:00
Aaron O'Mullan
88d0f01948
feat(ops): custom arity (#13949)
Also cleanup & drop ignored wildcard op-args
2022-03-14 23:38:53 +01:00
Andreu Botella
c6bf07ec6d
fix(core): Don't override structured clone error messages from V8 (#13942)
In the implementation of structured serialization in
`Deno.core.serialize`, whenever there is a serialization error, an
exception will be thrown with the message "Failed to serialize
response", even though V8 provides a message to use in such cases.
This change instead throws an exception with the V8-provided message,
if there is one.
2022-03-14 19:35:15 +01:00
Divy Srivastava
b4e42953e1
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-14 18:44:15 +01:00
Yoshiya Hinosawa
b198bfd795
refactor(core): validate promise id in refOp (#13905) 2022-03-12 01:18:49 +09:00
Divy Srivastava
189e2f617e
chore: update rusty_v8 to 0.41.0 (#13909) 2022-03-11 19:59:01 +05:30
Yoshiya Hinosawa
3c11768aab
v1.19.3 2022-03-10 23:29:14 +09:00
Divy Srivastava
e166d7eed0
feat(core): Event loop middlewares for Extensions (#13816) 2022-03-08 20:10:34 +05:30
Aaron O'Mullan
303d691a16
perf(core): micro-optimize OpsTracker (#13868) 2022-03-08 09:28:20 +01:00
Satya Rohith
70690f54af
chore: update deps (#13821) 2022-03-05 03:38:04 +05:30