Commit graph

6514 commits

Author SHA1 Message Date
Ben Noordhuis 2b6f8d0187
fix(ext/http): include port number in h2 urls (#12181) 2021-09-26 20:26:16 +02:00
Aaron O'Mullan 6c007aa5ab
perf(fetch/headers): optimize appendHeader (#12234)
Use a single regex to check for `\0`, `\n`, `\r` instead of 3 `String.includes(...)` calls
2021-09-26 20:19:02 +02:00
Luis Malheiro b095157c1d
perf(ext/fetch): Use the WebIDL conversion to DOMString rather than USVString for Response constructor (#12201) 2021-09-25 15:30:31 +02:00
Dan Rose 09f2cdbc72
fix(ext/web): FileReader error messages (#12218) 2021-09-25 15:28:17 +02:00
Andreu Botella 1380defb80
chore: update wpt (#12206) 2021-09-25 15:27:34 +02:00
Aaron O'Mullan 3c88dffd32
fix(http): panic when responding to a closed conn (#12216)
Our oneshot receiver in `HyperService::call` would unwrap and panic, the `.await` on the oneshot receiver happens when the sender is dropped.

The sender is dropped in `op_http_response` because:
1. We take `ResponseSenderResource`
2. Then get `ConnResource` and early exit on failure (conn already closed)
3. The taken sender then gets dropped in this early exit before any response is sent over the channel

Fallbacking to returning a dummy response to hyper seems to be a fine quickfix
2021-09-25 13:22:19 +02:00
Ben Noordhuis 16ea39ee48
fix(ext/http): fortify "is websocket?" check (#12179)
Check for expected headers more rigorously and check that it's a
HTTP/1.1 GET request. The logic mirrors what Deno Deploy and the
tungstenite crate do.

The presence of "Sec-Websocket-Version: 13" is now also enforced.
I don't expect that to break anything: conforming clients already
send it and tungstenite can't talk to older clients anyway.

The new code is more efficient due to heap-allocating less and aligns
more closely with the checks in ext/http/01_http.js now.
2021-09-25 10:02:26 +02:00
Andreu Botella 1a6249c971
chore(workers): Test that closing a worker closes any child workers (#12215)
Before #12156, closing a worker which had children would cause a panic
(https://github.com/denoland/deno/issues/11342#issuecomment-918327693).

After that PR, closing a worker will also close any child workers.
2021-09-24 19:26:57 -07: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
Ryan Dahl 9705efd419
refactor: Remove op_state parameter (#12202) 2021-09-24 11:11:16 -04:00
Ryan Dahl 01da1d0adc
refactor: Rename ProgramState to ProcState (#12204)
Move Arc into struct
2021-09-24 11:10:42 -04:00
Leo K 703ca905fd
docs: fix native http jsdoc examples (#12207) 2021-09-24 19:14:12 +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
Ryan Dahl da25bbff88
refactor: clean up watcher tests (#12200) 2021-09-23 15:12:22 -04:00
Satya Rohith c5442abc23
feat(cli/fmt): support more markdown extensions (#12195) 2021-09-23 21:49:25 +05:30
Aaron O'Mullan e0c858fa27
perf(ext/fetch): skip USVString webidl conv on string constructor (#12168)
* perf(ext/fetch): skip USVString webidl conv on string constructor
* Rename webidl convert to RequestInfo_DOMString

To disambiguate and hint that it normalizes to DOMString instead of USVString since DOMString => USVString is handled by `op_url_parse` when calling `new URL(...)`
2021-09-23 11:40:58 +02:00
Casper Beyer 830586d242
test(cli): align unit test permissions with runtime test permissions (#12189) 2021-09-23 01:50:50 +02:00
Kitson Kelly 87e78802b0
docs(tools): updates to cutting a release (#12177) 2021-09-23 09:12:56 +10: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
Aaron O'Mullan 845a27e748
ci: enable cache for fastci (#12186) 2021-09-22 23:37:18 +02:00
Ryan Dahl 18fff69946
refactor: simplify FetchFuture (#12185)
No need for static lifetime
2021-09-22 15:35:07 -04:00
Aaron O'Mullan 6decc4dd38
quickfix(ci): only run "Build product size info" on main/tag (#12184) 2021-09-22 21:01:32 +02:00
Ryan Dahl 958b374f09
upgrade serde_v8 and rusty_v8 (#12175)
* upgrade serde_v8 and rusty_v8

* rusty_v8 0.30.0

* cycle keys
2021-09-22 18:51:11 +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
Aaron O'Mullan eddae41482
ci: experiment mac & windows debug builds (#11884)
Will be tweaked, but possibly have this "fastci" profile for further optimizations
2021-09-22 17:15:04 +02:00
Casper Beyer 20692f3e84
chore: replace calls to assertThrowsAsync with assertRejects (#12176) 2021-09-22 09:21:11 -04:00
Ben Noordhuis 82cfb46bd1
chore(ext/net): improve embedder friendliness (#12178)
Default to None if UnsafelyIgnoreCertificateErrors is not present in the
OpState.

Embedders may not have a need for restricting outgoing TLS connections
and having them hunt through the source code for the magic incantation
that makes the borrow panics go away, is less user friendly.
2021-09-22 11:12:08 +02:00
Kitson Kelly f27902e749
1.14.1 2021-09-22 08:44:46 +10:00
Kitson Kelly 2a56cd545c
chore: bump crate versions for 1.14.1 (#12172) 2021-09-22 06:53:47 +10:00
Aaron O'Mullan 22a6f4166e
cleanup(ext/fetch): drop redundant webidl converters in fetch() (#12167)
Since those inputs are passed to `new Request(...)` which applies webidl converters
2021-09-21 18:51:56 +02:00
Aaron O'Mullan 0aa6fefce7
perf(ext/web): optimize EventTarget (#12166)
and all its subclasses including `AbortSignal` ...

Instead of storing associated data in a global `WeakMap` we store them as private attributes (via a Symbol) on the object instances
2021-09-21 17:51:44 +02:00
Aaron O'Mullan f827b93df4
perf(web): optimize AbortController (#12165)
- Use regular class constructor and symbol "private" attributes
- Lazy init Set of follower signals
2021-09-21 17:38:57 +02:00
MikaelUrankar 8375f5464b
fix(runtime/ops/signal.rs): Add FreeBSD signal definitions (#12084) 2021-09-21 09:16:05 -04:00
Aaron O'Mullan ac8b6689b2
bench(deno_common): track new Request() (#12164)
Indirectly tests for:
- url parsing
- abort signal no-ops
- webidl & other overhead
2021-09-21 12:34:27 +02:00
Satya Rohith 923c5432e0
chore: bump deno_net (#12157) 2021-09-21 09:20:21 +05:30
David Sherret 0f23d92601
chore(tests): windows pty tests (#12091) 2021-09-20 22:15:44 -04:00
Elias Sjögreen 60b68e63f1
test(ext/ffi): add tests for different parameter and return types (#12158) 2021-09-20 15:42:54 -07:00
Eyal Shalev 7c9c9e5c83
fix(config-schema): correct default value of "lib" (#12145)
Changed it from `"deno.window"` to `["deno.window"]`
2021-09-20 11:30:00 -04:00
Satya Rohith 3708cbc600
refactor(ext/net): make op_connect & op_connect_tls public (#12150) 2021-09-20 19:35:23 +05:30
Casper Beyer 269bf380e0
fix(cli): move Deno.flock and Deno.funlock to unstable types (#12138) 2021-09-19 14:46:54 +02:00
Casper Beyer e1144fd635
refactor(cli): don't generate a module for side loading tests (#12129) 2021-09-18 16:12:50 +02:00
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
David Sherret 7c0173df27
chore(tests): maybe fix flaky flock tests (#12122) 2021-09-17 14:17:01 -04:00
David Sherret 4c8ab33def
chore(tests): fix flaky fetchPostBodyTypedArray (#12104) 2021-09-17 09:02:44 -04:00
David Sherret c8b43a0328
chore(tests): fix flaky flock tests (#12099) 2021-09-17 09:02:23 -04:00