From 40767829a7bc07518ea7b69d1c5bf703d9ae3d41 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Wed, 21 Aug 2024 18:05:50 +0200 Subject: [PATCH 001/286] Working on v20.17.1 PR-URL: https://github.com/nodejs/node/pull/54447 --- src/node_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_version.h b/src/node_version.h index f04b4da3ed..cb8bb60414 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -24,12 +24,12 @@ #define NODE_MAJOR_VERSION 20 #define NODE_MINOR_VERSION 17 -#define NODE_PATCH_VERSION 0 +#define NODE_PATCH_VERSION 1 #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Iron" -#define NODE_VERSION_IS_RELEASE 1 +#define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) From 82d1c36f513e20e643573f2100bd68beaddc13d2 Mon Sep 17 00:00:00 2001 From: Mihir Bhansali Date: Tue, 23 Apr 2024 12:31:23 -0400 Subject: [PATCH 002/286] test_runner: display failed test stack trace with dot reporter PR-URL: https://github.com/nodejs/node/pull/52655 Reviewed-By: Matteo Collina Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow --- lib/internal/test_runner/reporter/dot.js | 17 +- lib/internal/test_runner/reporter/spec.js | 89 ++----- lib/internal/test_runner/reporter/utils.js | 93 ++++++++ .../test-runner/output/dot_reporter.snapshot | 221 ++++++++++++++++++ .../test-runner/output/eval_dot.snapshot | 12 + test/parallel/test-runner-output.mjs | 4 +- test/parallel/test-runner-reporters.js | 27 ++- 7 files changed, 379 insertions(+), 84 deletions(-) create mode 100644 lib/internal/test_runner/reporter/utils.js diff --git a/lib/internal/test_runner/reporter/dot.js b/lib/internal/test_runner/reporter/dot.js index 496c819d69..e9ba0b8dc7 100644 --- a/lib/internal/test_runner/reporter/dot.js +++ b/lib/internal/test_runner/reporter/dot.js @@ -1,15 +1,22 @@ 'use strict'; -const { MathMax } = primordials; +const { + ArrayPrototypePush, + MathMax, +} = primordials; +const colors = require('internal/util/colors'); +const { formatTestReport } = require('internal/test_runner/reporter/utils'); module.exports = async function* dot(source) { let count = 0; let columns = getLineLength(); - for await (const { type } of source) { + const failedTests = []; + for await (const { type, data } of source) { if (type === 'test:pass') { yield '.'; } if (type === 'test:fail') { yield 'X'; + ArrayPrototypePush(failedTests, data); } if ((type === 'test:fail' || type === 'test:pass') && ++count === columns) { yield '\n'; @@ -20,6 +27,12 @@ module.exports = async function* dot(source) { } } yield '\n'; + if (failedTests.length > 0) { + yield `\n${colors.red}Failed tests:${colors.white}\n\n`; + for (const test of failedTests) { + yield formatTestReport('test:fail', test); + } + } }; function getLineLength() { diff --git a/lib/internal/test_runner/reporter/spec.js b/lib/internal/test_runner/reporter/spec.js index fd4313ae19..2092d22e3f 100644 --- a/lib/internal/test_runner/reporter/spec.js +++ b/lib/internal/test_runner/reporter/spec.js @@ -1,97 +1,35 @@ 'use strict'; - const { ArrayPrototypeJoin, ArrayPrototypePop, ArrayPrototypePush, ArrayPrototypeShift, ArrayPrototypeUnshift, - hardenRegExp, - RegExpPrototypeSymbolSplit, - SafeMap, - StringPrototypeRepeat, } = primordials; const assert = require('assert'); const Transform = require('internal/streams/transform'); -const { inspectWithNoCustomRetry } = require('internal/errors'); const colors = require('internal/util/colors'); const { kSubtestsFailed } = require('internal/test_runner/test'); const { getCoverageReport } = require('internal/test_runner/utils'); const { relative } = require('path'); +const { + formatTestReport, + indent, + reporterColorMap, + reporterUnicodeSymbolMap, +} = require('internal/test_runner/reporter/utils'); -const symbols = { - '__proto__': null, - 'test:fail': '\u2716 ', - 'test:pass': '\u2714 ', - 'test:diagnostic': '\u2139 ', - 'test:coverage': '\u2139 ', - 'arrow:right': '\u25B6 ', - 'hyphen:minus': '\uFE63 ', -}; class SpecReporter extends Transform { #stack = []; #reported = []; - #indentMemo = new SafeMap(); #failedTests = []; #cwd = process.cwd(); - #inspectOptions; - #colors; constructor() { super({ __proto__: null, writableObjectMode: true }); colors.refresh(); - this.#inspectOptions = { __proto__: null, colors: colors.shouldColorize(process.stdout), breakLength: Infinity }; - this.#colors = { - '__proto__': null, - 'test:fail': colors.red, - 'test:pass': colors.green, - 'test:diagnostic': colors.blue, - }; } - #indent(nesting) { - let value = this.#indentMemo.get(nesting); - if (value === undefined) { - value = StringPrototypeRepeat(' ', nesting); - this.#indentMemo.set(nesting, value); - } - - return value; - } - #formatError(error, indent) { - if (!error) return ''; - const err = error.code === 'ERR_TEST_FAILURE' ? error.cause : error; - const message = ArrayPrototypeJoin( - RegExpPrototypeSymbolSplit( - hardenRegExp(/\r?\n/), - inspectWithNoCustomRetry(err, this.#inspectOptions), - ), `\n${indent} `); - return `\n${indent} ${message}\n`; - } - #formatTestReport(type, data, prefix = '', indent = '', hasChildren = false) { - let color = this.#colors[type] ?? colors.white; - let symbol = symbols[type] ?? ' '; - const { skip, todo } = data; - const duration_ms = data.details?.duration_ms ? ` ${colors.gray}(${data.details.duration_ms}ms)${colors.white}` : ''; - let title = `${data.name}${duration_ms}`; - - if (skip !== undefined) { - title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`; - } else if (todo !== undefined) { - title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`; - } - const error = this.#formatError(data.details?.error, indent); - if (hasChildren) { - // If this test has had children - it was already reported, so slightly modify the output - const err = !error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`; - return `${prefix}${indent}${color}${symbols['arrow:right']}${colors.white}${title}${err}`; - } - if (skip !== undefined) { - color = colors.gray; - symbol = symbols['hyphen:minus']; - } - return `${prefix}${indent}${color}${symbol}${title}${colors.white}${error}`; - } #handleTestReportEvent(type, data) { const subtest = ArrayPrototypeShift(this.#stack); // This is the matching `test:start` event if (subtest) { @@ -106,15 +44,15 @@ class SpecReporter extends Transform { assert(parent.type === 'test:start'); const msg = parent.data; ArrayPrototypeUnshift(this.#reported, msg); - prefix += `${this.#indent(msg.nesting)}${symbols['arrow:right']}${msg.name}\n`; + prefix += `${indent(msg.nesting)}${reporterUnicodeSymbolMap['arrow:right']}${msg.name}\n`; } let hasChildren = false; if (this.#reported[0] && this.#reported[0].nesting === data.nesting && this.#reported[0].name === data.name) { ArrayPrototypeShift(this.#reported); hasChildren = true; } - const indent = this.#indent(data.nesting); - return `${this.#formatTestReport(type, data, prefix, indent, hasChildren)}\n`; + const indentation = indent(data.nesting); + return `${formatTestReport(type, data, prefix, indentation, hasChildren)}\n`; } #handleEvent({ type, data }) { switch (type) { @@ -132,9 +70,10 @@ class SpecReporter extends Transform { case 'test:stdout': return data.message; case 'test:diagnostic': - return `${this.#colors[type]}${this.#indent(data.nesting)}${symbols[type]}${data.message}${colors.white}\n`; + return `${reporterColorMap[type]}${indent(data.nesting)}${reporterUnicodeSymbolMap[type]}${data.message}${colors.white}\n`; case 'test:coverage': - return getCoverageReport(this.#indent(data.nesting), data.summary, symbols['test:coverage'], colors.blue, true); + return getCoverageReport(indent(data.nesting), data.summary, + reporterUnicodeSymbolMap['test:coverage'], colors.blue, true); } } _transform({ type, data }, encoding, callback) { @@ -145,10 +84,10 @@ class SpecReporter extends Transform { callback(null, ''); return; } - const results = [`\n${this.#colors['test:fail']}${symbols['test:fail']}failing tests:${colors.white}\n`]; + const results = [`\n${reporterColorMap['test:fail']}${reporterUnicodeSymbolMap['test:fail']}failing tests:${colors.white}\n`]; for (let i = 0; i < this.#failedTests.length; i++) { const test = this.#failedTests[i]; - const formattedErr = this.#formatTestReport('test:fail', test); + const formattedErr = formatTestReport('test:fail', test); if (test.file) { const relPath = relative(this.#cwd, test.file); diff --git a/lib/internal/test_runner/reporter/utils.js b/lib/internal/test_runner/reporter/utils.js new file mode 100644 index 0000000000..42c4ffa3cd --- /dev/null +++ b/lib/internal/test_runner/reporter/utils.js @@ -0,0 +1,93 @@ +'use strict'; +const { + ArrayPrototypeJoin, + RegExpPrototypeSymbolSplit, + SafeMap, + StringPrototypeRepeat, + hardenRegExp, +} = primordials; +const colors = require('internal/util/colors'); +const { inspectWithNoCustomRetry } = require('internal/errors'); +const indentMemo = new SafeMap(); + +const inspectOptions = { + __proto__: null, + colors: colors.shouldColorize(process.stdout), + breakLength: Infinity, +}; + +const reporterUnicodeSymbolMap = { + '__proto__': null, + 'test:fail': '\u2716 ', + 'test:pass': '\u2714 ', + 'test:diagnostic': '\u2139 ', + 'test:coverage': '\u2139 ', + 'arrow:right': '\u25B6 ', + 'hyphen:minus': '\uFE63 ', +}; + +const reporterColorMap = { + '__proto__': null, + get 'test:fail'() { + return colors.red; + }, + get 'test:pass'() { + return colors.green; + }, + get 'test:diagnostic'() { + return colors.blue; + }, +}; + +function indent(nesting) { + let value = indentMemo.get(nesting); + if (value === undefined) { + value = StringPrototypeRepeat(' ', nesting); + indentMemo.set(nesting, value); + } + return value; +} + +function formatError(error, indent) { + if (!error) return ''; + const err = error.code === 'ERR_TEST_FAILURE' ? error.cause : error; + const message = ArrayPrototypeJoin( + RegExpPrototypeSymbolSplit( + hardenRegExp(/\r?\n/), + inspectWithNoCustomRetry(err, inspectOptions), + ), `\n${indent} `); + return `\n${indent} ${message}\n`; +} + +function formatTestReport(type, data, prefix = '', indent = '', hasChildren = false) { + let color = reporterColorMap[type] ?? colors.white; + let symbol = reporterUnicodeSymbolMap[type] ?? ' '; + const { skip, todo } = data; + const duration_ms = data.details?.duration_ms ? ` ${colors.gray}(${data.details.duration_ms}ms)${colors.white}` : ''; + let title = `${data.name}${duration_ms}`; + + if (skip !== undefined) { + title += ` # ${typeof skip === 'string' && skip.length ? skip : 'SKIP'}`; + } else if (todo !== undefined) { + title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`; + } + const error = formatError(data.details?.error, indent); + if (hasChildren) { + // If this test has had children - it was already reported, so slightly modify the output + const err = !error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`; + return `${prefix}${indent}${color}${reporterUnicodeSymbolMap['arrow:right']}${colors.white}${title}${err}`; + } + if (skip !== undefined) { + color = colors.gray; + symbol = reporterUnicodeSymbolMap['hyphen:minus']; + } + return `${prefix}${indent}${color}${symbol}${title}${colors.white}${error}`; +} + +module.exports = { + __proto__: null, + reporterUnicodeSymbolMap, + reporterColorMap, + formatTestReport, + indent, +}; diff --git a/test/fixtures/test-runner/output/dot_reporter.snapshot b/test/fixtures/test-runner/output/dot_reporter.snapshot index 7c6b0ff235..5f2bf18e1d 100644 --- a/test/fixtures/test-runner/output/dot_reporter.snapshot +++ b/test/fixtures/test-runner/output/dot_reporter.snapshot @@ -2,3 +2,224 @@ XXX.....X..X...X.... .....X...XXX.XX..... .XXXXXXX...XXXXX + +Failed tests: + +✖ sync fail todo (*ms) # TODO + Error: thrown from sync fail todo + * + * + * + * + * + * + * +✖ sync fail todo with message (*ms) # this is a failing todo + Error: thrown from sync fail todo with message + * + * + * + * + * + * + * +✖ sync throw fail (*ms) + Error: thrown from sync throw fail + * + * + * + * + * + * + * +✖ async throw fail (*ms) + Error: thrown from async throw fail + * + * + * + * + * + * + * +﹣ async skip fail (*ms) # SKIP + Error: thrown from async throw fail + * + * + * + * + * + * + * +✖ async assertion fail (*ms) + AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: + + true !== false + + * + * + * + * + * + * + * { + generatedMessage: true, + code: 'ERR_ASSERTION', + actual: true, + expected: false, + operator: 'strictEqual' + } +✖ reject fail (*ms) + Error: rejected from reject fail + * + * + * + * + * + * + * +✖ +sync throw fail (*ms) + Error: thrown from subtest sync throw fail + * + * + * + * + * + * + * + * + * + * +✖ subtest sync throw fail (*ms) + '1 subtest failed' +✖ sync throw non-error fail (*ms) + Symbol(thrown symbol from sync throw non-error fail) +✖ +long running (*ms) + 'test did not finish before its parent and was cancelled' +✖ top level (*ms) + '1 subtest failed' +✖ sync skip option is false fail (*ms) + Error: this should be executed + * + * + * + * + * + * + * +✖ callback fail (*ms) + Error: callback failure + * + * +✖ callback also returns a Promise (*ms) + 'passed a callback but also returned a Promise' +✖ callback throw (*ms) + Error: thrown from callback throw + * + * + * + * + * + * + * +✖ callback called twice (*ms) + 'callback invoked multiple times' +✖ callback called twice in future tick (*ms) + Error [ERR_TEST_FAILURE]: callback invoked multiple times + * { + code: 'ERR_TEST_FAILURE', + failureType: 'multipleCallbackInvocations', + cause: 'callback invoked multiple times' + } +✖ callback async throw (*ms) + Error: thrown from callback async throw + * + * +✖ custom inspect symbol fail (*ms) + customized +✖ custom inspect symbol that throws fail (*ms) + { foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] } +✖ sync throw fails at first (*ms) + Error: thrown from subtest sync throw fails at first + * + * + * + * + * + * + * + * + * + * +✖ sync throw fails at second (*ms) + Error: thrown from subtest sync throw fails at second + * + * + * + * + * + * + * + * +✖ subtest sync throw fails (*ms) + '2 subtests failed' +✖ timed out async test (*ms) + 'test timed out after *ms' +✖ timed out callback test (*ms) + 'test timed out after *ms' +✖ rejected thenable (*ms) + 'custom error' +✖ unfinished test with uncaughtException (*ms) + Error: foo + * + * + * +✖ unfinished test with unhandledRejection (*ms) + Error: bar + * + * + * +✖ assertion errors display actual and expected properly (*ms) + AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal: + + { + bar: 1, + baz: { + date: 1970-01-01T00:00:00.000Z, + null: null, + number: 1, + string: 'Hello', + undefined: undefined + }, + boo: [ + 1 + ], + foo: 1 + } + + should loosely deep-equal + + { + baz: { + date: 1970-01-01T00:00:00.000Z, + null: null, + number: 1, + string: 'Hello', + undefined: undefined + }, + boo: [ + 1 + ], + circular: { + bar: 2, + c: [Circular *1] + } + } + * { + generatedMessage: true, + code: 'ERR_ASSERTION', + actual: [Object], + expected: [Object], + operator: 'deepEqual' + } +✖ invalid subtest fail (*ms) + 'test could not be started because its parent finished' diff --git a/test/fixtures/test-runner/output/eval_dot.snapshot b/test/fixtures/test-runner/output/eval_dot.snapshot index 901a287a41..8a22cfd477 100644 --- a/test/fixtures/test-runner/output/eval_dot.snapshot +++ b/test/fixtures/test-runner/output/eval_dot.snapshot @@ -1 +1,13 @@ .X + +Failed tests: + +✖ fails (*ms) + Error: fail + * + * + * + * + * + * + * diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index e2532d2405..774c94bda6 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -97,7 +97,7 @@ const tests = [ { name: 'test-runner/output/abort_hooks.js' }, { name: 'test-runner/output/describe_it.js' }, { name: 'test-runner/output/describe_nested.js' }, - { name: 'test-runner/output/eval_dot.js' }, + { name: 'test-runner/output/eval_dot.js', transform: specTransform }, { name: 'test-runner/output/eval_spec.js', transform: specTransform }, { name: 'test-runner/output/eval_tap.js' }, { name: 'test-runner/output/hooks.js' }, @@ -114,7 +114,7 @@ const tests = [ { name: 'test-runner/output/no_refs.js' }, { name: 'test-runner/output/no_tests.js' }, { name: 'test-runner/output/only_tests.js' }, - { name: 'test-runner/output/dot_reporter.js' }, + { name: 'test-runner/output/dot_reporter.js', transform: specTransform }, { name: 'test-runner/output/junit_reporter.js', transform: junitTransform }, { name: 'test-runner/output/spec_reporter_successful.js', transform: specTransform }, { name: 'test-runner/output/spec_reporter.js', transform: specTransform }, diff --git a/test/parallel/test-runner-reporters.js b/test/parallel/test-runner-reporters.js index 6d1f9ff6be..a412bd099e 100644 --- a/test/parallel/test-runner-reporters.js +++ b/test/parallel/test-runner-reporters.js @@ -25,7 +25,10 @@ describe('node:test reporters', { concurrency: true }, () => { it('should default destination to stdout when passing a single reporter', async () => { const child = spawnSync(process.execPath, ['--test', '--test-reporter', 'dot', testFile]); assert.strictEqual(child.stderr.toString(), ''); - assert.strictEqual(child.stdout.toString(), '.XX.\n'); + assert.match(child.stdout.toString(), /\.XX\.\n/); + assert.match(child.stdout.toString(), /Failed tests:/); + assert.match(child.stdout.toString(), /✖ failing/); + assert.match(child.stdout.toString(), /✖ nested/); }); it('should throw when passing reporters without a destination', async () => { @@ -44,13 +47,19 @@ describe('node:test reporters', { concurrency: true }, () => { const child = spawnSync(process.execPath, ['--test', '--test-reporter', 'dot', '--test-reporter-destination', 'stdout', testFile]); assert.strictEqual(child.stderr.toString(), ''); - assert.strictEqual(child.stdout.toString(), '.XX.\n'); + assert.match(child.stdout.toString(), /\.XX\.\n/); + assert.match(child.stdout.toString(), /Failed tests:/); + assert.match(child.stdout.toString(), /✖ failing/); + assert.match(child.stdout.toString(), /✖ nested/); }); it('should support stderr as a destination', async () => { const child = spawnSync(process.execPath, ['--test', '--test-reporter', 'dot', '--test-reporter-destination', 'stderr', testFile]); - assert.strictEqual(child.stderr.toString(), '.XX.\n'); + assert.match(child.stderr.toString(), /\.XX\.\n/); + assert.match(child.stderr.toString(), /Failed tests:/); + assert.match(child.stderr.toString(), /✖ failing/); + assert.match(child.stderr.toString(), /✖ nested/); assert.strictEqual(child.stdout.toString(), ''); }); @@ -60,7 +69,11 @@ describe('node:test reporters', { concurrency: true }, () => { ['--test', '--test-reporter', 'dot', '--test-reporter-destination', file, testFile]); assert.strictEqual(child.stderr.toString(), ''); assert.strictEqual(child.stdout.toString(), ''); - assert.strictEqual(fs.readFileSync(file, 'utf8'), '.XX.\n'); + const fileContents = fs.readFileSync(file, 'utf8'); + assert.match(fileContents, /\.XX\.\n/); + assert.match(fileContents, /Failed tests:/); + assert.match(fileContents, /✖ failing/); + assert.match(fileContents, /✖ nested/); }); it('should disallow using v8-serializer as reporter', async () => { @@ -81,7 +94,11 @@ describe('node:test reporters', { concurrency: true }, () => { testFile]); assert.match(child.stdout.toString(), /TAP version 13/); assert.match(child.stdout.toString(), /# duration_ms/); - assert.strictEqual(fs.readFileSync(file, 'utf8'), '.XX.\n'); + const fileContents = fs.readFileSync(file, 'utf8'); + assert.match(fileContents, /\.XX\.\n/); + assert.match(fileContents, /Failed tests:/); + assert.match(fileContents, /✖ failing/); + assert.match(fileContents, /✖ nested/); const file2Contents = fs.readFileSync(file2, 'utf8'); assert.match(file2Contents, /▶ nested/); assert.match(file2Contents, /✔ ok/); From 6e0a2bb54c5bbeff0e9e33e1a0c683ed980a8a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 7 May 2024 13:55:58 +0200 Subject: [PATCH 003/286] build: harmonize Clang checks - Set the clang variable in `config.gypi` so it depends on compiler checks made by the configure script. - Replace gyp conditions with `llvm_version` and "0.0" with conditions that use the `clang` variable. - Always use `clang==1` or `clang==0` in gyp conditions PR-URL: https://github.com/nodejs/node/pull/52873 Reviewed-By: Richard Lau Reviewed-By: Yagiz Nizipli Reviewed-By: Mohammed Keyvanzadeh --- common.gypi | 7 +++---- configure.py | 2 ++ deps/openssl/openssl_common.gypi | 2 +- deps/zlib/zlib.gyp | 7 +++---- node.gyp | 2 +- tools/v8_gypfiles/toolchain.gypi | 2 +- tools/v8_gypfiles/v8.gyp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common.gypi b/common.gypi index 7c0b4a0851..ee8ef66679 100644 --- a/common.gypi +++ b/common.gypi @@ -107,7 +107,6 @@ 'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a', }], ['OS=="mac"', { - 'clang%': 1, 'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a', }], @@ -183,10 +182,10 @@ }, { 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD) }], - ['llvm_version=="0.0"', { - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC - }, { + ['clang==1', { 'lto': ' -flto ', # Clang + }, { + 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC }], ], }, diff --git a/configure.py b/configure.py index 3084cc964c..468c0370bf 100755 --- a/configure.py +++ b/configure.py @@ -1097,6 +1097,7 @@ def get_gas_version(cc): # quite prepared to go that far yet. def check_compiler(o): if sys.platform == 'win32': + o['variables']['clang'] = 0 o['variables']['llvm_version'] = '0.0' if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'): nasm_version = get_nasm_version('nasm') @@ -1106,6 +1107,7 @@ def check_compiler(o): return ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++') + o['variables']['clang'] = B(is_clang) version_str = ".".join(map(str, clang_version if is_clang else gcc_version)) print_verbose(f"Detected {'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}") if not ok: diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi index 8745ec130a..4312359e94 100644 --- a/deps/openssl/openssl_common.gypi +++ b/deps/openssl/openssl_common.gypi @@ -67,7 +67,7 @@ 'TERMIOS', ], 'conditions': [ - [ 'llvm_version=="0.0"', { + [ 'clang==0', { 'cflags': ['-Wno-old-style-declaration',], }], ], diff --git a/deps/zlib/zlib.gyp b/deps/zlib/zlib.gyp index 26ceed9fbe..25f570fbe7 100644 --- a/deps/zlib/zlib.gyp +++ b/deps/zlib/zlib.gyp @@ -7,7 +7,6 @@ 'ZLIB_ROOT': '.', 'use_system_zlib%': 0, 'arm_fpu%': '', - 'llvm_version%': '0.0', }, 'conditions': [ ['use_system_zlib==0', { @@ -24,7 +23,7 @@ },{ 'defines': [ 'X86_NOT_WINDOWS' ], }], - ['OS!="win" or llvm_version!="0.0"', { + ['OS!="win" or clang==1', { 'cflags': [ '-mssse3' ], 'xcode_settings': { 'OTHER_CFLAGS': [ '-mssse3' ], @@ -65,7 +64,7 @@ 'conditions': [ ['OS!="ios"', { 'conditions': [ - ['OS!="win" and llvm_version=="0.0"', { + ['OS!="win" and clang==0', { 'cflags': [ '-march=armv8-a+aes+crc' ], }], ['OS=="android"', { @@ -111,7 +110,7 @@ # 'target_name': 'zlib_crc32_simd', # 'type': 'static_library', # 'conditions': [ - # ['OS!="win" or llvm_version!="0.0"', { + # ['OS!="win" or clang==1', { # 'cflags': [ # '-msse4.2', # '-mpclmul', diff --git a/node.gyp b/node.gyp index ff59af6ff7..ca6a4cdcb2 100644 --- a/node.gyp +++ b/node.gyp @@ -488,7 +488,7 @@ '-Wl,-bnoerrmsg', ], }], - ['OS == "linux" and llvm_version != "0.0"', { + ['OS=="linux" and clang==1', { 'libraries': ['-latomic'], }], ], diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi index 0f506f7149..d6df52b8dc 100644 --- a/tools/v8_gypfiles/toolchain.gypi +++ b/tools/v8_gypfiles/toolchain.gypi @@ -134,7 +134,7 @@ '<(V8_ROOT)/include', ], 'conditions': [ - ['clang', { + ['clang==1', { 'cflags': [ '-Werror', '-Wno-unknown-pragmas' ], },{ 'cflags!': [ '-Wall', '-Wextra' ], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 9ffa6e9c6f..e95b35ba3c 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1746,7 +1746,7 @@ ['enable_lto=="true"', { 'cflags_cc': [ '-fno-lto' ], }], - ['clang or OS!="win"', { + ['clang==1 or OS!="win"', { 'conditions': [ ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', { 'sources': [ From 45732314d471836b238c78e76a9d3aee7bda9381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 7 May 2024 15:17:08 +0200 Subject: [PATCH 004/286] build: sync V8 warning cflags with BUILD.gn PR-URL: https://github.com/nodejs/node/pull/52873 Reviewed-By: Richard Lau Reviewed-By: Yagiz Nizipli Reviewed-By: Mohammed Keyvanzadeh --- common.gypi | 1 - tools/v8_gypfiles/toolchain.gypi | 20 ++++++++++++-------- tools/v8_gypfiles/v8.gyp | 6 ------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/common.gypi b/common.gypi index ee8ef66679..1ece4f5e49 100644 --- a/common.gypi +++ b/common.gypi @@ -3,7 +3,6 @@ 'configuring_node%': 0, 'asan%': 0, 'ubsan%': 0, - 'werror': '', # Turn off -Werror in V8 build. 'visibility%': 'hidden', # V8's visibility setting 'target_arch%': 'ia32', # set v8's target architecture 'host_arch%': 'ia32', # set v8's host architecture diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi index d6df52b8dc..0f03b8ee7b 100644 --- a/tools/v8_gypfiles/toolchain.gypi +++ b/tools/v8_gypfiles/toolchain.gypi @@ -82,7 +82,6 @@ 'v8_toolset_for_shell%': 'target', 'host_os%': '<(OS)', - 'werror%': '-Werror', # For a shared library build, results in "libv8-<(soname_version).so". 'soname_version%': '', @@ -133,13 +132,21 @@ '<(V8_ROOT)', '<(V8_ROOT)/include', ], + 'cflags!': ['-Wall', '-Wextra'], 'conditions': [ - ['clang==1', { - 'cflags': [ '-Werror', '-Wno-unknown-pragmas' ], - },{ - 'cflags!': [ '-Wall', '-Wextra' ], + ['clang==0 and OS!="win"', { 'cflags': [ + # In deps/v8/BUILD.gn: if (!is_clang && !is_win) { cflags += [...] } + '-Wno-strict-overflow', '-Wno-return-type', + '-Wno-int-in-bool-context', + '-Wno-deprecated', + '-Wno-stringop-overflow', + '-Wno-stringop-overread', + '-Wno-restrict', + '-Wno-array-bounds', + '-Wno-nonnull', + '-Wno-dangling-pointer', # On by default in Clang and V8 requires it at least for arm64. '-flax-vector-conversions', ], @@ -428,9 +435,6 @@ ['_toolset=="target"', { 'conditions': [ ['v8_target_arch==target_arch', { - 'cflags': [ - '-Wno-error=array-bounds', # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273 - ], 'conditions': [ ['v8_target_arch=="mips64el"', { 'cflags': ['-EL'], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index e95b35ba3c..45f6e0db86 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1981,12 +1981,6 @@ ] }], ], - # -Wno-invalid-offsetof flag is not valid for C. - # The flag is initially set in `toolchain.gypi` for all targets. - 'cflags!': [ '-Wno-invalid-offsetof' ], - 'xcode_settings': { - 'WARNING_CFLAGS!': ['-Wno-invalid-offsetof'] - }, 'direct_dependent_settings': { 'include_dirs': [ '<(V8_ROOT)/third_party/zlib', From 968615361663fb431c114de9585ddf7fdc37204f Mon Sep 17 00:00:00 2001 From: Mert Can Altin Date: Sun, 12 May 2024 10:38:40 +0300 Subject: [PATCH 005/286] stream: fix util.inspect for compression/decompressionStream PR-URL: https://github.com/nodejs/node/pull/52283 Fixes: https://github.com/nodejs/node/issues/52263 Reviewed-By: Luigi Pinca Reviewed-By: Daeyeon Jeong Reviewed-By: Chemi Atlow Reviewed-By: Matthew Aitken Reviewed-By: Filip Skokan Reviewed-By: Benjamin Gruenbaum Reviewed-By: Deokjin Kim Reviewed-By: Moshe Atlow Reviewed-By: Antoine du Hamel --- lib/internal/webstreams/compression.js | 4 +- .../test-compression-decompression-stream.js | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-compression-decompression-stream.js diff --git a/lib/internal/webstreams/compression.js b/lib/internal/webstreams/compression.js index 28b6dc8f7a..92933aae4d 100644 --- a/lib/internal/webstreams/compression.js +++ b/lib/internal/webstreams/compression.js @@ -94,7 +94,7 @@ class CompressionStream { [kInspect](depth, options) { if (!isCompressionStream(this)) throw new ERR_INVALID_THIS('CompressionStream'); - customInspect(depth, options, 'CompressionStream', { + return customInspect(depth, options, 'CompressionStream', { readable: this[kTransform].readable, writable: this[kTransform].writable, }); @@ -146,7 +146,7 @@ class DecompressionStream { [kInspect](depth, options) { if (!isDecompressionStream(this)) throw new ERR_INVALID_THIS('DecompressionStream'); - customInspect(depth, options, 'DecompressionStream', { + return customInspect(depth, options, 'DecompressionStream', { readable: this[kTransform].readable, writable: this[kTransform].writable, }); diff --git a/test/parallel/test-compression-decompression-stream.js b/test/parallel/test-compression-decompression-stream.js new file mode 100644 index 0000000000..1340c5c8bc --- /dev/null +++ b/test/parallel/test-compression-decompression-stream.js @@ -0,0 +1,41 @@ +// Flags: --no-warnings --expose-internals +'use strict'; + +require('../common'); + +const assert = require('node:assert'); +const { describe, it } = require('node:test'); +const { + CompressionStream, + DecompressionStream, +} = require('node:stream/web'); + +const { + customInspectSymbol: kInspect, +} = require('internal/util'); + +describe('DecompressionStream kInspect method', () => { + it('should return a predictable inspection string with DecompressionStream', () => { + const decompressionStream = new DecompressionStream('deflate'); + const depth = 1; + const options = {}; + const actual = decompressionStream[kInspect](depth, options); + + assert(actual.includes('DecompressionStream')); + assert(actual.includes('ReadableStream')); + assert(actual.includes('WritableStream')); + }); +}); + +describe('CompressionStream kInspect method', () => { + it('should return a predictable inspection string with CompressionStream', () => { + const compressionStream = new CompressionStream('deflate'); + const depth = 1; + const options = {}; + const actual = compressionStream[kInspect](depth, options); + + assert(actual.includes('CompressionStream')); + assert(actual.includes('ReadableStream')); + assert(actual.includes('WritableStream')); + }); +}); From eb2402d56934db9586df867223603dc97587dad2 Mon Sep 17 00:00:00 2001 From: Pooja D P Date: Tue, 24 Nov 2020 22:49:21 -0800 Subject: [PATCH 006/286] build: enable building with shared uvwasi lib Fixes: https://github.com/nodejs/node/issues/35339 Co-authored-by: Pooja D P Co-authored-by: Teutates <103068388+Teutates@users.noreply.github.com> Co-authored-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/43987 Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- configure.py | 23 +++++++++++++++++++++++ node.gyp | 11 +++-------- node.gypi | 4 ++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index 468c0370bf..4d13adeed0 100755 --- a/configure.py +++ b/configure.py @@ -381,6 +381,28 @@ dest='shared_openssl_libpath', help='a directory to search for the shared OpenSSL DLLs') +shared_optgroup.add_argument('--shared-uvwasi', + action='store_true', + dest='shared_uvwasi', + default=None, + help='link to a shared uvwasi DLL instead of static linking') + +shared_optgroup.add_argument('--shared-uvwasi-includes', + action='store', + dest='shared_uvwasi_includes', + help='directory containing uvwasi header files') + +shared_optgroup.add_argument('--shared-uvwasi-libname', + action='store', + dest='shared_uvwasi_libname', + default='uvwasi', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_argument('--shared-uvwasi-libpath', + action='store', + dest='shared_uvwasi_libpath', + help='a directory to search for the shared uvwasi DLL') + shared_optgroup.add_argument('--shared-zlib', action='store_true', dest='shared_zlib', @@ -2119,6 +2141,7 @@ def make_bin_override(): configure_library('nghttp2', output, pkgname='libnghttp2') configure_library('nghttp3', output, pkgname='libnghttp3') configure_library('ngtcp2', output, pkgname='libngtcp2') +configure_library('uvwasi', output, pkgname='libuvwasi') configure_v8(output) configure_openssl(output) configure_intl(output) diff --git a/node.gyp b/node.gyp index ca6a4cdcb2..da7f3e9940 100644 --- a/node.gyp +++ b/node.gyp @@ -19,6 +19,7 @@ 'node_shared_http_parser%': 'false', 'node_shared_cares%': 'false', 'node_shared_libuv%': 'false', + 'node_shared_uvwasi%': 'false', 'node_shared_nghttp2%': 'false', 'node_use_openssl%': 'true', 'node_shared_openssl%': 'false', @@ -534,7 +535,6 @@ 'dependencies': [ 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', ], 'msvs_settings': { @@ -1014,8 +1014,8 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', ], + 'includes': [ 'node.gypi' ], @@ -1025,9 +1025,9 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/cctest', ], + 'defines': [ 'NODE_ARCH="<(target_arch)"', 'NODE_PLATFORM="<(OS)"', @@ -1164,7 +1164,6 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/cctest', ], @@ -1226,7 +1225,6 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', 'deps/ada/ada.gyp:ada', ], @@ -1241,7 +1239,6 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/embedding', ], @@ -1341,7 +1338,6 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', 'deps/ada/ada.gyp:ada', ], @@ -1355,7 +1351,6 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', ], 'defines': [ 'NODE_WANT_INTERNALS=1' ], diff --git a/node.gypi b/node.gypi index e908076aed..46c7c7e353 100644 --- a/node.gypi +++ b/node.gypi @@ -208,6 +208,10 @@ ], }], + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ 'deps/uvwasi/uvwasi.gyp:uvwasi' ], + }], + [ 'node_shared_nghttp2=="false"', { 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ], }], From 02b36cbd2dc30d5565afa920cda077d650b652e9 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Mon, 13 May 2024 07:32:08 +0200 Subject: [PATCH 007/286] lib: add EventSource Client PR-URL: https://github.com/nodejs/node/pull/51575 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Matthew Aitken Reviewed-By: Matteo Collina Reviewed-By: Antoine du Hamel --- .eslintrc.js | 1 + doc/api/cli.md | 10 ++++++++++ doc/node.1 | 3 +++ lib/.eslintrc.yaml | 2 ++ lib/internal/bootstrap/web/exposed-window-or-worker.js | 3 +++ lib/internal/process/pre_execution.js | 8 ++++++++ src/node_options.cc | 5 +++++ src/node_options.h | 1 + test/common/globals.js | 1 + test/common/index.js | 4 ++++ test/parallel/test-eventsource-disabled.js | 6 ++++++ test/parallel/test-eventsource.js | 7 +++++++ 12 files changed, 51 insertions(+) create mode 100644 test/parallel/test-eventsource-disabled.js create mode 100644 test/parallel/test-eventsource.js diff --git a/.eslintrc.js b/.eslintrc.js index f86f42e8f2..9eaa7e3f47 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -348,6 +348,7 @@ module.exports = { Crypto: 'readable', CryptoKey: 'readable', DecompressionStream: 'readable', + EventSource: 'readable', fetch: 'readable', FormData: 'readable', ReadableStream: 'readable', diff --git a/doc/api/cli.md b/doc/api/cli.md index 8f32a44ad4..0b8eb7b0cb 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -898,6 +898,14 @@ CommonJS. This includes the following: * Lexical redeclarations of the CommonJS wrapper variables (`require`, `module`, `exports`, `__dirname`, `__filename`). +### `--experimental-eventsource` + + + +Enable exposition of [EventSource Web API][] on the global scope. + ### `--experimental-import-meta-resolve` + + `--perf-basic-prof-only-functions`, `--perf-basic-prof`, `--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux. `--enable-etw-stack-walking` is only available on Windows. + + ### `NODE_PATH=path[:…]` + +### `--abort-on-uncaught-exception` + +### `--disallow-code-generation-from-strings` + +### `--enable-etw-stack-walking` + +### `--harmony-shadow-realm` + +### `--huge-max-old-generation-size` + +### `--jitless` + +### `--interpreted-frames-native-stack` + +### `--prof` + +### `--perf-basic-prof` + +### `--perf-basic-prof-only-functions` + +### `--perf-prof` + +### `--perf-prof-unwinding-info` + ### `--max-old-space-size=SIZE` (in megabytes) Sets the max memory size of V8's old memory section. As memory @@ -3174,6 +3204,19 @@ for MiB in 16 32 64 128; do done ``` +### `--security-revert` + +### `--stack-trace-limit=limit` + +The maximum number of stack frames to collect in an error's stack trace. +Setting it to 0 disables stack trace collection. The default value is 10. + +```bash +node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 +``` + + + [#42511]: https://github.com/nodejs/node/issues/42511 [Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ [CommonJS]: modules.md diff --git a/doc/contributing/internal-api.md b/doc/contributing/internal-api.md index 2631978e1a..e4120f44fc 100644 --- a/doc/contributing/internal-api.md +++ b/doc/contributing/internal-api.md @@ -8,6 +8,12 @@ rules. The core developers may remove these flags in any version of Node.js. ### Flags +#### `--debug-arraybuffer-allocations` + +#### `--expose-internals` + +Allows to require the `internal/*` modules. + #### `--inspect-brk-node[=[host:]port]` (.*)/s)[1]; +const v8OptionsText = cliText.match(/(.*)/s)[1]; + +const manPage = path.join(rootDir, 'doc', 'node.1'); +const manPageText = fs.readFileSync(manPage, { encoding: 'utf8' }); + +// Documented in /doc/api/deprecations.md +const deprecated = [ + '--debug', + '--debug-brk', +]; + + +const manPagesOptions = new Set(); + +for (const [, envVar] of manPageText.matchAll(/\.It Fl (-[a-zA-Z0-9._-]+)/g)) { + manPagesOptions.add(envVar); +} + +for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) { + let hasTrueAsDefaultValue = false; + let isInNodeOption = false; + let isV8Option = false; + let isNoOp = false; + + if (config.includes('NoOp{}')) { + isNoOp = true; + } + + if (config.includes('kAllowedInEnvvar')) { + isInNodeOption = true; + } + if (config.includes('kDisallowedInEnvvar')) { + isInNodeOption = false; + } + + if (config.includes('V8Option{}')) { + isV8Option = true; + } + + if (/^\s*true\s*$/.test(config.split(',').pop())) { + hasTrueAsDefaultValue = true; + } + + if ( + envVar.startsWith('[') || + deprecated.includes(envVar) || + isNoOp + ) { + // assert(!manPagesOptions.has(envVar.slice(1)), `Option ${envVar} should not be documented`) + manPagesOptions.delete(envVar.slice(1)); + continue; + } + + // Internal API options are documented in /doc/contributing/internal-api.md + if (new RegExp(`####.*\`${envVar}[[=\\s\\b\`]`).test(internalApiText) === true) { + manPagesOptions.delete(envVar.slice(1)); + continue; + } + + // CLI options + if (!isV8Option && !hasTrueAsDefaultValue) { + if (new RegExp(`###.*\`${envVar}[[=\\s\\b\`]`).test(cliText) === false) { + assert(false, `Should have option ${envVar} documented`); + } else { + manPagesOptions.delete(envVar.slice(1)); + } + } + + if (!hasTrueAsDefaultValue && new RegExp(`###.*\`--no${envVar.slice(1)}[[=\\s\\b\`]`).test(cliText) === true) { + assert(false, `Should not have option --no${envVar.slice(1)} documented`); + } + + if (!isV8Option && hasTrueAsDefaultValue) { + if (new RegExp(`###.*\`--no${envVar.slice(1)}[[=\\s\\b\`]`).test(cliText) === false) { + assert(false, `Should have option --no${envVar.slice(1)} documented`); + } else { + manPagesOptions.delete(`-no${envVar.slice(1)}`); + } + } + + // NODE_OPTIONS + if (isInNodeOption && !hasTrueAsDefaultValue && new RegExp(`\`${envVar}\``).test(nodeOptionsText) === false) { + assert(false, `Should have option ${envVar} in NODE_OPTIONS documented`); + } + + if (isInNodeOption && hasTrueAsDefaultValue && new RegExp(`\`--no${envVar.slice(1)}`).test(cliText) === false) { + assert(false, `Should have option --no${envVar.slice(1)} in NODE_OPTIONS documented`); + } + + if (!hasTrueAsDefaultValue && new RegExp(`\`--no${envVar.slice(1)}`).test(cliText) === true) { + assert(false, `Should not have option --no${envVar.slice(1)} in NODE_OPTIONS documented`); + } + + // V8 options + if (isV8Option) { + if (new RegExp(`###.*\`${envVar}[[=\\s\\b\`]`).test(v8OptionsText) === false) { + assert(false, `Should have option ${envVar} in V8 options documented`); + } else { + manPagesOptions.delete(envVar.slice(1)); + } + } +} + +// add alias handling +manPagesOptions.delete('-trace-events-enabled'); + +assert.strictEqual(manPagesOptions.size, 0, `Man page options not documented: ${[...manPagesOptions]}`); From 3f78d4eb28a045a849db936ffbb4f557322770d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9?= Date: Tue, 4 Jun 2024 12:07:29 -0500 Subject: [PATCH 014/286] cli: add `--expose-gc` flag available to `NODE_OPTIONS` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commits allows users to send `--expose-gc` via `NODE_OPTIONS` environment variable. Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't work. ```sh NODE_OPTIONS='--expose-gc' node node: --expose-gc is not allowed in NODE_OPTIONS ``` Signed-off-by: Juan José Arboleda PR-URL: https://github.com/nodejs/node/pull/53078 Reviewed-By: Tierney Cyren Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Chengzhong Wu --- doc/api/cli.md | 20 ++++++++++++++++++++ src/node_options.cc | 1 + test/parallel/test-cli-node-options.js | 1 + 3 files changed, 22 insertions(+) diff --git a/doc/api/cli.md b/doc/api/cli.md index 82cbd12d8c..230927cff5 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -687,6 +687,23 @@ Make built-in language features like `eval` and `new Function` that generate code from strings throw an exception instead. This does not affect the Node.js `node:vm` module. +### `--expose-gc` + + + +> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to +> change upstream. + +This flag will expose the gc extension from V8. + +```js +if (globalThis.gc) { + globalThis.gc(); +} +``` + ### `--dns-result-order=order` er // ---> n bool IsEndNode() const { - if (children.size() == 0) { + if (children.empty()) { return true; } return is_leaf; From 35057828017778c45d57077b64829fd4f6b12539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 16 Jun 2024 19:44:58 +0200 Subject: [PATCH 016/286] buffer: make indexOf(byte) faster Add a V8 fast API implementation for indexOfNumber, which significantly improves the performance of finding a single byte within a buffer. Refs: https://github.com/nodejs/node/pull/52993 PR-URL: https://github.com/nodejs/node/pull/53455 Reviewed-By: Yagiz Nizipli Reviewed-By: Robert Nagy Reviewed-By: Mohammed Keyvanzadeh --- src/node_buffer.cc | 67 ++++++++++++++++++++++++----------- src/node_external_reference.h | 7 ++++ 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index e7e3ead441..527a4cf4a0 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -57,6 +57,7 @@ using v8::ArrayBufferView; using v8::BackingStore; using v8::Context; using v8::EscapableHandleScope; +using v8::FastApiTypedArray; using v8::FunctionCallbackInfo; using v8::Global; using v8::HandleScope; @@ -1071,37 +1072,57 @@ void IndexOfBuffer(const FunctionCallbackInfo& args) { result == haystack_length ? -1 : static_cast(result)); } -void IndexOfNumber(const FunctionCallbackInfo& args) { +int32_t IndexOfNumber(const uint8_t* buffer_data, + size_t buffer_length, + uint32_t needle, + int64_t offset_i64, + bool is_forward) { + int64_t opt_offset = IndexOfOffset(buffer_length, offset_i64, 1, is_forward); + if (opt_offset <= -1 || buffer_length == 0) { + return -1; + } + size_t offset = static_cast(opt_offset); + CHECK_LT(offset, buffer_length); + + const void* ptr; + if (is_forward) { + ptr = memchr(buffer_data + offset, needle, buffer_length - offset); + } else { + ptr = node::stringsearch::MemrchrFill(buffer_data, needle, offset + 1); + } + const uint8_t* ptr_uint8 = static_cast(ptr); + return ptr != nullptr ? static_cast(ptr_uint8 - buffer_data) : -1; +} + +void SlowIndexOfNumber(const FunctionCallbackInfo& args) { CHECK(args[1]->IsUint32()); CHECK(args[2]->IsNumber()); CHECK(args[3]->IsBoolean()); THROW_AND_RETURN_UNLESS_BUFFER(Environment::GetCurrent(args), args[0]); - ArrayBufferViewContents buffer(args[0]); + ArrayBufferViewContents buffer(args[0]); uint32_t needle = args[1].As()->Value(); int64_t offset_i64 = args[2].As()->Value(); bool is_forward = args[3]->IsTrue(); - int64_t opt_offset = - IndexOfOffset(buffer.length(), offset_i64, 1, is_forward); - if (opt_offset <= -1 || buffer.length() == 0) { - return args.GetReturnValue().Set(-1); - } - size_t offset = static_cast(opt_offset); - CHECK_LT(offset, buffer.length()); + args.GetReturnValue().Set(IndexOfNumber( + buffer.data(), buffer.length(), needle, offset_i64, is_forward)); +} - const void* ptr; - if (is_forward) { - ptr = memchr(buffer.data() + offset, needle, buffer.length() - offset); - } else { - ptr = node::stringsearch::MemrchrFill(buffer.data(), needle, offset + 1); - } - const char* ptr_char = static_cast(ptr); - args.GetReturnValue().Set(ptr ? static_cast(ptr_char - buffer.data()) - : -1); +int32_t FastIndexOfNumber(v8::Local, + const FastApiTypedArray& buffer, + uint32_t needle, + int64_t offset_i64, + bool is_forward) { + uint8_t* buffer_data; + CHECK(buffer.getStorageIfAligned(&buffer_data)); + return IndexOfNumber( + buffer_data, buffer.length(), needle, offset_i64, is_forward); } +static v8::CFunction fast_index_of_number( + v8::CFunction::Make(FastIndexOfNumber)); void Swap16(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); @@ -1413,7 +1434,11 @@ void Initialize(Local target, SetMethodNoSideEffect(context, target, "compareOffset", CompareOffset); SetMethod(context, target, "fill", Fill); SetMethodNoSideEffect(context, target, "indexOfBuffer", IndexOfBuffer); - SetMethodNoSideEffect(context, target, "indexOfNumber", IndexOfNumber); + SetFastMethodNoSideEffect(context, + target, + "indexOfNumber", + SlowIndexOfNumber, + &fast_index_of_number); SetMethodNoSideEffect(context, target, "indexOfString", IndexOfString); SetMethod(context, target, "detachArrayBuffer", DetachArrayBuffer); @@ -1472,7 +1497,9 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(CompareOffset); registry->Register(Fill); registry->Register(IndexOfBuffer); - registry->Register(IndexOfNumber); + registry->Register(SlowIndexOfNumber); + registry->Register(FastIndexOfNumber); + registry->Register(fast_index_of_number.GetTypeInfo()); registry->Register(IndexOfString); registry->Register(Swap16); diff --git a/src/node_external_reference.h b/src/node_external_reference.h index a3317d25ad..4e2ad90240 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -27,6 +27,12 @@ using CFunctionCallbackWithStrings = bool (*)(v8::Local, const v8::FastOneByteString& input, const v8::FastOneByteString& base); +using CFunctionCallbackWithUint8ArrayUint32Int64Bool = + int32_t (*)(v8::Local, + const v8::FastApiTypedArray&, + uint32_t, + int64_t, + bool); using CFunctionWithUint32 = uint32_t (*)(v8::Local, const uint32_t input); using CFunctionWithDoubleReturnDouble = double (*)(v8::Local, @@ -51,6 +57,7 @@ class ExternalReferenceRegistry { V(CFunctionCallbackWithBool) \ V(CFunctionCallbackWithString) \ V(CFunctionCallbackWithStrings) \ + V(CFunctionCallbackWithUint8ArrayUint32Int64Bool) \ V(CFunctionWithUint32) \ V(CFunctionWithDoubleReturnDouble) \ V(CFunctionWithInt64Fallback) \ From 1c1bd7ce527cd13c4b17de9edd35cbe89ea27b80 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 18 Jun 2024 12:02:16 -0400 Subject: [PATCH 017/286] test: update `url` web-platform tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/53472 Reviewed-By: Michaël Zasso Reviewed-By: Filip Skokan Reviewed-By: Chemi Atlow Reviewed-By: Moshe Atlow Reviewed-By: Tobias Nießen --- test/fixtures/wpt/README.md | 2 +- test/fixtures/wpt/url/WEB_FEATURES.yml | 4 + test/fixtures/wpt/url/a-element.html | 10 ++ .../wpt/url/resources/setters_tests.json | 44 +++++++++ .../wpt/url/resources/urltestdata.json | 98 +++++++++++++++++++ test/fixtures/wpt/versions.json | 4 +- 6 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/wpt/url/WEB_FEATURES.yml diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 9c4e4cf5ad..3f65907043 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -27,7 +27,7 @@ Last update: - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing - resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources - streams: https://github.com/web-platform-tests/wpt/tree/9b03282a99/streams -- url: https://github.com/web-platform-tests/wpt/tree/0f550ab9f5/url +- url: https://github.com/web-platform-tests/wpt/tree/7f369fef2b/url - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi diff --git a/test/fixtures/wpt/url/WEB_FEATURES.yml b/test/fixtures/wpt/url/WEB_FEATURES.yml new file mode 100644 index 0000000000..4711efc1fa --- /dev/null +++ b/test/fixtures/wpt/url/WEB_FEATURES.yml @@ -0,0 +1,4 @@ +features: +- name: url-canparse + files: + - url-statics-canparse.* diff --git a/test/fixtures/wpt/url/a-element.html b/test/fixtures/wpt/url/a-element.html index 3429e07ec3..3428fa0057 100644 --- a/test/fixtures/wpt/url/a-element.html +++ b/test/fixtures/wpt/url/a-element.html @@ -11,3 +11,13 @@
+ + + Link with embedded \n is parsed correctly + + diff --git a/test/fixtures/wpt/url/resources/setters_tests.json b/test/fixtures/wpt/url/resources/setters_tests.json index 82adf4cdce..3850606d66 100644 --- a/test/fixtures/wpt/url/resources/setters_tests.json +++ b/test/fixtures/wpt/url/resources/setters_tests.json @@ -825,6 +825,17 @@ "port": "" } }, + { + "comment": "Stuff after a ? delimiter is ignored, trailing 'port'", + "href": "http://example.net/path", + "new_value": "example.com?stuff:8080", + "expected": { + "href": "http://example.com/path", + "host": "example.com", + "hostname": "example.com", + "port": "" + } + }, { "comment": "Stuff after a ? delimiter is ignored", "href": "http://example.net/path", @@ -924,6 +935,39 @@ "port": "8080" } }, + { + "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error", + "href": "http://example.net:8080", + "new_value": "example.com:invalid", + "expected": { + "href": "http://example.com:8080/", + "host": "example.com:8080", + "hostname": "example.com", + "port": "8080" + } + }, + { + "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error", + "href": "http://example.net:8080/test", + "new_value": "[::1]:invalid", + "expected": { + "href": "http://[::1]:8080/test", + "host": "[::1]:8080", + "hostname": "[::1]", + "port": "8080" + } + }, + { + "comment": "IPv6 without port", + "href": "http://example.net:8080/test", + "new_value": "[::1]", + "expected": { + "href": "http://[::1]:8080/test", + "host": "[::1]:8080", + "hostname": "[::1]", + "port": "8080" + } + }, { "comment": "Port numbers are 16 bit integers", "href": "http://example.net/path", diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index 287a84b467..7c2a0f68c7 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -1751,6 +1751,76 @@ "search": "", "hash": "" }, + { + "input": "file:///w|m", + "base": null, + "href": "file:///w|m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w|m", + "search": "", + "hash": "" + }, + { + "input": "file:///w||m", + "base": null, + "href": "file:///w||m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w||m", + "search": "", + "hash": "" + }, + { + "input": "file:///w|/m", + "base": null, + "href": "file:///w:/m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w:/m", + "search": "", + "hash": "" + }, + { + "input": "file:C|/m/", + "base": null, + "href": "file:///C:/m/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/m/", + "search": "", + "hash": "" + }, + { + "input": "file:C||/m/", + "base": null, + "href": "file:///C||/m/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C||/m/", + "search": "", + "hash": "" + }, "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js", { "input": "http://example.com/././foo", @@ -3560,6 +3630,34 @@ "search": "", "hash": "" }, + { + "input": "file:.", + "base": null, + "href": "file:///", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "file:.", + "base": "http://www.example.com/test", + "href": "file:///", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html", "Basic canonicalization, uppercase should be converted to lowercase", { diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index c31d76cc47..602b4c63e8 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -68,7 +68,7 @@ "path": "streams" }, "url": { - "commit": "c2d7e70b52cbd9a5b938aa32f37078d7a71e0b21", + "commit": "7f369fef2b6f740a0738510331274bf2cbf7b509", "path": "url" }, "user-timing": { @@ -95,4 +95,4 @@ "commit": "e97fac4791931fb7455ba3fad759d362c7108b09", "path": "webmessaging/broadcastchannel" } -} +} \ No newline at end of file From 87167fa248cd7b3b9e6d831c2bdf5f3a90a52152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 18 Jun 2024 18:02:42 +0200 Subject: [PATCH 018/286] src: use `args.This()` instead of `Holder` The latter is deprecated in V8. Refs: http://crbug.com/333672197 PR-URL: https://github.com/nodejs/node/pull/53474 Reviewed-By: Robert Nagy Reviewed-By: Joyee Cheung Reviewed-By: Rafael Gonzaga Reviewed-By: James M Snell Reviewed-By: Paolo Insogna Reviewed-By: Stephen Belanger Reviewed-By: Mohammed Keyvanzadeh --- doc/api/addons.md | 4 +- src/README.md | 6 +-- src/async_wrap.cc | 6 +-- src/cares_wrap.cc | 10 ++-- src/crypto/crypto_cipher.cc | 14 +++--- src/crypto/crypto_context.cc | 50 +++++++++---------- src/crypto/crypto_dh.cc | 10 ++-- src/crypto/crypto_ec.cc | 12 ++--- src/crypto/crypto_hash.cc | 2 +- src/crypto/crypto_hmac.cc | 4 +- src/crypto/crypto_keys.cc | 22 ++++---- src/crypto/crypto_sig.cc | 8 +-- src/crypto/crypto_tls.cc | 80 +++++++++++++++--------------- src/crypto/crypto_util.h | 4 +- src/crypto/crypto_x509.cc | 28 +++++------ src/handle_wrap.cc | 8 +-- src/histogram.cc | 40 +++++++-------- src/inspector_js_api.cc | 17 +++---- src/js_stream.cc | 4 +- src/js_udp_wrap.cc | 8 +-- src/node_blob.cc | 6 +-- src/node_contextify.cc | 8 +-- src/node_dir.cc | 4 +- src/node_file.cc | 4 +- src/node_http2.cc | 46 ++++++++--------- src/node_http_parser.cc | 32 ++++++------ src/node_internals.h | 5 +- src/node_process_methods.cc | 4 +- src/node_serdes.cc | 34 ++++++------- src/node_sockaddr.cc | 16 +++--- src/node_stat_watcher.cc | 2 +- src/node_trace_events.cc | 4 +- src/node_v8.cc | 4 +- src/node_wasm_web_api.cc | 8 +-- src/node_watchdog.cc | 4 +- src/node_zlib.cc | 12 ++--- src/pipe_wrap.cc | 12 ++--- src/process_wrap.cc | 4 +- src/signal_wrap.cc | 4 +- src/stream_base.cc | 2 +- src/stream_pipe.cc | 8 +-- src/stream_wrap.cc | 2 +- src/tcp_wrap.cc | 37 ++++++-------- src/tty_wrap.cc | 10 ++-- src/udp_wrap.cc | 55 +++++++++----------- test/parallel/test-timers-unref.js | 2 +- 46 files changed, 320 insertions(+), 346 deletions(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 08172a9ae9..446a63b1a2 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -923,7 +923,7 @@ void MyObject::New(const FunctionCallbackInfo& args) { void MyObject::PlusOne(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); - MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + MyObject* obj = ObjectWrap::Unwrap(args.This()); obj->value_ += 1; args.GetReturnValue().Set(Number::New(isolate, obj->value_)); @@ -1138,7 +1138,7 @@ void MyObject::NewInstance(const FunctionCallbackInfo& args) { void MyObject::PlusOne(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); - MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + MyObject* obj = ObjectWrap::Unwrap(args.This()); obj->value_ += 1; args.GetReturnValue().Set(Number::New(isolate, obj->value_)); diff --git a/src/README.md b/src/README.md index 5853e1efa2..01d6d5fd4b 100644 --- a/src/README.md +++ b/src/README.md @@ -418,8 +418,6 @@ Node.js source code.) `args[n]` is a `Local` that represents the n-th argument passed to the function. `args.This()` is the `this` value inside this function call. -`args.Holder()` is equivalent to `args.This()` in all use cases inside of -Node.js. `args.GetReturnValue()` is a placeholder for the return value of the function, and provides a `.Set()` method that can be called with a boolean, integer, @@ -829,7 +827,7 @@ The JavaScript object can be accessed as a `v8::Local` by using `self->object()`, given a `BaseObject` named `self`. Accessing a `BaseObject` from a `v8::Local` (frequently that is -`args.This()` or `args.Holder()` in a [binding function][]) can be done using +`args.This()` in a [binding function][]) can be done using the `Unwrap(obj)` function, where `T` is a subclass of `BaseObject`. A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the current function if unwrapping fails (typically that means that the `BaseObject` @@ -838,7 +836,7 @@ has been deleted earlier). ```cpp void Http2Session::Request(const FunctionCallbackInfo& args) { Http2Session* session; - ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&session, args.This()); Environment* env = session->env(); Local context = env->context(); Isolate* isolate = env->isolate(); diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 4b96331c18..65829a31a3 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -254,7 +254,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo& args) { void AsyncWrap::GetAsyncId(const FunctionCallbackInfo& args) { AsyncWrap* wrap; args.GetReturnValue().Set(kInvalidAsyncId); - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); args.GetReturnValue().Set(wrap->get_async_id()); } @@ -296,7 +296,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo& args) { CHECK(args[0]->IsObject()); AsyncWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); Local resource = args[0].As(); double execution_async_id = @@ -308,7 +308,7 @@ void AsyncWrap::AsyncReset(const FunctionCallbackInfo& args) { void AsyncWrap::GetProviderType(const FunctionCallbackInfo& args) { AsyncWrap* wrap; args.GetReturnValue().Set(AsyncWrap::PROVIDER_NONE); - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); args.GetReturnValue().Set(wrap->provider_type()); } diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index e129cc57b5..2998022387 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1404,7 +1404,7 @@ template static void Query(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ChannelWrap* channel; - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); CHECK_EQ(false, args.IsConstructCall()); CHECK(args[0]->IsObject()); @@ -1664,7 +1664,7 @@ void GetNameInfo(const FunctionCallbackInfo& args) { void GetServers(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ChannelWrap* channel; - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); Local server_array = Array::New(env->isolate()); @@ -1702,7 +1702,7 @@ void GetServers(const FunctionCallbackInfo& args) { void SetServers(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ChannelWrap* channel; - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); if (channel->active_query_count()) { return args.GetReturnValue().Set(DNS_ESETSRVPENDING); @@ -1783,7 +1783,7 @@ void SetServers(const FunctionCallbackInfo& args) { void SetLocalAddress(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ChannelWrap* channel; - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); CHECK_EQ(args.Length(), 2); CHECK(args[0]->IsString()); @@ -1846,7 +1846,7 @@ void SetLocalAddress(const FunctionCallbackInfo& args) { void Cancel(const FunctionCallbackInfo& args) { ChannelWrap* channel; - ASSIGN_OR_RETURN_UNWRAP(&channel, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&channel, args.This()); TRACE_EVENT_INSTANT0(TRACING_CATEGORY_NODE2(dns, native), "cancel", TRACE_EVENT_SCOPE_THREAD); diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc index 67cd4f2adf..4f0637f951 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc @@ -448,7 +448,7 @@ void CipherBase::Init(const char* cipher_type, void CipherBase::Init(const FunctionCallbackInfo& args) { CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); Environment* env = Environment::GetCurrent(args); CHECK_GE(args.Length(), 3); @@ -520,7 +520,7 @@ void CipherBase::InitIv(const char* cipher_type, void CipherBase::InitIv(const FunctionCallbackInfo& args) { CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); Environment* env = cipher->env(); CHECK_GE(args.Length(), 4); @@ -655,7 +655,7 @@ bool CipherBase::IsAuthenticatedMode() const { void CipherBase::GetAuthTag(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); // Only callable after Final and if encrypting. if (cipher->ctx_ || @@ -671,7 +671,7 @@ void CipherBase::GetAuthTag(const FunctionCallbackInfo& args) { void CipherBase::SetAuthTag(const FunctionCallbackInfo& args) { CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); Environment* env = Environment::GetCurrent(args); if (!cipher->ctx_ || @@ -784,7 +784,7 @@ bool CipherBase::SetAAD( void CipherBase::SetAAD(const FunctionCallbackInfo& args) { CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); Environment* env = Environment::GetCurrent(args); CHECK_EQ(args.Length(), 2); @@ -897,7 +897,7 @@ bool CipherBase::SetAutoPadding(bool auto_padding) { void CipherBase::SetAutoPadding(const FunctionCallbackInfo& args) { CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue()); args.GetReturnValue().Set(b); // Possibly report invalid state failure @@ -972,7 +972,7 @@ void CipherBase::Final(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CipherBase* cipher; - ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cipher, args.This()); if (cipher->ctx_ == nullptr) return THROW_ERR_CRYPTO_INVALID_STATE(env); diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index e26e64834b..09629da161 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -422,7 +422,7 @@ void SecureContext::New(const FunctionCallbackInfo& args) { void SecureContext::Init(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); CHECK_EQ(args.Length(), 3); @@ -595,7 +595,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); // Private key argument is mandatory @@ -626,7 +626,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo& args) { void SecureContext::SetSigalgs(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); ClearErrorOnReturn clear_error_on_return; @@ -644,7 +644,7 @@ void SecureContext::SetEngineKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_EQ(args.Length(), 2); @@ -707,7 +707,7 @@ void SecureContext::SetCert(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); // Certificate argument is mandatory @@ -734,7 +734,7 @@ void SecureContext::AddCACert(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); // CA certificate argument is mandatory @@ -771,7 +771,7 @@ void SecureContext::AddCRL(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); // CRL argument is mandatory @@ -790,7 +790,7 @@ void SecureContext::SetRootCerts() { void SecureContext::AddRootCerts(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); sc->SetRootCerts(); } @@ -798,7 +798,7 @@ void SecureContext::SetCipherSuites(const FunctionCallbackInfo& args) { // BoringSSL doesn't allow API config of TLS1.3 cipher suites. #ifndef OPENSSL_IS_BORINGSSL SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); ClearErrorOnReturn clear_error_on_return; @@ -813,7 +813,7 @@ void SecureContext::SetCipherSuites(const FunctionCallbackInfo& args) { void SecureContext::SetCiphers(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); ClearErrorOnReturn clear_error_on_return; @@ -837,7 +837,7 @@ void SecureContext::SetCiphers(const FunctionCallbackInfo& args) { void SecureContext::SetECDHCurve(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); CHECK_GE(args.Length(), 1); // ECDH curve name argument is mandatory @@ -899,7 +899,7 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsInt32()); @@ -911,7 +911,7 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsInt32()); @@ -923,7 +923,7 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_EQ(args.Length(), 0); @@ -934,7 +934,7 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_EQ(args.Length(), 0); @@ -946,7 +946,7 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { void SecureContext::SetOptions(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); CHECK(args[0]->IsNumber()); @@ -960,7 +960,7 @@ void SecureContext::SetOptions(const FunctionCallbackInfo& args) { void SecureContext::SetSessionIdContext( const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); CHECK_GE(args.Length(), 1); @@ -992,7 +992,7 @@ void SecureContext::SetSessionIdContext( void SecureContext::SetSessionTimeout(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); CHECK_GE(args.Length(), 1); CHECK(args[0]->IsInt32()); @@ -1004,7 +1004,7 @@ void SecureContext::SetSessionTimeout(const FunctionCallbackInfo& args) { void SecureContext::Close(const FunctionCallbackInfo& args) { SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); sc->Reset(); } @@ -1016,7 +1016,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { bool ret = false; SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); ClearErrorOnReturn clear_error_on_return; if (args.Length() < 1) { @@ -1125,7 +1125,7 @@ void SecureContext::SetClientCertEngine( CHECK(args[0]->IsString()); SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); MarkPopErrorOnReturn mark_pop_error_on_return; @@ -1162,7 +1162,7 @@ void SecureContext::SetClientCertEngine( void SecureContext::GetTicketKeys(const FunctionCallbackInfo& args) { SecureContext* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); Local buff; if (!Buffer::New(wrap->env(), 48).ToLocal(&buff)) @@ -1177,7 +1177,7 @@ void SecureContext::GetTicketKeys(const FunctionCallbackInfo& args) { void SecureContext::SetTicketKeys(const FunctionCallbackInfo& args) { SecureContext* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_GE(args.Length(), 1); // Ticket keys argument is mandatory CHECK(args[0]->IsArrayBufferView()); @@ -1197,7 +1197,7 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo& args) { void SecureContext::EnableTicketKeyCallback( const FunctionCallbackInfo& args) { SecureContext* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); SSL_CTX_set_tlsext_ticket_key_cb(wrap->ctx_.get(), TicketKeyCallback); } @@ -1351,7 +1351,7 @@ void SecureContext::CtxGetter(const FunctionCallbackInfo& info) { template void SecureContext::GetCertificate(const FunctionCallbackInfo& args) { SecureContext* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); Environment* env = wrap->env(); X509* cert; diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc index b4447102a8..dac37f52b9 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc @@ -292,7 +292,7 @@ void DiffieHellman::GenerateKeys(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); DiffieHellman* diffieHellman; - ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.This()); if (!DH_generate_key(diffieHellman->dh_.get())) { return ThrowCryptoError(env, ERR_get_error(), "Key generation failed"); @@ -327,7 +327,7 @@ void DiffieHellman::GetField(const FunctionCallbackInfo& args, Environment* env = Environment::GetCurrent(args); DiffieHellman* dh; - ASSIGN_OR_RETURN_UNWRAP(&dh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&dh, args.This()); const BIGNUM* num = get_field(dh->dh_.get()); if (num == nullptr) @@ -388,7 +388,7 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); DiffieHellman* diffieHellman; - ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.This()); ClearErrorOnReturn clear_error_on_return; @@ -447,7 +447,7 @@ void DiffieHellman::SetKey(const FunctionCallbackInfo& args, int (*set_field)(DH*, BIGNUM*), const char* what) { Environment* env = Environment::GetCurrent(args); DiffieHellman* dh; - ASSIGN_OR_RETURN_UNWRAP(&dh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&dh, args.This()); CHECK_EQ(args.Length(), 1); ArrayBufferOrViewContents buf(args[0]); if (UNLIKELY(!buf.CheckSizeInt32())) @@ -473,7 +473,7 @@ void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo& args) { HandleScope scope(args.GetIsolate()); DiffieHellman* diffieHellman; - ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&diffieHellman, args.This()); args.GetReturnValue().Set(diffieHellman->verifyError_); } diff --git a/src/crypto/crypto_ec.cc b/src/crypto/crypto_ec.cc index 74656211ab..e8653c7db8 100644 --- a/src/crypto/crypto_ec.cc +++ b/src/crypto/crypto_ec.cc @@ -155,7 +155,7 @@ void ECDH::GenerateKeys(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); if (!EC_KEY_generate_key(ecdh->key_.get())) return THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Failed to generate key"); @@ -196,7 +196,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo& args) { CHECK(IsAnyBufferSource(args[0])); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); MarkPopErrorOnReturn mark_pop_error_on_return; @@ -240,7 +240,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 1); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); const EC_GROUP* group = EC_KEY_get0_group(ecdh->key_.get()); const EC_POINT* pub = EC_KEY_get0_public_key(ecdh->key_.get()); @@ -263,7 +263,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); const BIGNUM* b = EC_KEY_get0_private_key(ecdh->key_.get()); if (b == nullptr) @@ -289,7 +289,7 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); ArrayBufferOrViewContents priv_buffer(args[0]); if (UNLIKELY(!priv_buffer.CheckSizeInt32())) @@ -345,7 +345,7 @@ void ECDH::SetPublicKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ECDH* ecdh; - ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ecdh, args.This()); CHECK(IsAnyBufferSource(args[0])); diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index 46086018b6..09ed200299 100644 --- a/src/crypto/crypto_hash.cc +++ b/src/crypto/crypto_hash.cc @@ -378,7 +378,7 @@ void Hash::HashDigest(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Hash* hash; - ASSIGN_OR_RETURN_UNWRAP(&hash, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&hash, args.This()); enum encoding encoding = BUFFER; if (args.Length() >= 1) { diff --git a/src/crypto/crypto_hmac.cc b/src/crypto/crypto_hmac.cc index b101d5c7b0..86315374fd 100644 --- a/src/crypto/crypto_hmac.cc +++ b/src/crypto/crypto_hmac.cc @@ -85,7 +85,7 @@ void Hmac::HmacInit(const char* hash_type, const char* key, int key_len) { void Hmac::HmacInit(const FunctionCallbackInfo& args) { Hmac* hmac; - ASSIGN_OR_RETURN_UNWRAP(&hmac, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&hmac, args.This()); Environment* env = hmac->env(); const node::Utf8Value hash_type(env->isolate(), args[0]); @@ -114,7 +114,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Hmac* hmac; - ASSIGN_OR_RETURN_UNWRAP(&hmac, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&hmac, args.This()); enum encoding encoding = BUFFER; if (args.Length() >= 1) { diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index ce28ec8f37..35474c31bf 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -969,7 +969,7 @@ KeyObjectHandle::KeyObjectHandle(Environment* env, void KeyObjectHandle::Init(const FunctionCallbackInfo& args) { KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); MarkPopErrorOnReturn mark_pop_error_on_return; CHECK(args[0]->IsInt32()); @@ -1013,7 +1013,7 @@ void KeyObjectHandle::Init(const FunctionCallbackInfo& args) { void KeyObjectHandle::InitJWK(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); MarkPopErrorOnReturn mark_pop_error_on_return; // The argument must be a JavaScript object that we will inspect @@ -1052,7 +1052,7 @@ void KeyObjectHandle::InitJWK(const FunctionCallbackInfo& args) { void KeyObjectHandle::InitECRaw(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); CHECK(args[0]->IsString()); Utf8Value name(env->isolate(), args[0]); @@ -1090,7 +1090,7 @@ void KeyObjectHandle::InitECRaw(const FunctionCallbackInfo& args) { void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); CHECK(args[0]->IsString()); Utf8Value name(env->isolate(), args[0]); @@ -1132,7 +1132,7 @@ void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo& args) { void KeyObjectHandle::Equals(const FunctionCallbackInfo& args) { KeyObjectHandle* self_handle; KeyObjectHandle* arg_handle; - ASSIGN_OR_RETURN_UNWRAP(&self_handle, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&self_handle, args.This()); ASSIGN_OR_RETURN_UNWRAP(&arg_handle, args[0].As()); std::shared_ptr key = self_handle->Data(); std::shared_ptr key2 = arg_handle->Data(); @@ -1180,7 +1180,7 @@ void KeyObjectHandle::Equals(const FunctionCallbackInfo& args) { void KeyObjectHandle::GetKeyDetail(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); CHECK(args[0]->IsObject()); @@ -1233,7 +1233,7 @@ Local KeyObjectHandle::GetAsymmetricKeyType() const { void KeyObjectHandle::GetAsymmetricKeyType( const FunctionCallbackInfo& args) { KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); args.GetReturnValue().Set(key->GetAsymmetricKeyType()); } @@ -1261,7 +1261,7 @@ bool KeyObjectHandle::CheckEcKeyData() const { void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo& args) { KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); args.GetReturnValue().Set(key->CheckEcKeyData()); } @@ -1269,14 +1269,14 @@ void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo& args) { void KeyObjectHandle::GetSymmetricKeySize( const FunctionCallbackInfo& args) { KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); args.GetReturnValue().Set( static_cast(key->Data()->GetSymmetricKeySize())); } void KeyObjectHandle::Export(const FunctionCallbackInfo& args) { KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); KeyType type = key->Data()->GetKeyType(); @@ -1326,7 +1326,7 @@ void KeyObjectHandle::ExportJWK( const v8::FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); KeyObjectHandle* key; - ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&key, args.This()); CHECK(args[0]->IsObject()); CHECK(args[1]->IsBoolean()); diff --git a/src/crypto/crypto_sig.cc b/src/crypto/crypto_sig.cc index ab020efbae..3441d7e771 100644 --- a/src/crypto/crypto_sig.cc +++ b/src/crypto/crypto_sig.cc @@ -371,7 +371,7 @@ void Sign::New(const FunctionCallbackInfo& args) { void Sign::SignInit(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Sign* sign; - ASSIGN_OR_RETURN_UNWRAP(&sign, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sign, args.This()); const node::Utf8Value sign_type(args.GetIsolate(), args[0]); crypto::CheckThrow(env, sign->Init(*sign_type)); @@ -414,7 +414,7 @@ Sign::SignResult Sign::SignFinal( void Sign::SignFinal(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Sign* sign; - ASSIGN_OR_RETURN_UNWRAP(&sign, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&sign, args.This()); ClearErrorOnReturn clear_error_on_return; @@ -492,7 +492,7 @@ void Verify::New(const FunctionCallbackInfo& args) { void Verify::VerifyInit(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Verify* verify; - ASSIGN_OR_RETURN_UNWRAP(&verify, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&verify, args.This()); const node::Utf8Value verify_type(args.GetIsolate(), args[0]); crypto::CheckThrow(env, verify->Init(*verify_type)); @@ -545,7 +545,7 @@ void Verify::VerifyFinal(const FunctionCallbackInfo& args) { ClearErrorOnReturn clear_error_on_return; Verify* verify; - ASSIGN_OR_RETURN_UNWRAP(&verify, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&verify, args.This()); unsigned int offset = 0; ManagedEVPPKey pkey = diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index 5fb66d4e49..9fb567f89c 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -506,7 +506,7 @@ void TLSWrap::Wrap(const FunctionCallbackInfo& args) { void TLSWrap::Receive(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); ArrayBufferViewContents buffer(args[0]); const char* data = buffer.data(); @@ -528,7 +528,7 @@ void TLSWrap::Receive(const FunctionCallbackInfo& args) { void TLSWrap::Start(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK(!wrap->started_); wrap->started_ = true; @@ -1155,7 +1155,7 @@ int TLSWrap::DoShutdown(ShutdownWrap* req_wrap) { void TLSWrap::SetVerifyMode(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_EQ(args.Length(), 2); CHECK(args[0]->IsBoolean()); @@ -1187,7 +1187,7 @@ void TLSWrap::SetVerifyMode(const FunctionCallbackInfo& args) { void TLSWrap::EnableSessionCallbacks(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_NOT_NULL(wrap->ssl_); wrap->enable_session_callbacks(); @@ -1203,7 +1203,7 @@ void TLSWrap::EnableSessionCallbacks(const FunctionCallbackInfo& args) { void TLSWrap::EnableKeylogCallback(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK(wrap->sc_); wrap->sc_->SetKeylogCallback(KeylogCallback); } @@ -1220,7 +1220,7 @@ void TLSWrap::EnableKeylogCallback(const FunctionCallbackInfo& args) { void TLSWrap::EnableTrace(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); #if HAVE_SSL_TRACE if (wrap->ssl_) { @@ -1243,7 +1243,7 @@ void TLSWrap::EnableTrace(const FunctionCallbackInfo& args) { void TLSWrap::DestroySSL(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->Destroy(); Debug(wrap, "DestroySSL() finished"); } @@ -1272,7 +1272,7 @@ void TLSWrap::Destroy() { void TLSWrap::EnableCertCb(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->WaitForCertCb(OnClientHelloParseEnd, wrap); } @@ -1289,7 +1289,7 @@ void TLSWrap::OnClientHelloParseEnd(void* arg) { void TLSWrap::EnableALPNCb(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->alpn_callback_enabled_ = true; SSL* ssl = wrap->ssl_.get(); @@ -1301,7 +1301,7 @@ void TLSWrap::GetServername(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_NOT_NULL(wrap->ssl_); @@ -1317,7 +1317,7 @@ void TLSWrap::SetServername(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsString()); @@ -1382,7 +1382,7 @@ int TLSWrap::SetCACerts(SecureContext* sc) { void TLSWrap::SetPskIdentityHint(const FunctionCallbackInfo& args) { TLSWrap* p; - ASSIGN_OR_RETURN_UNWRAP(&p, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&p, args.This()); CHECK_NOT_NULL(p->ssl_); Environment* env = p->env(); @@ -1399,7 +1399,7 @@ void TLSWrap::SetPskIdentityHint(const FunctionCallbackInfo& args) { void TLSWrap::EnablePskCallback(const FunctionCallbackInfo& args) { TLSWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK_NOT_NULL(wrap->ssl_); SSL_set_psk_server_callback(wrap->ssl_.get(), PskServerCallback); @@ -1533,7 +1533,7 @@ void TLSWrap::MemoryInfo(MemoryTracker* tracker) const { void TLSWrap::CertCbDone(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); CHECK(w->is_waiting_cert_cb() && w->cert_cb_running_); @@ -1578,7 +1578,7 @@ void TLSWrap::CertCbDone(const FunctionCallbackInfo& args) { void TLSWrap::SetALPNProtocols(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); if (args.Length() < 1 || !Buffer::HasInstance(args[0])) return env->ThrowTypeError("Must give a Buffer as first argument"); @@ -1624,7 +1624,7 @@ void TLSWrap::SetKeyCert(const FunctionCallbackInfo& args) { void TLSWrap::GetPeerCertificate(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); bool abbreviated = args.Length() < 1 || !args[0]->IsTrue(); @@ -1640,7 +1640,7 @@ void TLSWrap::GetPeerCertificate(const FunctionCallbackInfo& args) { void TLSWrap::GetPeerX509Certificate(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); X509Certificate::GetPeerCertificateFlag flag = w->is_server() @@ -1654,7 +1654,7 @@ void TLSWrap::GetPeerX509Certificate(const FunctionCallbackInfo& args) { void TLSWrap::GetCertificate(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); Local ret; @@ -1664,7 +1664,7 @@ void TLSWrap::GetCertificate(const FunctionCallbackInfo& args) { void TLSWrap::GetX509Certificate(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); Local ret; if (X509Certificate::GetCert(env, w->ssl_).ToLocal(&ret)) @@ -1675,7 +1675,7 @@ void TLSWrap::GetFinished(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); // We cannot just pass nullptr to SSL_get_finished() // because it would further be propagated to memcpy(), @@ -1706,7 +1706,7 @@ void TLSWrap::GetPeerFinished(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); // We cannot just pass nullptr to SSL_get_peer_finished() // because it would further be propagated to memcpy(), @@ -1737,7 +1737,7 @@ void TLSWrap::GetSession(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); SSL_SESSION* sess = SSL_get_session(w->ssl_.get()); if (sess == nullptr) @@ -1766,7 +1766,7 @@ void TLSWrap::SetSession(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); if (args.Length() < 1) return THROW_ERR_MISSING_ARGS(env, "Session argument is mandatory"); @@ -1783,7 +1783,7 @@ void TLSWrap::SetSession(const FunctionCallbackInfo& args) { void TLSWrap::IsSessionReused(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); bool yes = SSL_session_reused(w->ssl_.get()); args.GetReturnValue().Set(yes); } @@ -1791,7 +1791,7 @@ void TLSWrap::IsSessionReused(const FunctionCallbackInfo& args) { void TLSWrap::VerifyError(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); // XXX(bnoordhuis) The UNABLE_TO_GET_ISSUER_CERT error when there is no // peer certificate is questionable but it's compatible with what was @@ -1819,14 +1819,14 @@ void TLSWrap::VerifyError(const FunctionCallbackInfo& args) { void TLSWrap::GetCipher(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); args.GetReturnValue().Set( GetCipherInfo(env, w->ssl_).FromMaybe(Local())); } void TLSWrap::LoadSession(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); // TODO(@sam-github) check arg length and types in js, and CHECK in c++ if (args.Length() >= 1 && Buffer::HasInstance(args[0])) { @@ -1843,7 +1843,7 @@ void TLSWrap::LoadSession(const FunctionCallbackInfo& args) { void TLSWrap::GetSharedSigalgs(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); SSL* ssl = w->ssl_.get(); int nsig = SSL_get_shared_sigalgs(ssl, 0, nullptr, nullptr, nullptr, nullptr, @@ -1925,7 +1925,7 @@ void TLSWrap::ExportKeyingMaterial(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); uint32_t olen = args[0].As()->Value(); Utf8Value label(env->isolate(), args[1]); @@ -1964,13 +1964,13 @@ void TLSWrap::ExportKeyingMaterial(const FunctionCallbackInfo& args) { void TLSWrap::EndParser(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); w->hello_parser_.End(); } void TLSWrap::Renegotiate(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); ClearErrorOnReturn clear_error_on_return; if (SSL_renegotiate(w->ssl_.get()) != 1) return ThrowCryptoError(w->env(), ERR_get_error()); @@ -1978,7 +1978,7 @@ void TLSWrap::Renegotiate(const FunctionCallbackInfo& args) { void TLSWrap::GetTLSTicket(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); SSL_SESSION* sess = SSL_get_session(w->ssl_.get()); @@ -1998,14 +1998,14 @@ void TLSWrap::GetTLSTicket(const FunctionCallbackInfo& args) { void TLSWrap::NewSessionDone(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); w->awaiting_new_session_ = false; w->NewSessionDoneCb(); } void TLSWrap::SetOCSPResponse(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = w->env(); if (args.Length() < 1) @@ -2018,14 +2018,14 @@ void TLSWrap::SetOCSPResponse(const FunctionCallbackInfo& args) { void TLSWrap::RequestOCSP(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); SSL_set_tlsext_status_type(w->ssl_.get(), TLSEXT_STATUSTYPE_ocsp); } void TLSWrap::GetEphemeralKeyInfo(const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Environment* env = Environment::GetCurrent(args); CHECK(w->ssl_); @@ -2044,7 +2044,7 @@ void TLSWrap::GetEphemeralKeyInfo(const FunctionCallbackInfo& args) { void TLSWrap::GetProtocol(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); args.GetReturnValue().Set( OneByteString(env->isolate(), SSL_get_version(w->ssl_.get()))); } @@ -2052,7 +2052,7 @@ void TLSWrap::GetProtocol(const FunctionCallbackInfo& args) { void TLSWrap::GetALPNNegotiatedProto(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); const unsigned char* alpn_proto; unsigned int alpn_proto_len; @@ -2078,7 +2078,7 @@ void TLSWrap::GetALPNNegotiatedProto(const FunctionCallbackInfo& args) { void TLSWrap::WritesIssuedByPrevListenerDone( const FunctionCallbackInfo& args) { TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Debug(w, "WritesIssuedByPrevListenerDone is called"); w->has_active_write_issued_by_prev_listener_ = false; @@ -2103,7 +2103,7 @@ void TLSWrap::SetMaxSendFragment(const FunctionCallbackInfo& args) { CHECK(args.Length() >= 1 && args[0]->IsNumber()); Environment* env = Environment::GetCurrent(args); TLSWrap* w; - ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); int rv = SSL_set_max_send_fragment( w->ssl_.get(), args[0]->Int32Value(env->context()).FromJust()); diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h index 16d2583d66..4ba2610146 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -136,7 +136,7 @@ void Decode(const v8::FunctionCallbackInfo& args, void (*callback)(T*, const v8::FunctionCallbackInfo&, const char*, size_t)) { T* ctx; - ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&ctx, args.This()); if (args[0]->IsString()) { StringBytes::InlineDecoder decoder; @@ -417,7 +417,7 @@ class CryptoJob : public AsyncWrap, public ThreadPoolWork { Environment* env = Environment::GetCurrent(args); CryptoJob* job; - ASSIGN_OR_RETURN_UNWRAP(&job, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&job, args.This()); if (job->mode() == kCryptoJobAsync) return job->ScheduleWork(); diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc index 84f2528a28..a2fc10f3b3 100644 --- a/src/crypto/crypto_x509.cc +++ b/src/crypto/crypto_x509.cc @@ -56,7 +56,7 @@ template void Fingerprint(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); Local ret; if (GetFingerprintDigest(env, algo(), cert->get()).ToLocal(&ret)) args.GetReturnValue().Set(ret); @@ -208,7 +208,7 @@ template Property( static void ReturnPropertyThroughBIO(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); BIOPointer bio(BIO_new(BIO_s_mem())); CHECK(bio); Local ret; @@ -244,7 +244,7 @@ template Property(Environment* env, X509* cert)> static void ReturnProperty(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); Local ret; if (Property(env, cert->get()).ToLocal(&ret)) args.GetReturnValue().Set(ret); } @@ -264,7 +264,7 @@ void X509Certificate::Raw(const FunctionCallbackInfo& args) { void X509Certificate::PublicKey(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); // TODO(tniessen): consider checking X509_get_pubkey() when the // X509Certificate object is being created. @@ -283,7 +283,7 @@ void X509Certificate::PublicKey(const FunctionCallbackInfo& args) { void X509Certificate::Pem(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); BIOPointer bio(BIO_new(BIO_s_mem())); CHECK(bio); if (PEM_write_bio_X509(bio.get(), cert->get())) @@ -293,14 +293,14 @@ void X509Certificate::Pem(const FunctionCallbackInfo& args) { void X509Certificate::CheckCA(const FunctionCallbackInfo& args) { X509Certificate* cert; ClearErrorOnReturn clear_error_on_return; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); args.GetReturnValue().Set(X509_check_ca(cert->get()) == 1); } void X509Certificate::CheckHost(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsString()); // name CHECK(args[1]->IsUint32()); // flags @@ -335,7 +335,7 @@ void X509Certificate::CheckHost(const FunctionCallbackInfo& args) { void X509Certificate::CheckEmail(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsString()); // name CHECK(args[1]->IsUint32()); // flags @@ -362,7 +362,7 @@ void X509Certificate::CheckEmail(const FunctionCallbackInfo& args) { void X509Certificate::CheckIP(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsString()); // IP CHECK(args[1]->IsUint32()); // flags @@ -385,7 +385,7 @@ void X509Certificate::CheckIP(const FunctionCallbackInfo& args) { void X509Certificate::CheckIssued(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsObject()); CHECK(X509Certificate::HasInstance(env, args[0].As())); @@ -401,7 +401,7 @@ void X509Certificate::CheckIssued(const FunctionCallbackInfo& args) { void X509Certificate::CheckPrivateKey(const FunctionCallbackInfo& args) { X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsObject()); KeyObjectHandle* key; @@ -418,7 +418,7 @@ void X509Certificate::CheckPrivateKey(const FunctionCallbackInfo& args) { void X509Certificate::Verify(const FunctionCallbackInfo& args) { X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); CHECK(args[0]->IsObject()); KeyObjectHandle* key; @@ -436,7 +436,7 @@ void X509Certificate::Verify(const FunctionCallbackInfo& args) { void X509Certificate::ToLegacy(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); ClearErrorOnReturn clear_error_on_return; Local ret; if (X509ToObject(env, cert->get()).ToLocal(&ret)) @@ -445,7 +445,7 @@ void X509Certificate::ToLegacy(const FunctionCallbackInfo& args) { void X509Certificate::GetIssuerCert(const FunctionCallbackInfo& args) { X509Certificate* cert; - ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&cert, args.This()); if (cert->issuer_cert_) args.GetReturnValue().Set(cert->issuer_cert_->object()); } diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 69e2a389f9..be02d4aaa0 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -39,7 +39,7 @@ using v8::Value; void HandleWrap::Ref(const FunctionCallbackInfo& args) { HandleWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); if (IsAlive(wrap)) uv_ref(wrap->GetHandle()); @@ -48,7 +48,7 @@ void HandleWrap::Ref(const FunctionCallbackInfo& args) { void HandleWrap::Unref(const FunctionCallbackInfo& args) { HandleWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); if (IsAlive(wrap)) uv_unref(wrap->GetHandle()); @@ -57,14 +57,14 @@ void HandleWrap::Unref(const FunctionCallbackInfo& args) { void HandleWrap::HasRef(const FunctionCallbackInfo& args) { HandleWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); args.GetReturnValue().Set(HasRef(wrap)); } void HandleWrap::Close(const FunctionCallbackInfo& args) { HandleWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->Close(args[0]); } diff --git a/src/histogram.cc b/src/histogram.cc index 4f58359fe5..4dbdea9be5 100644 --- a/src/histogram.cc +++ b/src/histogram.cc @@ -165,7 +165,7 @@ void HistogramBase::MemoryInfo(MemoryTracker* tracker) const { void HistogramBase::RecordDelta(const FunctionCallbackInfo& args) { HistogramBase* histogram; - ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&histogram, args.This()); (*histogram)->RecordDelta(); } @@ -185,7 +185,7 @@ void HistogramBase::Record(const FunctionCallbackInfo& args) { if (!lossless || value < 1) return THROW_ERR_OUT_OF_RANGE(env, "value is out of range"); HistogramBase* histogram; - ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&histogram, args.This()); (*histogram)->Record(value); } @@ -204,7 +204,7 @@ void HistogramBase::FastRecord(Local receiver, void HistogramBase::Add(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); HistogramBase* histogram; - ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&histogram, args.This()); CHECK(GetConstructorTemplate(env->isolate_data())->HasInstance(args[0])); HistogramBase* other; @@ -432,7 +432,7 @@ void IntervalHistogram::OnStop() { void IntervalHistogram::Start(const FunctionCallbackInfo& args) { IntervalHistogram* histogram; - ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&histogram, args.This()); histogram->OnStart(args[0]->IsTrue() ? StartFlags::RESET : StartFlags::NONE); } @@ -444,7 +444,7 @@ void IntervalHistogram::FastStart(Local receiver, bool reset) { void IntervalHistogram::Stop(const FunctionCallbackInfo& args) { IntervalHistogram* histogram; - ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&histogram, args.This()); histogram->OnStop(); } @@ -455,67 +455,67 @@ void IntervalHistogram::FastStop(Local receiver) { } void HistogramImpl::GetCount(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); double value = static_cast((*histogram)->Count()); args.GetReturnValue().Set(value); } void HistogramImpl::GetCountBigInt(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set( BigInt::NewFromUnsigned(env->isolate(), (*histogram)->Count())); } void HistogramImpl::GetMin(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); double value = static_cast((*histogram)->Min()); args.GetReturnValue().Set(value); } void HistogramImpl::GetMinBigInt(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set(BigInt::New(env->isolate(), (*histogram)->Min())); } void HistogramImpl::GetMax(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); double value = static_cast((*histogram)->Max()); args.GetReturnValue().Set(value); } void HistogramImpl::GetMaxBigInt(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set(BigInt::New(env->isolate(), (*histogram)->Max())); } void HistogramImpl::GetMean(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set((*histogram)->Mean()); } void HistogramImpl::GetExceeds(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); double value = static_cast((*histogram)->Exceeds()); args.GetReturnValue().Set(value); } void HistogramImpl::GetExceedsBigInt(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set( BigInt::New(env->isolate(), (*histogram)->Exceeds())); } void HistogramImpl::GetStddev(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); args.GetReturnValue().Set((*histogram)->Stddev()); } void HistogramImpl::GetPercentile(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); CHECK(args[0]->IsNumber()); double percentile = args[0].As()->Value(); double value = static_cast((*histogram)->Percentile(percentile)); @@ -525,7 +525,7 @@ void HistogramImpl::GetPercentile(const FunctionCallbackInfo& args) { void HistogramImpl::GetPercentileBigInt( const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); CHECK(args[0]->IsNumber()); double percentile = args[0].As()->Value(); int64_t value = (*histogram)->Percentile(percentile); @@ -534,7 +534,7 @@ void HistogramImpl::GetPercentileBigInt( void HistogramImpl::GetPercentiles(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { @@ -548,7 +548,7 @@ void HistogramImpl::GetPercentiles(const FunctionCallbackInfo& args) { void HistogramImpl::GetPercentilesBigInt( const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { @@ -560,7 +560,7 @@ void HistogramImpl::GetPercentilesBigInt( } void HistogramImpl::DoReset(const FunctionCallbackInfo& args) { - HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); + HistogramImpl* histogram = HistogramImpl::FromJSObject(args.This()); (*histogram)->Reset(); } diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index fec9de840e..5700f8c5ef 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -131,14 +131,14 @@ class JSBindingsConnection : public BaseObject { static void Disconnect(const FunctionCallbackInfo& info) { JSBindingsConnection* session; - ASSIGN_OR_RETURN_UNWRAP(&session, info.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&session, info.This()); session->Disconnect(); } static void Dispatch(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); JSBindingsConnection* session; - ASSIGN_OR_RETURN_UNWRAP(&session, info.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&session, info.This()); CHECK(info[0]->IsString()); if (session->session_) { @@ -207,11 +207,8 @@ void InspectorConsoleCall(const FunctionCallbackInfo& info) { CHECK(inspector_method->IsFunction()); if (!env->is_in_inspector_console_call()) { env->set_is_in_inspector_console_call(true); - MaybeLocal ret = - inspector_method.As()->Call(context, - info.Holder(), - call_args.length(), - call_args.out()); + MaybeLocal ret = inspector_method.As()->Call( + context, info.This(), call_args.length(), call_args.out()); env->set_is_in_inspector_console_call(false); if (ret.IsEmpty()) return; @@ -220,10 +217,8 @@ void InspectorConsoleCall(const FunctionCallbackInfo& info) { Local node_method = info[1]; CHECK(node_method->IsFunction()); - USE(node_method.As()->Call(context, - info.Holder(), - call_args.length(), - call_args.out())); + USE(node_method.As()->Call( + context, info.This(), call_args.length(), call_args.out())); } static void* GetAsyncTask(int64_t asyncId) { diff --git a/src/js_stream.cc b/src/js_stream.cc index af10fcac39..0d13066f54 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -163,7 +163,7 @@ void JSStream::Finish(const FunctionCallbackInfo& args) { void JSStream::ReadBuffer(const FunctionCallbackInfo& args) { JSStream* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); ArrayBufferViewContents buffer(args[0]); const char* data = buffer.data(); @@ -187,7 +187,7 @@ void JSStream::ReadBuffer(const FunctionCallbackInfo& args) { void JSStream::EmitEOF(const FunctionCallbackInfo& args) { JSStream* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->EmitRead(UV_EOF); } diff --git a/src/js_udp_wrap.cc b/src/js_udp_wrap.cc index ed2238a3b5..a4f183025d 100644 --- a/src/js_udp_wrap.cc +++ b/src/js_udp_wrap.cc @@ -137,12 +137,12 @@ SocketAddress JSUDPWrap::GetSockName() { void JSUDPWrap::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CHECK(args.IsConstructCall()); - new JSUDPWrap(env, args.Holder()); + new JSUDPWrap(env, args.This()); } void JSUDPWrap::EmitReceived(const FunctionCallbackInfo& args) { JSUDPWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); Environment* env = wrap->env(); ArrayBufferViewContents buffer(args[0]); @@ -176,7 +176,7 @@ void JSUDPWrap::EmitReceived(const FunctionCallbackInfo& args) { void JSUDPWrap::OnSendDone(const FunctionCallbackInfo& args) { JSUDPWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); CHECK(args[0]->IsObject()); CHECK(args[1]->IsInt32()); @@ -189,7 +189,7 @@ void JSUDPWrap::OnSendDone(const FunctionCallbackInfo& args) { void JSUDPWrap::OnAfterBind(const FunctionCallbackInfo& args) { JSUDPWrap* wrap; - ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrap, args.This()); wrap->listener()->OnAfterBind(); } diff --git a/src/node_blob.cc b/src/node_blob.cc index af6a443bbe..6c88134468 100644 --- a/src/node_blob.cc +++ b/src/node_blob.cc @@ -233,7 +233,7 @@ void Blob::New(const FunctionCallbackInfo& args) { void Blob::GetReader(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Blob* blob; - ASSIGN_OR_RETURN_UNWRAP(&blob, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&blob, args.This()); BaseObjectPtr reader = Blob::Reader::Create(env, BaseObjectPtr(blob)); @@ -243,7 +243,7 @@ void Blob::GetReader(const FunctionCallbackInfo& args) { void Blob::ToSlice(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Blob* blob; - ASSIGN_OR_RETURN_UNWRAP(&blob, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&blob, args.This()); CHECK(args[0]->IsUint32()); CHECK(args[1]->IsUint32()); size_t start = args[0].As()->Value(); @@ -312,7 +312,7 @@ BaseObjectPtr Blob::Reader::Create(Environment* env, void Blob::Reader::Pull(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Blob::Reader* reader; - ASSIGN_OR_RETURN_UNWRAP(&reader, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&reader, args.This()); CHECK(args[0]->IsFunction()); Local fn = args[0].As(); diff --git a/src/node_contextify.cc b/src/node_contextify.cc index d873792ab9..e6111a0ad4 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -984,7 +984,7 @@ void ContextifyScript::CreateCachedData( const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ContextifyScript* wrapped_script; - ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This()); Local unbound_script = PersistentToLocal::Default(env->isolate(), wrapped_script->script_); std::unique_ptr cached_data( @@ -1004,7 +1004,7 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); ContextifyScript* wrapped_script; - ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder()); + ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This()); CHECK_EQ(args.Length(), 5); CHECK(args[0]->IsObject() || args[0]->IsNull()); @@ -1065,7 +1065,7 @@ bool ContextifyScript::EvalMachine(Local context, if (!env->can_call_into_js()) return false; - if (!ContextifyScript::InstanceOf(env, args.Holder())) { + if (!ContextifyScript::InstanceOf(env, args.This())) { THROW_ERR_INVALID_THIS( env, "Script methods can only be called on script instances."); @@ -1075,7 +1075,7 @@ bool ContextifyScript::EvalMachine(Local context, TryCatchScope try_catch(env); Isolate::SafeForTerminationScope safe_for_termination(env->isolate()); ContextifyScript* wrapped_script; - ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder(), false); + ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false); Local unbound_script = PersistentToLocal::Default(env->isolate(), wrapped_script->script_); Local