1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/tools
Marcos Casagrande 5311f69bbb
fix(ext/file): resolve unresolved Promise in Blob.stream (#20039)
This PR fixes some crashing WPT tests due to an unresolved promise.

---
This could be a [stream spec](https://streams.spec.whatwg.org) bug

When `controller.close` is called on a byob stream, there's no cleanup
of pending `readIntoRequests`. The only cleanup of pending
`readIntoRequests` happen when `.byobRequest.respond(0)` is called, it
happens
here:6ba245fe25/ext/web/06_streams.js (L2026)
which ends up calling `readIntoRequest.closeSteps(chunk);` in
6ba245fe25/ext/web/06_streams.js (L2070)



To reproduce:

```js
async function byobRead() {
  const input = [new Uint8Array([8, 241, 48, 123, 151])];
  const stream = new ReadableStream({
    type: "bytes",
    async pull(controller) {
      if(input.length === 0) {
        controller.close();
        // controller.byobRequest.respond(0); // uncomment for fix 
        return 
      }
      controller.enqueue(input.shift())
    },
  });

  const reader = stream.getReader({ mode: 'byob' });
  const r1 = await reader.read(new Uint8Array(64));
  console.log(r1);
  const r2 = await reader.read(new Uint8Array(64));
  console.log(r2);
}

await byobRead();
```

Running the script triggers:
```
error: Top-level await promise never resolved
```
2023-08-04 13:57:54 +02:00
..
napi feat: Adaptations to support OpenBSD port (#19153) 2023-06-12 13:14:27 +03:00
node_compat chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
release chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
wpt fix(ext/file): resolve unresolved Promise in Blob.stream (#20039) 2023-08-04 13:57:54 +02:00
build_bench.ts chore(core): build_bench tool (#19387) 2023-06-06 18:53:41 +00:00
build_benchmark_jsons.js chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
copyright_checker.js refactor(cli/tools): split bench into multiple modules (#19974) 2023-07-28 11:27:10 -04:00
core_import_map.json refactor: rename built-in node modules from ext:deno_node/ to node: (#19680) 2023-07-02 20:19:30 +02:00
cut_a_release.md chore: make the start_release workflow go faster (#15416) 2022-08-08 19:31:45 -04:00
deno.lock.json chore: upgrade rusty_v8 to 0.71.2 (#19116) 2023-05-13 21:11:40 +02:00
flamebench.js chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-13 13:42:15 -05:00
format.js chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-13 13:42:15 -05:00
lint.js chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
README.md BREAKING(unstable): remove WebGPU (#18094) 2023-03-17 00:29:32 +01:00
update_typescript.md fix: update to TypeScript 4.7.4 (#15022) 2022-07-04 15:13:50 +10:00
upload_wptfyi.js wpt: only tag daily runs as master (#18155) 2023-03-13 13:24:16 +01:00
util.js chore: update std submodule and its imports (#17408) 2023-01-15 21:09:26 +01:00
verify_pr_title.js chore(ci): allow 'Reland' PR title prefix (#18273) 2023-03-18 21:15:45 +00:00
wpt.ts fix(ext/websocket): Ensure that errors are available after async response returns (#19642) 2023-06-29 07:24:01 -06:00

Tools

Documentation for various tooling in support of Deno development.

format.js

This script will format the code (currently using dprint, rustfmt). It is a prerequisite to run this before code check in.

To run formatting:

deno run --allow-read --allow-write --allow-run --unstable ./tools/format.js

lint.js

This script will lint the code base (currently using dlint, clippy). It is a prerequisite to run this before code check in.

To run linting:

deno run --allow-read --allow-write --allow-run --unstable ./tools/lint.js

Tip: You can also use cargo to run the current or pending build of the deno executable

cargo run -- run --allow-read --allow-write --allow-run --unstable ./tools/<script>

flamebench.js

flamebench.js facilitates profiling and generating flamegraphs from benchmarks.

General usage:

 ./tools/flamebench.js
flamebench <bench_name> [bench_filter]

Available benches:
op_baseline
ser
de

To profile the op_baseline bench, run ./tools/flamebench.js op_baseline, this will run all 3 benches in `op_baseline.

Often when profiling/optimizing, you'll want to focus on a specific sub-bench, flamebench supports a bench/test filter arg like the regular cargo commands. So you can simply run ./tools/flamebench.js op_baseline bench_op_async or ./tools/flamebench.js op_baseline bench_op_nop to profile specific benches.

Tip: the [bench_filter] argument doesn't have to be an exact bench name, you can use a shorthand or a partial match to profile a group of benches, e.g: ./tools/flamebench.js de v8

copyright_checker.js is used to check copyright headers in the codebase.

To run the copyright checker:

deno run --allow-read --allow-run --unstable  ./tools/copyright_checker.js

Then it will check all code files in the repository and report any files that are not properly licensed.