Skip to content

Commit 03e25b6

Browse files
addaleaxBridgeAR
authored andcommittedApr 26, 2018
src: remove SecureContext _external getter
This is unused inside Node core, so nothing good can come from keeping it around. PR-URL: nodejs#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 124875c commit 03e25b6

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
@@ -340,19 +340,6 @@ void SecureContext::Initialize(Environment* env, Local<Object> target) {
340340
t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"),
341341
Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex));
342342

343-
Local<FunctionTemplate> ctx_getter_templ =
344-
FunctionTemplate::New(env->isolate(),
345-
CtxGetter,
346-
env->as_external(),
347-
Signature::New(env->isolate(), t));
348-
349-
350-
t->PrototypeTemplate()->SetAccessorProperty(
351-
FIXED_ONE_BYTE_STRING(env->isolate(), "_external"),
352-
ctx_getter_templ,
353-
Local<FunctionTemplate>(),
354-
static_cast<PropertyAttribute>(ReadOnly | DontDelete));
355-
356343
target->Set(secureContextString, t->GetFunction());
357344
env->set_secure_context_constructor_template(t);
358345
}
@@ -1352,14 +1339,6 @@ int SecureContext::TicketCompatibilityCallback(SSL* ssl,
13521339
}
13531340

13541341

1355-
void SecureContext::CtxGetter(const FunctionCallbackInfo<Value>& info) {
1356-
SecureContext* sc;
1357-
ASSIGN_OR_RETURN_UNWRAP(&sc, info.This());
1358-
Local<External> ext = External::New(info.GetIsolate(), sc->ctx_);
1359-
info.GetReturnValue().Set(ext);
1360-
}
1361-
1362-
13631342
template <bool primary>
13641343
void SecureContext::GetCertificate(const FunctionCallbackInfo<Value>& args) {
13651344
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)
Please sign in to comment.