1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
Commit graph

8500 commits

Author SHA1 Message Date
Andreu Botella
827dfb2139
refactor(core): Move optional callbacks from JsRuntimeState to ContextState (#17422)
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.

This is a reland of #15599.

Towards #13239.
2023-01-16 21:35:00 +01:00
Bartek Iwańczuk
e4ca366c88
fix(napi): functions related to errors (#17370)
This commits fixes various NAPI functions related to creation and
throwing of errors.
2023-01-16 21:34:39 +01:00
Kamil Ogórek
5208a4a36a
fix(ext/flash): Fix typo in 'chunked' flash ops (#17302)
Just a `s/chuncked/chunked/g`.
2023-01-16 21:34:39 +01:00
David Sherret
dde5d9c802
fix(npm): handle an npm package that has itself as a dependency (#17425)
I'm not sure this properly handles scenarios where an npm package uses
an alias that resolves to itself, we can fix that if we find a package
that actually depends on that behavior.

Closes #17420
2023-01-16 21:34:39 +01:00
David Sherret
d5627da552
refactor: create enum for --builtin doc flag (#17423) 2023-01-16 21:34:39 +01:00
David Sherret
1d28ed6e5b
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-16 21:34:39 +01:00
Kamil Ogórek
4cc9e2e325
fix(ext/flash): Correctly handle errors for chunked responses (#17303)
The leading cause of the problem was that `handleResponse` has
`tryRespondChunked` passed as an argument, which in turn is implemented
as a call to `core.ops.op_try_flash_respond_chuncked`, that throws in
the repro code.

`handleResponse` was not handled correctly, as it not returned any
value, and had no `catch` attached to it.
It also effectively was never correctly handled inside two other blocks
with `resp.then` and `PromisePrototypeCatch(PromisePrototypeThen(resp,
"..."))` as well, as it just short-circuited the promise with an empty
resolve, instead of relying on the last `(async () => {})` block.

This change makes `handleResponse` return a correct value and attach
`onError` handler to the "non-thenable" variant of response handling
code.
2023-01-16 21:34:15 +01:00
Divy Srivastava
deeeaa8b3a
fix(runtime/fs): preserve permissions in copyFileSync for macOS (#17412)
Fixes https://github.com/denoland/deno/issues/16921
2023-01-16 21:34:15 +01:00
Andreu Botella
4bd29601f0
feat(core): Reland support for async ops in realms (#17204)
Currently realms are supported on `deno_core`, but there was no support
for async ops anywhere other than the main realm. The main issue is 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 takes the `ContextState` struct added in #17050, and adds to
it a `js_recv_cb` callback for each realm. Combined with the fact that
that same PR also added a list of known realms to `JsRuntimeState`, and
that #17174 made `OpCtx` instances realm-specific and had them include
an index into that list of known realms, this makes it possible to know
the current realm in the `queue_async_op` and `queue_fast_async_op`
methods, and therefore to send the results of promises for each realm to
that 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.

This PR is a reland of #14734 after it was reverted in #16366, except
that `ContextState` and `JsRuntimeState::known_realms` were previously
relanded in #17050. Another significant difference with the original PR
is passing around an index into `JsRuntimeState::known_realms` instead
of a `v8::Global<v8::Context>` to identify the realm, because async op
queuing in fast calls cannot call into V8, and therefore cannot have
access to V8 globals. This also simplified the implementation of
`resolve_async_ops`.

Co-authored-by: Luis Malheiro <luismalheiro@gmail.com>
2023-01-16 21:34:15 +01:00
Divy Srivastava
f7bb6a0be0
chore(napi): Remove unstable libuv methods (#17416)
This commit removes the libuv pollyfills introduced with Node-API
support.

It is too much Node-specific. Most Node-API modules that depend on libuv
are already giving up the benefits of Node-API. We should rather
encourage modules to use `ThreadSafeFunction` or `AsyncWork` to
interface with the event loop.

Relevant discussion a few months ago:
https://github.com/denoland/deno/pull/13633#discussion_r904916178

cc @bartlomieju
2023-01-16 21:33:12 +01:00
Bartek Iwańczuk
df245ab9ff
fix(napi): correct arguments for napi_get_typedarray_info (#17306) 2023-01-16 21:33:12 +01:00
Bartek Iwańczuk
413a959b45
chore: upgrade rusty_v8 to 0.60.1 (#17407)
Required for https://github.com/denoland/deno/pull/17306
2023-01-16 21:33:12 +01:00
Kiryl Dziamura
c7bff76c41
fix(npm): use original node regex in npm resolution (#17404)
Fixes regex for matching conditional exports in a package.
Updated to the same regex Node.js uses.
2023-01-16 21:33:12 +01:00
Max Coplan
8e0c2f34fa
refactor(bench/http): Use optional chaining instead of || fallthrough (#17317) 2023-01-16 21:33:12 +01:00
Geert-Jan Zwiers
3888162cfa
refactor(coverage): use FileFlags struct (#17388) 2023-01-16 21:33:11 +01:00
Geert-Jan Zwiers
3c53c4b049
refactor(cli/tools): reduce cloning (#17309) 2023-01-16 21:32:01 +01:00
Bartek Iwańczuk
d464df3a25
fix(napi): allow cleanup hook to remove itself (#17402)
This commit fixes "cleanup hooks" in NAPI integration in two ways:
- don't hold to RefCell's borrow while iterating over hooks
- allow a hook to remove itself when being called
2023-01-16 21:32:01 +01:00
Lino Le Van
1b207796aa
fix(napi): update node version to lts (#17399) 2023-01-16 21:32:01 +01:00
David Sherret
69a84a6a2b
chore(ci): use windows-2022 runner on skipped release job on PRs (#17398) 2023-01-16 21:32:01 +01:00
David Sherret
0eb68246da
chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-16 21:32:01 +01:00
denobot
9806dcc914
1.29.3 (#17395)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-01-13 12:17:13 -05:00
Bartek Iwańczuk
0e5c7404f2 fix(permissions): lock stdio streams when prompt is shown (#17392)
This commit changes permission prompt to lock stdio streams when prompt
is shown.
2023-01-13 11:20:20 -05:00
Bartek Iwańczuk
9c4327f9d1 tests: Disable flaky flash_shutdown test (#17390) 2023-01-13 11:20:20 -05:00
Bartek Iwańczuk
7ed2c13827 fix(napi): date and unwrap handling (#17369) 2023-01-13 11:20:20 -05:00
Yiyu Lin
3f270c1760 chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 11:20:20 -05:00
David Sherret
369f1d6e01 chore(ci): try to make sysroot step more reliable (#17383)
Main is failing a lot because of:

```
Err:8 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 debootstrap all 1.0.118ubuntu1.8
  Connection failed [IP: 40.81.13.82 80]
Fetched 44.1 MB in 60s (734 kB/s)
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.118ubuntu1.8_all.deb  Connection failed [IP: 40.81.13.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
```
2023-01-13 11:20:19 -05:00
Bartek Iwańczuk
78364f3816 tests: move integration tests to a single module (#17380)
Effectively reverts changes done in
https://github.com/denoland/deno/pull/16816
2023-01-13 11:20:19 -05:00
Leo Kettmeir
257471f586 fix: make self and window getters only & make getterOnly ignore setting (#17362) 2023-01-13 11:20:19 -05:00
David Sherret
0003cf756e chore(ci): only run doc tests on linux (#17379)
Doc tests were observed to take over 100s on the Mac CI in one instance.
2023-01-13 11:20:18 -05:00
Leo Kettmeir
95d4fb624f fix(webidl): properly implement setlike (#17363) 2023-01-13 11:20:18 -05:00
David Sherret
c4be3a0ce7 chore(ci): try some wpt parallelism (#17375) 2023-01-13 11:20:18 -05:00
David Sherret
918a19d8f2 chore(ci): skip running the benchmarks on a PR except when a label is added (#17377) 2023-01-13 11:20:18 -05:00
David Sherret
09c183f4a0 chore(ci): fix canary publish on main (#17374)
Ref #17358
2023-01-13 11:20:18 -05:00
David Sherret
23dea8e89a chore(ci): use mtime cache for fastci (#17373) 2023-01-13 11:20:18 -05:00
David Sherret
fd74c16bdd chore(ci): do not clone submodule ./test_util/wpt unnecessarily (#17372) 2023-01-13 11:20:17 -05:00
David Sherret
3d95d1c723 chore(ci): only install node for the benchmarks (#17371) 2023-01-13 11:20:17 -05:00
Bartek Iwańczuk
9e5949fa52 ci: update Windows runner, update Google Cloud integration, update Node (#17358)
This commit rolls up following PRs into a single one:
- https://github.com/denoland/deno/pull/16672
- https://github.com/denoland/deno/pull/16674
- https://github.com/denoland/deno/pull/16972

Generation script was updated to take into account these changes.

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Geert-Jan Zwiers <geertjanzwiers@protonmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-13 11:20:17 -05:00
Bartek Iwańczuk
92a4ecd938 Revert "test: fix flaky deno_land_unsafe_ssl test (#17357)" (#17368)
This reverts commit ee2c6cb04a.

Closes https://github.com/denoland/deno/issues/17359
2023-01-13 11:20:17 -05:00
Divy Srivastava
5a01dbf43f fix(napi): Implement napi_threadsafe_function ref and unref (#17304)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-13 11:20:17 -05:00
Leo Kettmeir
b851b3ab74 fix: check if BroadcastChannel is open before sending (#17366)
Fixes #16978
2023-01-13 11:20:17 -05:00
Leo Kettmeir
658fac6e86 fix: don't unwrap in test pipe handling logic (#17341)
Fixes #14746
2023-01-13 11:20:16 -05:00
David Sherret
779a108a8f chore(ci): skip non-ubuntu test release jobs on PRs (#17353) 2023-01-13 11:20:16 -05:00
Bartek Iwańczuk
8a040952cb test: fix flaky deno_land_unsafe_ssl test (#17357) 2023-01-13 11:20:16 -05:00
Asher Gomez
95e098c82b fix(ci): use Node 18 (#17355) 2023-01-13 11:20:16 -05:00
David Sherret
35eaf1b7b7 chore(ci): save cache on main at end of workflow (#17354)
Seems like our caching was totally broken. We need to save the cache
after building and not before.

```
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
Warning: Cache save failed.
```
2023-01-13 11:20:16 -05:00
Leo Kettmeir
32e9299e32 fix: don't panic on resolveDns if unsupported record type is specified (#17336)
Fixes #14373
2023-01-13 11:20:15 -05:00
David Sherret
f74c44efd6 chore(ci): do not run CI on draft PRs unless explicitly run via commit message (#17350)
This will help us reduce CI time during development. The CI can be
explicitly run on draft PRs by adding `[ci]` to the commit message.
2023-01-13 11:20:15 -05:00
David Sherret
f2126d3d25 fix(fmt): better handling of link reference definitions when formatting markdown (#17352)
Two fixes:

- https://github.com/dprint/dprint-plugin-markdown/pull/75
- https://github.com/dprint/dprint-plugin-markdown/pull/73
2023-01-13 11:20:15 -05:00
Bartek Iwańczuk
d5a758c0e1 refactor(napi): Cleanup tests (#17347) 2023-01-13 11:20:15 -05:00
David Sherret
e49f0bee57 chore(ci): checkout less submodules based on job (#17343)
Co-authored-by: Luca Casonato <lucacasonato@users.noreply.github.com>
2023-01-13 11:20:15 -05:00