◐ Shell
clean mode source ↗

src: add contextify interceptor debug logs · nodejs/node@a71a4ac

@@ -23,6 +23,7 @@

23232424

#include "base_object-inl.h"

2525

#include "cppgc/allocation.h"

26+

#include "debug_utils-inl.h"

2627

#include "memory_tracker-inl.h"

2728

#include "module_wrap.h"

2829

#include "node_context_data.h"

@@ -480,6 +481,9 @@ Intercepted ContextifyContext::PropertyQueryCallback(

480481

return Intercepted::kNo;

481482

}

482483484+

per_process::Debug(

485+

DebugCategory::CONTEXTIFY, "PropertyQuery(%s)\n", property);

486+483487

Local<Context> context = ctx->context();

484488

Local<Object> sandbox = ctx->sandbox();

485489

@@ -526,6 +530,9 @@ Intercepted ContextifyContext::PropertyGetterCallback(

526530

return Intercepted::kNo;

527531

}

528532533+

per_process::Debug(

534+

DebugCategory::CONTEXTIFY, "PropertyGetter(name: %s)\n", property);

535+529536

Local<Context> context = ctx->context();

530537

Local<Object> sandbox = ctx->sandbox();

531538

@@ -563,6 +570,12 @@ Intercepted ContextifyContext::PropertySetterCallback(

563570

return Intercepted::kNo;

564571

}

565572573+

per_process::Debug(DebugCategory::CONTEXTIFY,

574+

"PropertySetter(name: %s, value: %s), use-strict(%s)\n",

575+

property,

576+

value,

577+

args.ShouldThrowOnError());

578+566579

Local<Context> context = ctx->context();

567580

PropertyAttribute attributes = PropertyAttribute::None;

568581

bool is_declared_on_global_proxy = ctx->global_proxy()

@@ -640,6 +653,9 @@ Intercepted ContextifyContext::PropertyDescriptorCallback(

640653

return Intercepted::kNo;

641654

}

642655656+

per_process::Debug(

657+

DebugCategory::CONTEXTIFY, "PropertyDescriptor(name: %s)\n", property);

658+643659

Local<Context> context = ctx->context();

644660645661

Local<Object> sandbox = ctx->sandbox();

@@ -666,6 +682,9 @@ Intercepted ContextifyContext::PropertyDefinerCallback(

666682

return Intercepted::kNo;

667683

}

668684685+

per_process::Debug(

686+

DebugCategory::CONTEXTIFY, "PropertyDefiner(name: %s)\n", property);

687+669688

Local<Context> context = ctx->context();

670689

Isolate* isolate = context->GetIsolate();

671690

@@ -736,6 +755,9 @@ Intercepted ContextifyContext::PropertyDeleterCallback(

736755

return Intercepted::kNo;

737756

}

738757758+

per_process::Debug(

759+

DebugCategory::CONTEXTIFY, "PropertyDeleter(name: %s)\n", property);

760+739761

Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property);

740762741763

if (success.FromMaybe(false)) {

@@ -763,6 +785,8 @@ void ContextifyContext::PropertyEnumeratorCallback(

763785

// Still initializing

764786

if (IsStillInitializing(ctx)) return;

765787788+

per_process::Debug(DebugCategory::CONTEXTIFY, "PropertyEnumerator()\n");

789+766790

Local<Array> properties;

767791

// Only get own named properties, exclude indices.

768792

if (!ctx->sandbox()

@@ -794,6 +818,9 @@ void ContextifyContext::IndexedPropertyEnumeratorCallback(

794818

// Still initializing

795819

if (IsStillInitializing(ctx)) return;

796820821+

per_process::Debug(DebugCategory::CONTEXTIFY,

822+

"IndexedPropertyEnumerator()\n");

823+797824

Local<Array> properties;

798825799826

// Only get own index properties.