Commit graph

6514 commits

Author SHA1 Message Date
Andreu Botella 1563088f06
fix: a Request whose URL is a revoked blob URL should still fetch (#11947)
In the spec, a URL record has an associated "blob URL entry", which for
`blob:` URLs is populated during parsing to contain a reference to the
`Blob` object that backs that object URL. It is this blob URL entry that
the `fetch` API uses to resolve an object URL.

Therefore, since the `Request` constructor parses URL inputs, it will
have an associated blob URL entry which will be used when fetching, even
if the object URL has been revoked since the construction of the
`Request` object. (The `Request` constructor takes the URL as a string
and parses it, so the object URL must be live at the time it is called.)

This PR adds a new `blobFromObjectUrl` JS function (backed by a new
`op_blob_from_object_url` op) that, if the URL is a valid object URL,
returns a new `Blob` object whose parts are references to the same Rust
`BlobPart`s used by the original `Blob` object. It uses this function to
add a new `blobUrlEntry` field to inner requests, which will be `null`
or such a `Blob`, and then uses `Blob.prototype.stream()` as the
response's body. As a result of this, the `blob:` URL resolution from
`op_fetch` is now useless, and has been removed.
2021-09-08 11:29:21 +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
Bartek Iwańczuk 2de5587547
fix(ext/http): resource leak if request body is not consumed (#11955) 2021-09-08 10:12:23 +02:00
Bartek Iwańczuk c04117134e
refactor(lint): reuse lint rules (#11934)
This commit updated "deno_lint" crate to 0.15.1 and refactors
"cli/tools/lint.rs" to create only a single vector of lint rules,
instead of creating a vector for each linted file.
2021-09-08 07:08:33 +02:00
BasiqueEvangelist 08e12380a0
feat(cli): Support Basic authentication in DENO_AUTH_TOKENS (#11910) 2021-09-08 06:18:11 +02:00
Kitson Kelly bf6dbf9855
fix(cli): better handling of source maps (#11954)
Ref: #11874
2021-09-08 14:05:34 +10:00
David Sherret 4833103011
fix: exit process on panic in a tokio task (#11942) 2021-09-07 19:34:27 -04:00
David Sherret e3a484ae44
fix: remove windows-only panic when calling Deno.kill (#11948) 2021-09-07 18:45:13 -04:00
Luca Casonato 066f75ac07
chore: update wpt (#11950) 2021-09-07 23:50:22 +02: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
Yoshiya Hinosawa 3925435bf9
docs(ext/net): add note about listening 0.0.0.0 (#11938)
Co-authored-by: Craig Morten <cmorten@users.noreply.github.com>
2021-09-07 16:26:21 +09:00
Nayeem Rahman d331c4b283
fix(ext/web): Format terminal DOMExceptions properly (#11834) 2021-09-06 22:59:20 +02:00
David Sherret 2c77681770
chore: upgrade third_party for dprint 0.17 (#11930) 2021-09-06 12:44:07 -04: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
Craig Morten 930cb0afd8
chore(std/http): server module name migration (#11890) 2021-09-05 22:43:46 +02:00
Casper Beyer 01bfb7d913
refactor(testing): use discrete report functions (#11917) 2021-09-05 22:42:35 +02:00
Feng Yu bb99d5da4c
fix(doc): fix rustdoc bare_urls warning (#11921) 2021-09-05 16:22:45 +02:00
Casper Beyer f9d29115a0
feat(cli): close test worker once all tests complete (#11727) 2021-09-04 20:19:26 +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
Bartek Iwańczuk 44ca3ce6ae
refactor: factor out DenoSubcommand enum variant into structs (#11896)
This commit refactors "DenoSubcommand" enum in a way that variants
no longer contain anonymous structures but instead contain
dedicated structures for each subcommand, eg. "DenoSubcommand::Lint"
now contains "LintSubcommand".
2021-09-04 01:33:35 +02:00
Bartek Iwańczuk d93570a619
feat(lint): add support for config file and CLI flags for rules (#11776)
This commit adds support for following flags in deno lint subcommand:

--config - allows to load configuration file and parses "lint" object
--rules-tags=<tags> - allows specifying which set of tagged rules should be run
--rules-include=<rules> - allow specifying which rules should be run
--rules-exclude=<rules> - allow specifying which rules should not be run
2021-09-03 17:01:58 +02:00
David Sherret c3001fe280
chore(test): improve flaky lsp_diagnostics_refresh_dependents test to give more info (#11905) 2021-09-02 20:31:59 -04: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
Bartek Iwańczuk c84532b6d5
chore: upgrade crates (#11894)
Co-authored-by: David Sherret <dsherret@gmail.com>
2021-09-02 17:38:19 +02:00
Casper Beyer 77ead8af20
fix(cli): retain path based test mode inference (#11878) 2021-09-01 18:31:56 +09: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
Aaron O'Mullan b518f5e1ba
feat(core): facilitate op-disabling middleware (#11858)
* feat(core): facilitate op-disabling middleware

By providing `void_op_sync()` and `void_op_async() as well as `core/examples/disable_ops.rs`
2021-08-31 13:08:16 +02:00
Luca Casonato cee5be4539
feat(ext/crypto): AES key generation (#11869)
Support AES-CTR, AES-CBC, AES-GCM, and AES-KW in
SubtleCrypto#generateKey.
2021-08-31 11:25:44 +02:00
Luca Casonato fcd0992dba
fix: move unstable declarations to deno.unstable (#11876) 2021-08-31 11:25:15 +02:00
David Sherret ca75752e5a
chore: release scripts should update Cargo.lock file when bumping versions (#11879) 2021-08-30 13:35:48 -04:00
Luca Casonato 0aa6b1e79f
chore: update to rusty_v8 0.27.0 (#11877)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-08-30 18:40:00 +02:00
Geoffrey Smith 40526a03dc
cleanup(.github/workflows): Typo in comments (#11868) 2021-08-29 23:39:27 +02:00
Divy Srivastava 5ee2110179
feat(ext/crypto): support JWK export for HMAC (#11864) 2021-08-29 14:23:51 +02:00
Aaron O'Mullan 8a097410a8
bench(deno_common): track readFile 128kb (#11862) 2021-08-29 01:05:32 +02:00
Divy Srivastava 1f57cd2c0f
feat(ext/crypto): support JWK import for HMAC (#11716) 2021-08-27 13:19:41 +02:00
Luca Casonato ad037b3b1a
chore: update wpt (#11845) 2021-08-27 12:37:22 +02:00
Kitson Kelly 935133f53a
feat(cli): Update to TypeScript 4.4 (#11678) 2021-08-27 10:12:59 +10:00
Casper Beyer b9a965c607
refactor(cli): introduce module specifier test modes (#11769)
This commit merges the two vectors of specifiers into a single one introducing
the concept of a "TestMode" which is a tri-state enum specifying how a specifier
is to be tested (as documentation, as an executable module or as both).

This is determined during the collection phase and determines how a specifier
will be executed based on how the specifier was collected (directly or not) and
if it has an eligible media_type when fetched.

For example "deno test README.md" is marked as documentation because, while it
is a direct inclusion it is not an executable media type therefore will only
have the fenced code blocks that can be parsed from it tested.
2021-08-26 21:21:58 +02:00
Sebastien Filion 192af1e7bc
docs: Add async iterator alternative for Deno.serveHttp (#11850) 2021-08-26 17:06:58 +02:00
Divy Srivastava 23a9bc099d
feat(ext/crypto): implement importKey and deriveBits for PBKDF2 (#11642) 2021-08-26 12:48:07 +02:00
David Sherret 5d7d9d6443
chore(tests): improve unit tests using deferred (#11842) 2021-08-25 16:04:14 -04:00
Percy 66476efec5
docs(README): Change the logo to vector image (#11841)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-08-25 15:27:18 +02:00
David Sherret dce70d32a4
chore: add scripts for helping with a release (#11832) 2021-08-25 09:02:22 -04: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