diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 8595dc6fb83058..d9af0b4fa2f1b9 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -338,19 +338,6 @@ void SecureContext::Initialize(Environment* env, Local target) { t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"), Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex)); - Local ctx_getter_templ = - FunctionTemplate::New(env->isolate(), - CtxGetter, - env->as_external(), - Signature::New(env->isolate(), t)); - - - t->PrototypeTemplate()->SetAccessorProperty( - FIXED_ONE_BYTE_STRING(env->isolate(), "_external"), - ctx_getter_templ, - Local(), - static_cast(ReadOnly | DontDelete)); - target->Set(secureContextString, t->GetFunction()); env->set_secure_context_constructor_template(t); } @@ -1350,14 +1337,6 @@ int SecureContext::TicketCompatibilityCallback(SSL* ssl, } -void SecureContext::CtxGetter(const FunctionCallbackInfo& info) { - SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, info.This()); - Local ext = External::New(info.GetIsolate(), sc->ctx_); - info.GetReturnValue().Set(ext); -} - - template void SecureContext::GetCertificate(const FunctionCallbackInfo& args) { SecureContext* wrap; diff --git a/src/node_crypto.h b/src/node_crypto.h index 2f7c904ee9212d..31806b04434702 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -148,7 +148,6 @@ class SecureContext : public BaseObject { const v8::FunctionCallbackInfo& args); static void EnableTicketKeyCallback( const v8::FunctionCallbackInfo& args); - static void CtxGetter(const v8::FunctionCallbackInfo& info); template static void GetCertificate(const v8::FunctionCallbackInfo& args); diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index 713be7eac203a6..064ef844c38e6c 100644 --- a/test/parallel/test-accessor-properties.js +++ b/test/parallel/test-accessor-properties.js @@ -1,6 +1,6 @@ 'use strict'; -const common = require('../common'); +require('../common'); // This tests that the accessor properties do not raise assertions // when called with incompatible receivers. @@ -50,19 +50,4 @@ const UDP = process.binding('udp_wrap').UDP; typeof Object.getOwnPropertyDescriptor(UDP.prototype, 'fd'), 'object' ); - - if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check - // There are accessor properties in crypto too - const crypto = process.binding('crypto'); - - assert.throws(() => { - crypto.SecureContext.prototype._external; - }, TypeError); - - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor( - crypto.SecureContext.prototype, '_external'), - 'object' - ); - } } diff --git a/test/parallel/test-tls-external-accessor.js b/test/parallel/test-tls-external-accessor.js deleted file mode 100644 index 33d371923a600c..00000000000000 --- a/test/parallel/test-tls-external-accessor.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const common = require('../common'); -if (!common.hasCrypto) - common.skip('missing crypto'); - -const assert = require('assert'); -const tls = require('tls'); - -// Ensure accessing ._external doesn't hit an assert in the accessor method. -{ - const pctx = tls.createSecureContext().context; - const cctx = Object.create(pctx); - assert.throws(() => cctx._external, TypeError); - pctx._external; -} -{ - const pctx = tls.createSecurePair().credentials.context; - const cctx = Object.create(pctx); - assert.throws(() => cctx._external, TypeError); - pctx._external; -}