Skip to content

Commit 44fdd36

Browse files
addaleaxMylesBorins
authored andcommitted
src: remove SecureContext _external getter
This is unused inside Node core, so nothing good can come from keeping it around. PR-URL: #20237 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 3a3144c commit 44fdd36

File tree

4 files changed

+1
-60
lines changed

4 files changed

+1
-60
lines changed

src/node_crypto.cc

-21
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,6 @@ void SecureContext::Initialize(Environment* env, Local<Object> target) {
338338
t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"),
339339
Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex));
340340

341-
Local<FunctionTemplate> ctx_getter_templ =
342-
FunctionTemplate::New(env->isolate(),
343-
CtxGetter,
344-
env->as_external(),
345-
Signature::New(env->isolate(), t));
346-
347-
348-
t->PrototypeTemplate()->SetAccessorProperty(
349-
FIXED_ONE_BYTE_STRING(env->isolate(), "_external"),
350-
ctx_getter_templ,
351-
Local<FunctionTemplate>(),
352-
static_cast<PropertyAttribute>(ReadOnly | DontDelete));
353-
354341
target->Set(secureContextString, t->GetFunction());
355342
env->set_secure_context_constructor_template(t);
356343
}
@@ -1350,14 +1337,6 @@ int SecureContext::TicketCompatibilityCallback(SSL* ssl,
13501337
}
13511338

13521339

1353-
void SecureContext::CtxGetter(const FunctionCallbackInfo<Value>& info) {
1354-
SecureContext* sc;
1355-
ASSIGN_OR_RETURN_UNWRAP(&sc, info.This());
1356-
Local<External> ext = External::New(info.GetIsolate(), sc->ctx_);
1357-
info.GetReturnValue().Set(ext);
1358-
}
1359-
1360-
13611340
template <bool primary>
13621341
void SecureContext::GetCertificate(const FunctionCallbackInfo<Value>& args) {
13631342
SecureContext* wrap;

src/node_crypto.h

-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class SecureContext : public BaseObject {
148148
const v8::FunctionCallbackInfo<v8::Value>& args);
149149
static void EnableTicketKeyCallback(
150150
const v8::FunctionCallbackInfo<v8::Value>& args);
151-
static void CtxGetter(const v8::FunctionCallbackInfo<v8::Value>& info);
152151

153152
template <bool primary>
154153
static void GetCertificate(const v8::FunctionCallbackInfo<v8::Value>& args);

test/parallel/test-accessor-properties.js

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const common = require('../common');
3+
require('../common');
44

55
// This tests that the accessor properties do not raise assertions
66
// when called with incompatible receivers.
@@ -50,19 +50,4 @@ const UDP = process.binding('udp_wrap').UDP;
5050
typeof Object.getOwnPropertyDescriptor(UDP.prototype, 'fd'),
5151
'object'
5252
);
53-
54-
if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
55-
// There are accessor properties in crypto too
56-
const crypto = process.binding('crypto');
57-
58-
assert.throws(() => {
59-
crypto.SecureContext.prototype._external;
60-
}, TypeError);
61-
62-
assert.strictEqual(
63-
typeof Object.getOwnPropertyDescriptor(
64-
crypto.SecureContext.prototype, '_external'),
65-
'object'
66-
);
67-
}
6853
}

test/parallel/test-tls-external-accessor.js

-22
This file was deleted.

0 commit comments

Comments
 (0)