Skip to content

Commit

Permalink
Merge branch 'main' into wpt-encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
F3n67u authored Jun 24, 2022
2 parents 00e23ac + 3507b3f commit 94f07da
Show file tree
Hide file tree
Showing 174 changed files with 7,343 additions and 455 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- '!.github/workflows/build-tarball.yml'
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/coverage-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
- .github/**
- '!.github/workflows/coverage-linux.yml'
push:
branches: [master, main]
branches:
- main
paths-ignore:
- '**.md'
- benchmark/**
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/coverage-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ on:
- .github/**
- '!.github/workflows/coverage-windows.yml'
push:
branches: [master, main]
branches:
- main
paths-ignore:
- '**.md'
- benchmark/**
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- master
- main
- v[0-9]+.x-staging
- v[0-9]+.x
Expand Down Expand Up @@ -50,7 +49,7 @@ jobs:
- name: Lint C/C++ files
run: make lint-cpp
format-cpp:
if: ${{ github.event.pull_request.draft == false && github.base_ref == 'master' }}
if: ${{ github.event.pull_request && github.event.pull_request.draft == false && github.base_ref == github.event.repository.default_branch }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/notify-force-push.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
on:
push:
branches:
- master
- main

name: Notify on Force Push
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- '!.github/workflows/test-asan.yml'
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-internet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
paths: [test/internet/**]
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- '!.github/workflows/test-macos.yml'
push:
branches:
- master
- main
- canary
- v[0-9]+.x-staging
Expand Down
4 changes: 2 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ to run it again before invoking `make -j4`.

* [Python 3.10](https://www.microsoft.com/en-us/p/python-310/9pjpw5ldxlz5)
* The "Desktop development with C++" workload from
[Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) or
[Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products) or
the "C++ build tools" workload from the
[Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019),
[Build Tools](https://aka.ms/vs/16/release/vs_buildtools.exe),
with the default optional components
* Basic Unix tools required for some tests,
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ For information about the governance of the Node.js project, see
**Matteo Collina** <<matteo.collina@gmail.com>> (he/him)
* [mhdawson](https://github.com/mhdawson) -
**Michael Dawson** <<midawson@redhat.com>> (he/him)
* [MylesBorins](https://github.com/MylesBorins) -
**Myles Borins** <<myles.borins@gmail.com>> (he/him)
* [RaisinTen](https://github.com/RaisinTen) -
**Darshan Sen** <<raisinten@gmail.com>> (he/him)
* [richardlau](https://github.com/richardlau) -
Expand Down Expand Up @@ -229,6 +227,8 @@ For information about the governance of the Node.js project, see
**Mary Marchini** <<oss@mmarchini.me>> (she/her)
* [mscdex](https://github.com/mscdex) -
**Brian White** <<mscdex@mscdex.net>>
* [MylesBorins](https://github.com/MylesBorins) -
**Myles Borins** <<myles.borins@gmail.com>> (he/him)
* [nebrius](https://github.com/nebrius) -
**Bryan Hughes** <<bryan@nebri.us>>
* [ofrobots](https://github.com/ofrobots) -
Expand Down
13 changes: 11 additions & 2 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -5443,8 +5443,11 @@ changes:
* `b` {ArrayBuffer|Buffer|TypedArray|DataView}
* Returns: {boolean}

This function is based on a constant-time algorithm.
Returns true if `a` is equal to `b`, without leaking timing information that
This function compares the underlying bytes that represent the given
`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time
algorithm.

This function does not leak timing information that
would allow an attacker to guess one of the values. This is suitable for
comparing HMAC digests or secret values like authentication cookies or
[capability urls](https://www.w3.org/TR/capability-urls/).
Expand All @@ -5457,6 +5460,12 @@ If at least one of `a` and `b` is a `TypedArray` with more than one byte per
entry, such as `Uint16Array`, the result will be computed using the platform
byte order.

<strong class="critical">When both of the inputs are `Float32Array`s or
`Float64Array`s, this function might return unexpected results due to IEEE 754
encoding of floating-point numbers. In particular, neither `x === y` nor
`Object.is(x, y)` implies that the byte representations of two floating-point
numbers `x` and `y` are equal.</strong>

Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code
is timing-safe. Care should be taken to ensure that the surrounding code does
not introduce timing vulnerabilities.
Expand Down
31 changes: 9 additions & 22 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ added:
- v13.9.0
- v12.16.2
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/43363
description: Convert from asynchronous to synchronous.
- version:
- v16.2.0
- v14.18.0
Expand All @@ -342,19 +339,15 @@ command flag enabled.
* `specifier` {string} The module specifier to resolve relative to `parent`.
* `parent` {string|URL} The absolute parent module URL to resolve from. If none
is specified, the value of `import.meta.url` is used as the default.
* Returns: {string}
* Returns: {Promise}
Provides a module-relative resolution function scoped to each module, returning
the URL string. In alignment with browser behavior, this now returns
synchronously.
> **Caveat** This can result in synchronous file-system operations, which
> can impact performance similarly to `require.resolve`.
the URL string.
<!-- eslint-skip -->
```js
const dependencyAsset = import.meta.resolve('component-lib/asset.css');
const dependencyAsset = await import.meta.resolve('component-lib/asset.css');
```
`import.meta.resolve` also accepts a second argument which is the parent module
Expand All @@ -363,11 +356,11 @@ from which to resolve from:
<!-- eslint-skip -->
```js
import.meta.resolve('./dep', import.meta.url);
await import.meta.resolve('./dep', import.meta.url);
```
This function is synchronous because the ES module resolver in Node.js is
synchronous.
This function is asynchronous because the ES module resolver in Node.js is
allowed to be asynchronous.
## Interoperability with CommonJS
Expand Down Expand Up @@ -738,9 +731,6 @@ prevent unintentional breaks in the chain.
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/43363
description: Convert hook from asynchronous to synchronous.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/42623
description: Add support for chaining resolve hooks. Each hook must either
Expand Down Expand Up @@ -774,9 +764,6 @@ changes:
terminate the chain of `resolve` hooks. **Default:** `false`
* `url` {string} The absolute URL to which this input resolves
> **Caveat** A resolve hook can contain synchronous file-system operations
> (as `defaultResolveHook()` does), which can impact performance.
The `resolve` hook chain is responsible for resolving file URL for a given
module specifier and parent URL, and optionally its format (such as `'module'`)
as a hint to the `load` hook. If a format is specified, the `load` hook is
Expand All @@ -803,7 +790,7 @@ Node.js module specifier resolution behavior_ when calling `defaultResolve`, the
`context.conditions` array originally passed into the `resolve` hook.
```js
export function resolve(specifier, context, nextResolve) {
export async function resolve(specifier, context, nextResolve) {
const { parentURL = null } = context;

if (Math.random() > 0.5) { // Some condition.
Expand Down Expand Up @@ -1102,7 +1089,7 @@ const baseURL = pathToFileURL(`${cwd()}/`).href;
// CoffeeScript files end in .coffee, .litcoffee, or .coffee.md.
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
export function resolve(specifier, context, nextResolve) {
export async function resolve(specifier, context, nextResolve) {
if (extensionsRegex.test(specifier)) {
const { parentURL = baseURL } = context;
Expand Down Expand Up @@ -1562,7 +1549,7 @@ success!
[Conditional exports]: packages.md#conditional-exports
[Core modules]: modules.md#core-modules
[Determining module system]: packages.md#determining-module-system
[Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
[Dynamic `import()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
[ES Module Integration Proposal for WebAssembly]: https://github.com/webassembly/esm-integration
[HTTPS and HTTP imports]: #https-and-http-imports
[Import Assertions]: #import-assertions
Expand Down
4 changes: 2 additions & 2 deletions doc/api/webcrypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async function generateAndWrapHmacKey(format = 'jwk', hash = 'SHA-512') {

const wrappedKey = await subtle.wrapKey(format, key, wrappingKey, 'AES-KW');

return wrappedKey;
return { wrappedKey, wrappingKey };
}

async function unwrapHmacKey(
Expand All @@ -238,7 +238,7 @@ async function unwrapHmacKey(
const key = await subtle.unwrapKey(
format,
wrappedKey,
unwrappingKey,
wrappingKey,
'AES-KW',
{ name: 'HMAC', hash },
true,
Expand Down
1 change: 1 addition & 0 deletions doc/contributing/security-release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The current security stewards are documented in the main Node.js
| RH and IBM | Joe | 2022-Mar-18 |
| NearForm | Matteo / Rafael | |
| Datadog | Vladimir | |
| NodeSource | Juan | |
| RH and IBM | Michael | |

## Planning
Expand Down
7 changes: 3 additions & 4 deletions lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,16 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
return parser.onIncoming(incoming, shouldKeepAlive);
}

function parserOnBody(b, start, len) {
function parserOnBody(b) {
const stream = this.incoming;

// If the stream has already been removed, then drop it.
if (stream === null)
return;

// Pretend this was the result of a stream._read call.
if (len > 0 && !stream._dumped) {
const slice = b.slice(start, start + len);
const ret = stream.push(slice);
if (!stream._dumped) {
const ret = stream.push(b);
if (!ret)
readStop(this.socket);
}
Expand Down
2 changes: 0 additions & 2 deletions lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ ObjectDefineProperties(module.exports, {
get() {
if (promises === null) {
promises = require('internal/dns/promises');
promises.setServers = defaultResolverSetServers;
promises.setDefaultResultOrder = setDefaultResultOrder;
}
return promises;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/dns/promises.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const dnsPromises = require('internal/dns/promises');
dnsPromises.setServers = require('dns').setServers;
module.exports = dnsPromises;
module.exports = require('internal/dns/promises');
11 changes: 11 additions & 0 deletions lib/internal/dns/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const {
emitInvalidHostnameWarning,
getDefaultVerbatim,
errorCodes: dnsErrorCodes,
setDefaultResultOrder,
setDefaultResolver,
} = require('internal/dns/utils');
const {
NODATA,
Expand Down Expand Up @@ -349,11 +351,20 @@ Resolver.prototype.resolve = function resolve(hostname, rrtype) {
return ReflectApply(resolver, this, [hostname]);
};

function defaultResolverSetServers(servers) {
const resolver = new Resolver();

resolver.setServers(servers);
setDefaultResolver(resolver);
bindDefaultResolver(module.exports, Resolver.prototype);
}

module.exports = {
lookup,
lookupService,
Resolver,
setDefaultResultOrder,
setServers: defaultResolverSetServers,

// ERROR CODES
NODATA,
Expand Down
26 changes: 12 additions & 14 deletions lib/internal/modules/esm/initialize_import_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
const { getOptionValue } = require('internal/options');
const experimentalImportMetaResolve =
getOptionValue('--experimental-import-meta-resolve');
const {
PromisePrototypeThen,
PromiseReject,
} = primordials;
const asyncESM = require('internal/process/esm_loader');

function createImportMetaResolve(defaultParentUrl) {
return function resolve(specifier, parentUrl = defaultParentUrl) {
let url;

try {
({ url } = asyncESM.esmLoader.resolve(specifier, parentUrl));
} catch (error) {
if (error.code === 'ERR_UNSUPPORTED_DIR_IMPORT') {
({ url } = error);
} else {
throw error;
}
}

return url;
return async function resolve(specifier, parentUrl = defaultParentUrl) {
return PromisePrototypeThen(
asyncESM.esmLoader.resolve(specifier, parentUrl),
({ url }) => url,
(error) => (
error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ?
error.url : PromiseReject(error))
);
};
}

Expand Down
Loading

0 comments on commit 94f07da

Please sign in to comment.