diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-04-24 00:25:21 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-26 19:57:57 +0200 |
commit | 03e25b653a7ee62f4e3a03dc84c9f8de94cc938b (patch) | |
tree | 8cd23e9a8682b6cda8c266a17c4afb1bf86c8d13 | |
parent | 124875cab2ab129b0e1689c7727d5eaeab4618c2 (diff) | |
download | android-node-v8-03e25b653a7ee62f4e3a03dc84c9f8de94cc938b.tar.gz android-node-v8-03e25b653a7ee62f4e3a03dc84c9f8de94cc938b.tar.bz2 android-node-v8-03e25b653a7ee62f4e3a03dc84c9f8de94cc938b.zip |
src: remove SecureContext `_external` getter
This is unused inside Node core, so nothing good can
come from keeping it around.
PR-URL: https://github.com/nodejs/node/pull/20237
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
-rw-r--r-- | src/node_crypto.cc | 21 | ||||
-rw-r--r-- | src/node_crypto.h | 1 | ||||
-rw-r--r-- | test/parallel/test-accessor-properties.js | 17 | ||||
-rw-r--r-- | test/parallel/test-tls-external-accessor.js | 22 |
4 files changed, 1 insertions, 60 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d1e1703d2c..3e23dec38f 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -340,19 +340,6 @@ void SecureContext::Initialize(Environment* env, Local<Object> target) { t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"), Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex)); - Local<FunctionTemplate> 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<FunctionTemplate>(), - static_cast<PropertyAttribute>(ReadOnly | DontDelete)); - target->Set(secureContextString, t->GetFunction()); env->set_secure_context_constructor_template(t); } @@ -1352,14 +1339,6 @@ int SecureContext::TicketCompatibilityCallback(SSL* ssl, } -void SecureContext::CtxGetter(const FunctionCallbackInfo<Value>& info) { - SecureContext* sc; - ASSIGN_OR_RETURN_UNWRAP(&sc, info.This()); - Local<External> ext = External::New(info.GetIsolate(), sc->ctx_); - info.GetReturnValue().Set(ext); -} - - template <bool primary> void SecureContext::GetCertificate(const FunctionCallbackInfo<Value>& args) { SecureContext* wrap; diff --git a/src/node_crypto.h b/src/node_crypto.h index a706c28057..a8fe8b0d4a 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -148,7 +148,6 @@ class SecureContext : public BaseObject { const v8::FunctionCallbackInfo<v8::Value>& args); static void EnableTicketKeyCallback( const v8::FunctionCallbackInfo<v8::Value>& args); - static void CtxGetter(const v8::FunctionCallbackInfo<v8::Value>& info); template <bool primary> static void GetCertificate(const v8::FunctionCallbackInfo<v8::Value>& args); diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index 713be7eac2..064ef844c3 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 33d371923a..0000000000 --- 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; -} |