| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,6 +62,25 @@ struct ToStringHelper { | |||
| 62 | 62 | static std::string Convert(const std::string& value) { return value; } | |
| 63 | 63 | static std::string_view Convert(std::string_view value) { return value; } | |
| 64 | 64 | static std::string Convert(bool value) { return value ? "true" : "false"; } | |
| 65 | + | ||
| 66 | + static std::string Convert(v8::Local<v8::Value> value) { | ||
| 67 | + v8::Isolate* isolate = v8::Isolate::GetCurrent(); | ||
| 68 | + if (value->IsString()) { | ||
| 69 | + Utf8Value utf8_value(isolate, value); | ||
| 70 | + return SPrintF("\"%s\"", utf8_value.ToString()); | ||
| 71 | + } | ||
| 72 | + v8::MaybeLocal<v8::String> maybe_detail = | ||
| 73 | + value->ToDetailString(isolate->GetCurrentContext()); | ||
| 74 | + v8::Local<v8::String> detail; | ||
| 75 | + if (!maybe_detail.ToLocal(&detail)) { | ||
| 76 | + // This will only occur when terminating. No exception is expected | ||
| 77 | + // with `ToDetailString`. | ||
| 78 | + return "<Unable to stringify v8::Value>"; | ||
| 79 | + } | ||
| 80 | + Utf8Value utf8_value(isolate, detail); | ||
| 81 | + return utf8_value.ToString(); | ||
| 82 | + } | ||
| 83 | + | ||
| 65 | 84 | template <unsigned BASE_BITS, | |
| 66 | 85 | typename T, | |
| 67 | 86 | typename = std::enable_if_t<std::is_integral_v<T>>> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,7 @@ void NODE_EXTERN_PRIVATE FWrite(FILE* file, const std::string& str); | |||
| 47 | 47 | V(BOOTSTRAP) \ | |
| 48 | 48 | V(CRYPTO) \ | |
| 49 | 49 | V(COMPILE_CACHE) \ | |
| 50 | + V(CONTEXTIFY) \ | ||
| 50 | 51 | V(DIAGNOSTICS) \ | |
| 51 | 52 | V(HUGEPAGES) \ | |
| 52 | 53 | V(INSPECTOR_SERVER) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | #include "base_object-inl.h" | |
| 25 | 25 | #include "cppgc/allocation.h" | |
| 26 | + #include "debug_utils-inl.h" | ||
| 26 | 27 | #include "memory_tracker-inl.h" | |
| 27 | 28 | #include "module_wrap.h" | |
| 28 | 29 | #include "node_context_data.h" | |
@@ -484,6 +485,9 @@ Intercepted ContextifyContext::PropertyQueryCallback( | |||
| 484 | 485 | return Intercepted::kNo; | |
| 485 | 486 | } | |
| 486 | 487 | ||
| 488 | + per_process::Debug( | ||
| 489 | + DebugCategory::CONTEXTIFY, "PropertyQuery(%s)\n", property); | ||
| 490 | + | ||
| 487 | 491 | Local<Context> context = ctx->context(); | |
| 488 | 492 | Local<Object> sandbox = ctx->sandbox(); | |
| 489 | 493 | ||
@@ -530,6 +534,9 @@ Intercepted ContextifyContext::PropertyGetterCallback( | |||
| 530 | 534 | return Intercepted::kNo; | |
| 531 | 535 | } | |
| 532 | 536 | ||
| 537 | + per_process::Debug( | ||
| 538 | + DebugCategory::CONTEXTIFY, "PropertyGetter(name: %s)\n", property); | ||
| 539 | + | ||
| 533 | 540 | Local<Context> context = ctx->context(); | |
| 534 | 541 | Local<Object> sandbox = ctx->sandbox(); | |
| 535 | 542 | ||
@@ -567,6 +574,12 @@ Intercepted ContextifyContext::PropertySetterCallback( | |||
| 567 | 574 | return Intercepted::kNo; | |
| 568 | 575 | } | |
| 569 | 576 | ||
| 577 | + per_process::Debug(DebugCategory::CONTEXTIFY, | ||
| 578 | + "PropertySetter(name: %s, value: %s), use-strict(%s)\n", | ||
| 579 | + property, | ||
| 580 | + value, | ||
| 581 | + args.ShouldThrowOnError()); | ||
| 582 | + | ||
| 570 | 583 | Local<Context> context = ctx->context(); | |
| 571 | 584 | PropertyAttribute attributes = PropertyAttribute::None; | |
| 572 | 585 | bool is_declared_on_global_proxy = ctx->global_proxy() | |
@@ -655,6 +668,9 @@ Intercepted ContextifyContext::PropertyDescriptorCallback( | |||
| 655 | 668 | return Intercepted::kNo; | |
| 656 | 669 | } | |
| 657 | 670 | ||
| 671 | + per_process::Debug( | ||
| 672 | + DebugCategory::CONTEXTIFY, "PropertyDescriptor(name: %s)\n", property); | ||
| 673 | + | ||
| 658 | 674 | Local<Context> context = ctx->context(); | |
| 659 | 675 | ||
| 660 | 676 | Local<Object> sandbox = ctx->sandbox(); | |
@@ -681,6 +697,9 @@ Intercepted ContextifyContext::PropertyDefinerCallback( | |||
| 681 | 697 | return Intercepted::kNo; | |
| 682 | 698 | } | |
| 683 | 699 | ||
| 700 | + per_process::Debug( | ||
| 701 | + DebugCategory::CONTEXTIFY, "PropertyDefiner(name: %s)\n", property); | ||
| 702 | + | ||
| 684 | 703 | Local<Context> context = ctx->context(); | |
| 685 | 704 | Isolate* isolate = Isolate::GetCurrent(); | |
| 686 | 705 | ||
@@ -751,6 +770,9 @@ Intercepted ContextifyContext::PropertyDeleterCallback( | |||
| 751 | 770 | return Intercepted::kNo; | |
| 752 | 771 | } | |
| 753 | 772 | ||
| 773 | + per_process::Debug( | ||
| 774 | + DebugCategory::CONTEXTIFY, "PropertyDeleter(name: %s)\n", property); | ||
| 775 | + | ||
| 754 | 776 | Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property); | |
| 755 | 777 | ||
| 756 | 778 | if (success.FromMaybe(false)) { | |
@@ -778,6 +800,8 @@ void ContextifyContext::PropertyEnumeratorCallback( | |||
| 778 | 800 | // Still initializing | |
| 779 | 801 | if (IsStillInitializing(ctx)) return; | |
| 780 | 802 | ||
| 803 | + per_process::Debug(DebugCategory::CONTEXTIFY, "PropertyEnumerator()\n"); | ||
| 804 | + | ||
| 781 | 805 | Local<Array> properties; | |
| 782 | 806 | // Only get own named properties, exclude indices. | |
| 783 | 807 | if (!ctx->sandbox() | |
@@ -809,6 +833,9 @@ void ContextifyContext::IndexedPropertyEnumeratorCallback( | |||
| 809 | 833 | // Still initializing | |
| 810 | 834 | if (IsStillInitializing(ctx)) return; | |
| 811 | 835 | ||
| 836 | + per_process::Debug(DebugCategory::CONTEXTIFY, | ||
| 837 | + "IndexedPropertyEnumerator()\n"); | ||
| 838 | + | ||
| 812 | 839 | Local<Array> properties; | |
| 813 | 840 | ||
| 814 | 841 | // Only get own index properties. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments