summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-external-accessor.js
blob: 33d371923a600c670424d95b2507e177d6d69073 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'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;
}