Commit a2c8da59f2e for nodejs

commit a2c8da59f2e319860985ff1275d66a6d16d611b0
Author: Mert Can Altin <mertgold60@gmail.com>
Date:   Thu Sep 24 00:41:49 2026 +0300

    test: use heapdump test for SecureContext memory tracking

    Signed-off-by: Mert Can Altin <mertgold60@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/64344
    Refs: https://github.com/nodejs/node/pull/59051
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

diff --git a/test/cctest/test_node_crypto.cc b/test/cctest/test_node_crypto.cc
index 7e6cf5f6315..6e1e687df0d 100644
--- a/test/cctest/test_node_crypto.cc
+++ b/test/cctest/test_node_crypto.cc
@@ -42,33 +42,6 @@ TEST(NodeCrypto, NewRootCertStore) {
   X509_STORE_free(store);
 }

-/*
- * This test verifies that OpenSSL memory tracking constants are properly
- * defined.
- */
-TEST(NodeCrypto, MemoryTrackingConstants) {
-  // Verify that our memory tracking constants are defined and reasonable
-  EXPECT_GT(node::crypto::kSizeOf_SSL_CTX, static_cast<size_t>(0))
-      << "SSL_CTX size constant should be positive";
-  EXPECT_GT(node::crypto::kSizeOf_X509, static_cast<size_t>(0))
-      << "X509 size constant should be positive";
-  EXPECT_GT(node::crypto::kSizeOf_EVP_MD_CTX, static_cast<size_t>(0))
-      << "EVP_MD_CTX size constant should be positive";
-
-  // Verify reasonable size ranges (basic sanity check)
-  EXPECT_LT(node::crypto::kSizeOf_SSL_CTX, static_cast<size_t>(10000))
-      << "SSL_CTX size should be reasonable";
-  EXPECT_LT(node::crypto::kSizeOf_X509, static_cast<size_t>(10000))
-      << "X509 size should be reasonable";
-  EXPECT_LT(node::crypto::kSizeOf_EVP_MD_CTX, static_cast<size_t>(1000))
-      << "EVP_MD_CTX size should be reasonable";
-
-  // Specific values we expect based on our implementation
-  EXPECT_EQ(node::crypto::kSizeOf_SSL_CTX, static_cast<size_t>(240));
-  EXPECT_EQ(node::crypto::kSizeOf_X509, static_cast<size_t>(128));
-  EXPECT_EQ(node::crypto::kSizeOf_EVP_MD_CTX, static_cast<size_t>(48));
-}
-
 TEST(NodeCrypto, TryGetIntCipherOutputLength) {
   int output_len = 0;

diff --git a/test/pummel/test-heapdump-secure-context.js b/test/pummel/test-heapdump-secure-context.js
new file mode 100644
index 00000000000..30fb7d1a157
--- /dev/null
+++ b/test/pummel/test-heapdump-secure-context.js
@@ -0,0 +1,29 @@
+'use strict';
+// This tests heap snapshot integration of SecureContext.
+
+const common = require('../common');
+
+if (!common.hasCrypto) common.skip('missing crypto');
+
+const fixtures = require('../common/fixtures');
+const {
+  createJSHeapSnapshot,
+  validateByRetainingPathFromNodes,
+} = require('../common/heap');
+const tls = require('tls');
+
+// eslint-disable-next-line no-unused-vars
+const ctx = tls.createSecureContext({
+  cert: fixtures.readKey('agent1-cert.pem'),
+  key: fixtures.readKey('agent1-key.pem'),
+});
+
+{
+  const nodes = createJSHeapSnapshot();
+  validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
+    { edge_name: 'ctx', node_name: 'Node / ctx' },
+  ]);
+  validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
+    { edge_name: 'cert', node_name: 'Node / cert' },
+  ]);
+}