| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 35aaee1 commit e0d2842
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,8 @@ | |||
| 5 | 5 | // to pass to the internal binding layer. | |
| 6 | 6 | ||
| 7 | 7 | const common = require('../common'); | |
| 8 | + if (!common.hasCrypto) | ||
| 9 | + common.skip('missing crypto'); | ||
| 8 | 10 | const assert = require('assert'); | |
| 9 | 11 | const { mapToHeaders } = require('internal/http2/util'); | |
| 10 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | 1 | // Flags: --expose-internals | |
| 2 | 2 | 'use strict'; | |
| 3 | 3 | ||
| 4 | - require('../common'); | ||
| 4 | + const common = require('../common'); | ||
| 5 | + if (!common.hasCrypto) | ||
| 6 | + common.skip('missing crypto'); | ||
| 5 | 7 | ||
| 6 | 8 | // Test coverage for the updateOptionsBuffer method used internally | |
| 7 | 9 | // by the http2 implementation. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,13 +16,18 @@ const utils = require('./rules-utils.js'); | |||
| 16 | 16 | const msg = 'Please add a hasCrypto check to allow this test to be skipped ' + | |
| 17 | 17 | 'when Node is built "--without-ssl".'; | |
| 18 | 18 | ||
| 19 | + const cryptoModules = ['crypto', 'http2']; | ||
| 20 | + const requireModules = cryptoModules.concat(['tls', 'https']); | ||
| 21 | + const bindingModules = cryptoModules.concat(['tls_wrap']); | ||
| 22 | + | ||
| 19 | 23 | module.exports = function(context) { | |
| 20 | 24 | const missingCheckNodes = []; | |
| 21 | 25 | const requireNodes = []; | |
| 22 | 26 | var hasSkipCall = false; | |
| 23 | 27 | ||
| 24 | 28 | function testCryptoUsage(node) { | |
| 25 | - if (utils.isRequired(node, ['crypto', 'tls', 'https', 'http2'])) { | ||
| 29 | + if (utils.isRequired(node, requireModules) || | ||
| 30 | + utils.isBinding(node, bindingModules)) { | ||
| 26 | 31 | requireNodes.push(node); | |
| 27 | 32 | } | |
| 28 | 33 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,18 @@ module.exports.isRequired = function(node, modules) { | |||
| 12 | 12 | modules.includes(node.arguments[0].value); | |
| 13 | 13 | }; | |
| 14 | 14 | ||
| 15 | + /** | ||
| 16 | + * Returns true if any of the passed in modules are used in | ||
| 17 | + * binding calls. | ||
| 18 | + */ | ||
| 19 | + module.exports.isBinding = function(node, modules) { | ||
| 20 | + if (node.callee.object) { | ||
| 21 | + return node.callee.object.name === 'process' && | ||
| 22 | + node.callee.property.name === 'binding' && | ||
| 23 | + modules.includes(node.arguments[0].value); | ||
| 24 | + } | ||
| 25 | + }; | ||
| 26 | + | ||
| 15 | 27 | /** | |
| 16 | 28 | * Returns true is the node accesses any property in the properties | |
| 17 | 29 | * array on the 'common' object. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments