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 @@ -1907,7 +1907,7 @@ def configure_library(lib, output, pkgname=None):
19071907
19081908
19091909def configure_v8 (o , configs ):
1910- set_configuration_variable (configs , 'v8_enable_v8_checks' , release = 1 , debug = 0 )
1910+ set_configuration_variable (configs , 'v8_enable_v8_checks' , release = 0 , debug = 1 )
19111911
19121912 o ['variables' ]['v8_enable_webassembly' ] = 0 if options .v8_lite_mode else 1
19131913 o ['variables' ]['v8_enable_javascript_promise_hooks' ] = 1
@@ -2537,11 +2537,10 @@ def make_bin_override():
25372537del configurations ['Release' ]['variables' ]
25382538config_debug_vars = configurations ['Debug' ]['variables' ]
25392539del configurations ['Debug' ]['variables' ]
2540- output ['conditions' ].append (['build_type=="Release"' , {
2541- 'variables' : config_release_vars ,
2542- }, {
2543- 'variables' : config_debug_vars ,
2544- }])
2540+ if options .debug :
2541+ variables = variables | config_debug_vars
2542+ else :
2543+ variables = variables | config_release_vars
25452544
25462545# make_global_settings should be a root level element too
25472546if 'make_global_settings' in output :
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 99#include " quic/guard.h"
1010#include " simdutf.h"
1111#include " util-inl.h"
12+ #include " v8-value.h"
1213
1314namespace node {
1415namespace builtins {
@@ -441,7 +442,7 @@ void BuiltinLoader::SaveCodeCache(const std::string& id, Local<Data> data) {
441442 new_cached_data.reset (
442443 ScriptCompiler::CreateCodeCache (mod->GetUnboundModuleScript ()));
443444 } else {
444- Local<Function> fun = data.As <Function>();
445+ Local<Function> fun = data.As <Value>(). As < Function>();
445446 new_cached_data.reset (ScriptCompiler::CreateCodeCacheForFunction (fun));
446447 }
447448 CHECK_NOT_NULL (new_cached_data);
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