File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -1809,7 +1809,7 @@ def configure_library(lib, output, pkgname=None):
18091809
18101810
18111811def configure_v8 (o , configs ):
1812- set_configuration_variable (configs , 'v8_enable_v8_checks' , release = 1 , debug = 0 )
1812+ set_configuration_variable (configs , 'v8_enable_v8_checks' , release = 0 , debug = 1 )
18131813
18141814 o ['variables' ]['v8_enable_webassembly' ] = 0 if options .v8_lite_mode else 1
18151815 o ['variables' ]['v8_enable_javascript_promise_hooks' ] = 1
Original file line number Diff line number Diff line change @@ -580,7 +580,7 @@ changes:
580580
581581> Stability: 1.1 - Active development
582582
583- * ` frameCount ` {number } Optional number of frames to capture as call site objects.
583+ * ` frameCount ` {integer } Optional number of frames to capture as call site objects.
584584 ** Default:** ` 10 ` . Allowable range is between 1 and 200.
585585* ` options ` {Object} Optional
586586 * ` sourceMap ` {boolean} Reconstruct the original location in the stacktrace from the source-map.
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ const {
6666 validateString,
6767 validateOneOf,
6868 validateObject,
69+ validateInteger,
6970} = require ( 'internal/validators' ) ;
7071const {
7172 isReadableStream,
@@ -452,7 +453,7 @@ function getCallSites(frameCount = 10, options) {
452453 }
453454
454455 // Using kDefaultMaxCallStackSizeToCapture as reference
455- validateNumber ( frameCount , 'frameCount' , 1 , 200 ) ;
456+ validateInteger ( frameCount , 'frameCount' , 1 , 200 ) ;
456457 // If options.sourceMaps is true or if sourceMaps are enabled but the option.sourceMaps is not set explicitly to false
457458 if ( options . sourceMap === true || ( getOptionValue ( '--enable-source-maps' ) && options . sourceMap !== false ) ) {
458459 return mapCallSite ( binding . getCallSites ( frameCount ) ) ;
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class JSGraph : public EmbedderGraph {
8989 }
9090
9191 Node* V8Node (const Local<v8::Value>& value) override {
92- return V8Node (value. As <v8::Data>());
92+ return V8Node (v8::Local <v8::Data>(value ));
9393 }
9494
9595 Node* AddNode (std::unique_ptr<Node> node) override {
Original file line number Diff line number Diff line change 88#include " node_threadsafe_cow-inl.h"
99#include " simdutf.h"
1010#include " util-inl.h"
11+ #include " v8-value.h"
1112
1213namespace node {
1314namespace builtins {
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) {
258258 Environment* env = Environment::GetCurrent (context);
259259
260260 CHECK_EQ (args.Length (), 1 );
261- CHECK (args[0 ]->IsNumber ());
261+ CHECK (args[0 ]->IsUint32 ());
262262 const uint32_t frames = args[0 ].As <Uint32>()->Value ();
263263 CHECK (frames >= 1 && frames <= 200 );
264264
Original file line number Diff line number Diff line change 2222#ifndef SRC_UTIL_INL_H_
2323#define SRC_UTIL_INL_H_
2424
25+ #include " v8-isolate.h"
2526#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
2627
2728#include < cmath>
@@ -678,10 +679,15 @@ T FromV8Value(v8::Local<v8::Value> value) {
678679 " Type is out of unsigned integer range" );
679680 if constexpr (!loose) {
680681 CHECK (value->IsUint32 ());
682+ return static_cast <T>(value.As <v8::Uint32>()->Value ());
681683 } else {
682684 CHECK (value->IsNumber ());
685+ v8::Isolate* isolate = v8::Isolate::GetCurrent ();
686+ v8::Local<v8::Context> context = isolate->GetCurrentContext ();
687+ v8::Maybe<uint32_t > maybe = value->Uint32Value (context);
688+ CHECK (!maybe.IsNothing ());
689+ return static_cast <T>(maybe.FromJust ());
683690 }
684- return static_cast <T>(value.As <v8::Uint32>()->Value ());
685691 } else if constexpr (std::is_integral_v<T> && std::is_signed_v<T>) {
686692 static_assert (
687693 std::numeric_limits<T>::max () <= std::numeric_limits<int32_t >::max () &&
Original file line number Diff line number Diff line change @@ -31,15 +31,14 @@ const assert = require('node:assert');
3131 ) ;
3232}
3333
34- // Guarantee dot-right numbers are ignored
34+ // frameCount must be an integer
3535{
36- const callSites = getCallSites ( 3.6 ) ;
37- assert . strictEqual ( callSites . length , 3 ) ;
38- }
39-
40- {
41- const callSites = getCallSites ( 3.4 ) ;
42- assert . strictEqual ( callSites . length , 3 ) ;
36+ assert . throws ( ( ) => {
37+ const callSites = getCallSites ( 3.6 ) ;
38+ assert . strictEqual ( callSites . length , 3 ) ;
39+ } , common . expectsError ( {
40+ code : 'ERR_OUT_OF_RANGE'
41+ } ) ) ;
4342}
4443
4544{
You can’t perform that action at this time.
0 commit comments