Skip to content

Commit 2756614

Browse files
Merge pull request #1011 from nodejs/main
Create a new pull request by comparing changes across two branches
2 parents c332260 + 8e1e3a8 commit 2756614

File tree

8 files changed

+38
-8
lines changed

8 files changed

+38
-8
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,10 @@
181181
/lib/internal/navigator.js @nodejs/web-standards
182182
/test/fixtures/wpt/ @nodejs/web-standards
183183
/test/wpt/ @nodejs/web-standards
184+
185+
# TypeScript
186+
187+
/deps/amaro/ @nodejs/typescript
188+
/doc/api/typescript.md @nodejs/typescript
189+
/test/fixtures/typescript/ @nodejs/typescript
190+
/tools/dep_updaters/update-amaro.sh @nodejs/typescript

doc/api/worker_threads.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,8 @@ the last one will try to communicate with the main thread.
290290

291291
```mjs
292292
import { fileURLToPath } from 'node:url';
293-
import { once } from 'node:events';
294293
import process from 'node:process';
295294
import {
296-
isMainThread,
297295
postMessageToThread,
298296
threadId,
299297
workerData,
@@ -328,9 +326,7 @@ channel.onmessage = channel.close;
328326
```
329327
330328
```cjs
331-
const { once } = require('node:events');
332329
const {
333-
isMainThread,
334330
postMessageToThread,
335331
threadId,
336332
workerData,

lib/internal/child_process.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ class Control extends EventEmitter {
557557
unrefCounted() {
558558
if (--this.#refs === 0 && !this.#refExplicitlySet) {
559559
this.#channel.unref();
560-
this.emit('unref');
561560
}
562561
}
563562

lib/internal/modules/esm/resolve.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@ function defaultResolve(specifier, context = {}) {
10151015
}
10161016
}
10171017

1018-
// This must come after checkIfDisallowedImport
10191018
protocol ??= parsed?.protocol;
10201019
if (protocol === 'node:') { return { __proto__: null, url: specifier }; }
10211020

lib/internal/webstreams/util.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818

1919
const {
2020
codes: {
21+
ERR_ARG_NOT_ITERABLE,
2122
ERR_INVALID_ARG_VALUE,
2223
ERR_INVALID_STATE,
2324
ERR_OPERATION_FAILED,
@@ -235,6 +236,11 @@ function getIterator(obj, kind = 'sync', method) {
235236
method = obj[SymbolAsyncIterator];
236237
if (method === undefined) {
237238
const syncMethod = obj[SymbolIterator];
239+
240+
if (syncMethod === undefined) {
241+
throw new ERR_ARG_NOT_ITERABLE(obj);
242+
}
243+
238244
const syncIteratorRecord = getIterator(obj, 'sync', syncMethod);
239245
return createAsyncFromSyncIterator(syncIteratorRecord);
240246
}
@@ -243,6 +249,10 @@ function getIterator(obj, kind = 'sync', method) {
243249
}
244250
}
245251

252+
if (method === undefined) {
253+
throw new ERR_ARG_NOT_ITERABLE(obj);
254+
}
255+
246256
const iterator = FunctionPrototypeCall(method, obj);
247257
if (typeof iterator !== 'object' || iterator === null) {
248258
throw new ERR_INVALID_STATE.TypeError('The iterator method must return an object');

src/node_metadata.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,23 @@ Metadata metadata;
5252

5353
#if HAVE_OPENSSL
5454
static constexpr size_t search(const char* s, char c, size_t n = 0) {
55-
return *s == c ? n : search(s + 1, c, n + 1);
55+
return *s == '\0' ? n : (*s == c ? n : search(s + 1, c, n + 1));
5656
}
5757

5858
static inline std::string GetOpenSSLVersion() {
5959
// sample openssl version string format
6060
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
6161
const char* version = OpenSSL_version(OPENSSL_VERSION);
62-
const size_t start = search(version, ' ') + 1;
62+
const size_t first_space = search(version, ' ');
63+
64+
// When Node.js is linked to an alternative library implementing the
65+
// OpenSSL API e.g. BoringSSL, the version string may not match the
66+
// expected pattern. In this case just return “0.0.0” as placeholder.
67+
if (version[first_space] == '\0') {
68+
return "0.0.0";
69+
}
70+
71+
const size_t start = first_space + 1;
6372
const size_t len = search(&version[start], ' ');
6473
return std::string(version, start, len);
6574
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('node:assert');
5+
6+
assert.throws(
7+
() => ReadableStream.from({}),
8+
{ code: 'ERR_ARG_NOT_ITERABLE', name: 'TypeError' },
9+
);

typings/internalBinding/fs.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export interface FsBinding {
291291
utimes: typeof InternalFSBinding.utimes;
292292
writeBuffer: typeof InternalFSBinding.writeBuffer;
293293
writeBuffers: typeof InternalFSBinding.writeBuffers;
294+
writeFileUtf8: typeof InternalFSBinding.writeFileUtf8;
294295
writeString: typeof InternalFSBinding.writeString;
295296

296297
getFormatOfExtensionlessFile: typeof InternalFSBinding.getFormatOfExtensionlessFile;

0 commit comments

Comments
 (0)