Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge 887e232 as of 2017-11-24
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
  • Loading branch information
chakrabot committed Dec 1, 2017
2 parents 229ecfe + 887e232 commit d38fe31
Show file tree
Hide file tree
Showing 28 changed files with 118 additions and 301 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib/internal/v8.js
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ In case of doubt, open an issue in the
[issue tracker](https://github.com/nodejs/node/issues/) or contact one of the
[project Collaborators](https://github.com/nodejs/node/#current-project-team-members).
Node.js has two IRC channels:
[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and
[#Node.js](https://webchat.freenode.net/?channels=node.js) for general help and
questions, and
[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of
[#Node-dev](https://webchat.freenode.net/?channels=node-dev) for development of
Node.js core specifically.

### Setting up your local environment
Expand Down
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ The TSC follows a [Consensus Seeking][] decision making model as described by
the [TSC Charter][].

[TSC Charter]: https://github.com/nodejs/TSC/blob/master/TSC-Charter.md
[Consensus Seeking]: http://en.wikipedia.org/wiki/Consensus-seeking_decision-making
[Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ available-node = \
exit 1; \
fi;

run-npm-install = $(PWD)/$(NPM) install
run-npm-install = $(PWD)/$(NPM) install --production

tools/doc/node_modules/js-yaml/package.json:
cd tools/doc && $(call available-node,$(run-npm-install))
Expand Down
2 changes: 1 addition & 1 deletion doc/api/_toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
<div class="line"></div>

* [GitHub Repo & Issue Tracker](https://github.com/nodejs/node)
* [Mailing List](http://groups.google.com/group/nodejs)
* [Mailing List](https://groups.google.com/group/nodejs)
2 changes: 1 addition & 1 deletion doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureformat
[Caveats]: #crypto_support_for_weak_or_compromised_algorithms
[Crypto Constants]: #crypto_crypto_constants_1
[HTML5's `keygen` element]: http://www.w3.org/TR/html5/forms.html#the-keygen-element
[HTML5's `keygen` element]: https://www.w3.org/TR/html5/forms.html#the-keygen-element
[NIST SP 800-131A]: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf
[NIST SP 800-132]: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
[Nonce-Disrespecting Adversaries]: https://github.com/nonce-disrespect/nonce-disrespect
Expand Down
5 changes: 2 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,9 @@ a V8-inspector based CLI debugger available through `node inspect`.
<a id="DEP0069"></a>
### DEP0069: vm.runInDebugContext(string)

Type: Runtime
Type: End-of-Life

The DebugContext will be removed in V8 soon and will not be available in Node
10+.
DebugContext has been removed in V8 and is not available in Node 10+.

*Note*: DebugContext was an experimental API.

Expand Down
2 changes: 1 addition & 1 deletion doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ A key is *required* for ciphers that make use of certificates. Either `key` or

If the 'ca' option is not given, then Node.js will use the default
publicly trusted list of CAs as given in
<http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt>.
<https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt>.


## tls.createServer([options][, secureConnectionListener])
Expand Down
31 changes: 0 additions & 31 deletions doc/api/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,36 +334,6 @@ console.log(util.inspect(sandbox));
// { globalVar: 1024 }
```

## vm.runInDebugContext(code)
<!-- YAML
added: v0.11.14
deprecated: v8.0.0
changes:
- version: v9.0.0
pr-url: https://github.com/nodejs/node/pull/12815
description: Calling this function now emits a deprecation warning.
-->

> Stability: 0 - Deprecated. An alternative is in development.
* `code` {string} The JavaScript code to compile and run.

The `vm.runInDebugContext()` method compiles and executes `code` inside the V8
debug context. The primary use case is to gain access to the V8 `Debug` object:

```js
const vm = require('vm');
const Debug = vm.runInDebugContext('Debug');
console.log(Debug.findScript(process.emit).name); // 'events.js'
console.log(Debug.findScript(process.exit).name); // 'internal/process.js'
```

*Note*: The debug context and object are intrinsically tied to V8's debugger
implementation and may change (or even be removed) without prior warning.

The `Debug` object can also be made available using the V8-specific
`--expose_debug_as=` [command line option][].

## vm.runInNewContext(code[, sandbox][, options])
<!-- YAML
added: v0.3.1
Expand Down Expand Up @@ -517,7 +487,6 @@ associating it with the `sandbox` object is what this document refers to as
[`vm.runInContext()`]: #vm_vm_runincontext_code_contextifiedsandbox_options
[`vm.runInThisContext()`]: #vm_vm_runinthiscontext_code_options
[V8 Embedder's Guide]: https://github.com/v8/v8/wiki/Embedder's%20Guide#contexts
[command line option]: cli.html
[contextified]: #vm_what_does_it_mean_to_contextify_an_object
[global object]: https://es5.github.io/#x15.1
[indirect `eval()` call]: https://es5.github.io/#x10.4.2
8 changes: 4 additions & 4 deletions doc/api/zlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ http.createServer((request, response) => {
}

// Note: This is not a conformant accept-encoding parser.
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3
// See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3
if (/\bdeflate\b/.test(acceptEncoding)) {
response.writeHead(200, { 'Content-Encoding': 'deflate' });
raw.pipe(zlib.createDeflate()).pipe(response);
Expand Down Expand Up @@ -235,7 +235,7 @@ All of the constants defined in `zlib.h` are also defined on
`require('zlib').constants`. In the normal course of operations, it will not be
necessary to use these constants. They are documented so that their presence is
not surprising. This section is taken almost directly from the
[zlib documentation][]. See <http://zlib.net/manual.html#Constants> for more
[zlib documentation][]. See <https://zlib.net/manual.html#Constants> for more
details.

*Note*: Previously, the constants were available directly from
Expand Down Expand Up @@ -313,7 +313,7 @@ ignored by the decompression classes.
* `info` {boolean} (If `true`, returns an object with `buffer` and `engine`)

See the description of `deflateInit2` and `inflateInit2` at
<http://zlib.net/manual.html#Advanced> for more information on these.
<https://zlib.net/manual.html#Advanced> for more information on these.

## Class: zlib.Deflate
<!-- YAML
Expand Down Expand Up @@ -723,4 +723,4 @@ Decompress a chunk of data with [Unzip][].
[Unzip]: #zlib_class_zlib_unzip
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size
[options]: #zlib_class_options
[zlib documentation]: http://zlib.net/manual.html#Constants
[zlib documentation]: https://zlib.net/manual.html#Constants
15 changes: 15 additions & 0 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// do this good and early, since it handles errors.
setupProcessFatal();

setupV8();
setupProcessICUVersions();

setupGlobalVariables();
Expand Down Expand Up @@ -418,6 +419,20 @@
};
}

function setupV8() {
// Warm up the map and set iterator preview functions. V8 compiles
// functions lazily (unless --nolazy is set) so we need to do this
// before we turn off --allow_natives_syntax again.
const v8 = NativeModule.require('internal/v8');
v8.previewMapIterator(new Map().entries(), 1);
v8.previewSetIterator(new Set().entries(), 1);
// Disable --allow_natives_syntax again unless it was explicitly
// specified on the command line.
const re = /^--allow[-_]natives[-_]syntax$/;
if (!process.execArgv.some((s) => re.test(s)))
process.binding('v8').setFlagsFromString('--noallow_natives_syntax');
}

function setupProcessICUVersions() {
const icu = process.binding('config').hasIntl ?
process.binding('icu') : undefined;
Expand Down
21 changes: 21 additions & 0 deletions lib/internal/v8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

function take(it, n) {
const result = [];
for (const e of it) {
if (--n < 0)
break;
result.push(e);
}
return result;
}

function previewMapIterator(it, n) {
return take(%MapIteratorClone(it), n);
}

function previewSetIterator(it, n) {
return take(%SetIteratorClone(it), n);
}

module.exports = { previewMapIterator, previewSetIterator };
4 changes: 0 additions & 4 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,6 @@ Module.prototype._compile = function(content, filename) {
if (filename === resolvedArgv) {
delete process._breakFirstLine;
inspectorWrapper = process.binding('inspector').callAndPauseOnStart;
if (!inspectorWrapper) {
const Debug = vm.runInDebugContext('Debug');
Debug.setBreakPoint(compiledWrapper, 0, 0);
}
}
}
var dirname = path.dirname(filename);
Expand Down
39 changes: 19 additions & 20 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const { TextDecoder, TextEncoder } = require('internal/encoding');
const { isBuffer } = require('buffer').Buffer;

const { errname } = process.binding('uv');
const { previewMapIterator, previewSetIterator } = require('internal/v8');

const {
getPromiseDetails,
Expand Down Expand Up @@ -77,7 +78,6 @@ const dateToISOString = Date.prototype.toISOString;
const errorToString = Error.prototype.toString;

var CIRCULAR_ERROR_MESSAGE;
var Debug;

/* eslint-disable */
const strEscapeSequencesRegExp = /[\x00-\x1f\x27\x5c]/;
Expand Down Expand Up @@ -356,17 +356,6 @@ function stylizeNoColor(str, styleType) {
return str;
}

function ensureDebugIsInitialized() {
if (Debug === undefined) {
const runInDebugContext = require('vm').runInDebugContext;
// a workaround till this entire method is removed
const originalValue = process.noDeprecation;
process.noDeprecation = true;
Debug = runInDebugContext('Debug');
process.noDeprecation = originalValue;
}
}

function formatValue(ctx, value, recurseTimes, ln) {
// Primitive types cannot have properties
if (typeof value !== 'object' && typeof value !== 'function') {
Expand Down Expand Up @@ -474,10 +463,10 @@ function formatValue(ctx, value, recurseTimes, ln) {
formatter = formatTypedArray;
} else if (isMapIterator(value)) {
braces = ['MapIterator {', '}'];
formatter = formatCollectionIterator;
formatter = formatMapIterator;
} else if (isSetIterator(value)) {
braces = ['SetIterator {', '}'];
formatter = formatCollectionIterator;
formatter = formatSetIterator;
} else {
// Check for boxed strings with valueOf()
// The .valueOf() call can fail for a multitude of reasons
Expand Down Expand Up @@ -782,17 +771,27 @@ function formatMap(ctx, value, recurseTimes, keys) {
return output;
}

function formatCollectionIterator(ctx, value, recurseTimes, keys) {
ensureDebugIsInitialized();
const mirror = Debug.MakeMirror(value, true);
const vals = mirror.preview();
const output = [];
function formatCollectionIterator(preview, ctx, value, recurseTimes,
visibleKeys, keys) {
var nextRecurseTimes = recurseTimes === null ? null : recurseTimes - 1;
var vals = preview(value, 100);
var output = [];
for (const o of vals) {
output.push(formatValue(ctx, o, recurseTimes));
output.push(formatValue(ctx, o, nextRecurseTimes));
}
return output;
}

function formatMapIterator(ctx, value, recurseTimes, visibleKeys, keys) {
return formatCollectionIterator(previewMapIterator, ctx, value, recurseTimes,
visibleKeys, keys);
}

function formatSetIterator(ctx, value, recurseTimes, visibleKeys, keys) {
return formatCollectionIterator(previewSetIterator, ctx, value, recurseTimes,
visibleKeys, keys);
}

function formatPromise(ctx, value, recurseTimes, keys) {
var output;
const [state, result] = getPromiseDetails(value);
Expand Down
15 changes: 0 additions & 15 deletions lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const {

makeContext,
isContext,
runInDebugContext: runInDebugContext_
} = process.binding('contextify');

// The binding provides a few useful primitives:
Expand Down Expand Up @@ -105,19 +104,6 @@ function sigintHandlersWrap(fn, thisArg, argsArray) {
}
}

let runInDebugContextWarned = false;
function runInDebugContext(code) {
if (runInDebugContextWarned === false) {
runInDebugContextWarned = true;
process.emitWarning(
'DebugContext has been deprecated and will be removed in a ' +
'future version.',
'DeprecationWarning',
'DEP0069');
}
return runInDebugContext_(code);
}

function runInContext(code, contextifiedSandbox, options) {
if (typeof options === 'string') {
options = {
Expand Down Expand Up @@ -156,7 +142,6 @@ module.exports = {
Script,
createContext,
createScript,
runInDebugContext,
runInContext,
runInNewContext,
runInThisContext,
Expand Down
1 change: 1 addition & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
'lib/internal/http2/core.js',
'lib/internal/http2/compat.js',
'lib/internal/http2/util.js',
'lib/internal/v8.js',
'lib/internal/v8_prof_polyfill.js',
'lib/internal/v8_prof_processor.js',
'lib/internal/streams/lazy_transform.js',
Expand Down
6 changes: 6 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4406,6 +4406,12 @@ void Init(int* argc,
const char no_typed_array_heap[] = "--typed_array_max_size_in_heap=0";
V8::SetFlagsFromString(no_typed_array_heap, sizeof(no_typed_array_heap) - 1);

// Needed for access to V8 intrinsics. Disabled again during bootstrapping,
// see lib/internal/bootstrap_node.js.
const char allow_natives_syntax[] = "--allow_natives_syntax";
V8::SetFlagsFromString(allow_natives_syntax,
sizeof(allow_natives_syntax) - 1);

// We should set node_is_initialized here instead of in node::Start,
// otherwise embedders using node::Init to initialize everything will not be
// able to set it and native modules will not load for them.
Expand Down
Loading

0 comments on commit d38fe31

Please sign in to comment.