Skip to content

Commit

Permalink
src: remove SecureContext _external getter
Browse files Browse the repository at this point in the history
This is unused inside Node core, so nothing good can
come from keeping it around.

PR-URL: #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>
  • Loading branch information
addaleax authored and BridgeAR committed Apr 26, 2018
1 parent 124875c commit 03e25b6
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 60 deletions.
21 changes: 0 additions & 21 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 1 addition & 16 deletions test/parallel/test-accessor-properties.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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'
);
}
}
22 changes: 0 additions & 22 deletions test/parallel/test-tls-external-accessor.js

This file was deleted.

0 comments on commit 03e25b6

Please sign in to comment.