Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: handle Float16Array in node:v8 serdes #55996

Merged
merged 11 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
// Index 10 is FastBuffer.
if (type === '[object BigInt64Array]') return 11;
if (type === '[object BigUint64Array]') return 12;
if (type === '[object Float16Array]') return 13;
return -1;
}

Expand All @@ -306,6 +307,8 @@
if (index === 10) return FastBuffer;
if (index === 11) return BigInt64Array;
if (index === 12) return BigUint64Array;
// TODO(bartlomieju): use a primordial, once `Float16Array` is available in stable V8
if (index === 13) return Float16Array;

Check failure on line 311 in lib/v8.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

'Float16Array' is not defined
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
return undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-url.parse-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

function check(request) {
// url.parse should not mess with the method
assert.strictEqual(request.method, 'POST');
assert.strictEqual(request.method, 'POST1');

Check failure on line 32 in test/parallel/test-http-url.parse-post.js

View workflow job for this annotation

GitHub Actions / test-linux

--- stderr --- (node:156892) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) node:assert:113 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 'POST' !== 'POST1' at check (/home/runner/work/node/node/test/parallel/test-http-url.parse-post.js:32:10) at Server.<anonymous> (/home/runner/work/node/node/test/parallel/test-http-url.parse-post.js:42:3) at Server.emit (node:events:513:28) at parserOnIncoming (node:_http_server:1153:12) at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17) { generatedMessage: true, code: 'ERR_ASSERTION', actual: 'POST', expected: 'POST1', operator: 'strictEqual' } Node.js v24.0.0-pre Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /home/runner/work/node/node/test/parallel/test-http-url.parse-post.js

Check failure on line 32 in test/parallel/test-http-url.parse-post.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stderr --- (node:82769) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities. (Use `node --trace-deprecation ...` to show where the warning was created) node:assert:113 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 'POST' !== 'POST1' at check (/Users/runner/work/node/node/test/parallel/test-http-url.parse-post.js:32:10) at Server.<anonymous> (/Users/runner/work/node/node/test/parallel/test-http-url.parse-post.js:42:3) at Server.emit (node:events:513:28) at parserOnIncoming (node:_http_server:1153:12) at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17) { generatedMessage: true, code: 'ERR_ASSERTION', actual: 'POST', expected: 'POST1', operator: 'strictEqual' } Node.js v24.0.0-pre Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /Users/runner/work/node/node/test/parallel/test-http-url.parse-post.js
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved
// Everything else should be right
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
// The host header should use the url.parse.hostname
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-internals
// Flags: --expose-internals --js-float16array

'use strict';

Expand Down Expand Up @@ -26,6 +26,7 @@
Buffer.from([1, 2, 3, 4]),
new BigInt64Array([42n]),
new BigUint64Array([42n]),
new Float16Array([1, 2, 3, 4]),

Check failure on line 29 in test/parallel/test-v8-serdes.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

'Float16Array' is not defined
undefined,
null,
42,
Expand Down
Loading