Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v8.x backport] deps: backport 804a693 from upstream V8 #22177

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bb1e8a6
deps: cherry-pick 6989b3f6d7 from V8 upstream
TimothyGu May 18, 2018
0c43ea4
deps: Upgrade node-inspect to 1.11.5
May 31, 2018
d388282
doc: add error check to fs example
evanlucas Feb 9, 2018
0b2d35c
test: add useful info to error msg and refactor
chinhuang007 Feb 2, 2018
edd8b2f
test: add crypto check to test-benchmark-tls
danbev Feb 12, 2018
bc66d4e
test: add multiline repl input regression test
cjihrig Feb 11, 2018
b01e470
doc: update crypo Certficate class.
antoine-amara Feb 11, 2018
a66434f
test: add lib path env when node_shared=true
yhwang Feb 2, 2018
92a90d1
test: wrap countdown callback in common.mustCall
Bamieh Nov 21, 2017
6a8c182
doc: remove extra space in README.md
Feb 16, 2018
7fbc6a4
test: try to connect after server was closed
Leko Jan 19, 2018
06b6507
test: reduce benchmark test run time
juggernaut451 Feb 14, 2018
077fb0a
test: make tls test more rigorous
bnoordhuis Feb 15, 2018
0ef0dbc
test: refactor of test-tls-over-http-tunnel
juggernaut451 Feb 14, 2018
8345f3c
test: refactor parallel/test-tls-addca
juggernaut451 Feb 15, 2018
4070782
test,benchmark,doc: enable dot-notation rule
BridgeAR Feb 13, 2018
8651766
doc: note that linting is required in releases.md
gibfahn Feb 14, 2018
b4fa857
doc: activate `no-multiple-empty-lines` rule
BridgeAR Feb 13, 2018
bf1ca7e
src: allow --perf-(basic-)?prof in NODE_OPTIONS
Leko Dec 11, 2017
c1c6253
crypto: allow passing null as IV unless required
tniessen Feb 7, 2018
c3a96ba
async_hooks: rename PromiseWrap.parentId
ofrobots Feb 8, 2018
a2e4940
fs: support as and as+ flags in stringToFlags()
SirR4T Feb 15, 2018
5975c06
doc: add missing metadata for fs.open
tniessen Mar 25, 2018
bcaba81
tls: expose Finished messages in TLSSocket
codedot Mar 2, 2018
ae6e4bd
fs,net: emit 'ready' for fs streams and sockets
sameer-coder Mar 17, 2018
d3cc97b
deps: backport 804a693 from upstream V8
Jul 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ rules:
# http://eslint.org/docs/rules/#best-practices
accessor-pairs: error
dot-location: [error, property]
dot-notation: error
eqeqeq: [error, smart]
no-fallthrough: error
no-global-assign: error
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ For more information about the governance of the Node.js project, see
* [misterdjules](https://github.com/misterdjules) -
**Julien Gilli** <jgilli@nodejs.org>
* [mmarchini](https://github.com/mmarchini) -
**Matheus Marchini** <matheus@sthima.com>
**Matheus Marchini** <matheus@sthima.com>
* [mscdex](https://github.com/mscdex) -
**Brian White** <mscdex@mscdex.net>
* [MylesBorins](https://github.com/MylesBorins) -
Expand Down
2 changes: 2 additions & 0 deletions benchmark/misc/object-property-bench.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

/* eslint-disable dot-notation */

const common = require('../common.js');

const bench = common.createBenchmark(main, {
Expand Down
2 changes: 1 addition & 1 deletion deps/node-inspect/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
es6: true

parserOptions:
ecmaVersion: 2016
ecmaVersion: 2017

rules:
# Possible Errors
Expand Down
1 change: 1 addition & 0 deletions deps/node-inspect/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
registry=https://registry.npmjs.org
package-lock=false
14 changes: 14 additions & 0 deletions deps/node-inspect/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### 1.11.5

* Fix eslint issues - **[@jkrems](https://github.com/jkrems)** [#63](https://github.com/nodejs/node-inspect/pull/63)
- [`2adadbc`](https://github.com/nodejs/node-inspect/commit/2adadbc1086d2e374c425acbf96260a122705db2) **style:** Fix eslint issues
- [`a6d2f88`](https://github.com/nodejs/node-inspect/commit/a6d2f882c026409696a1b063ff40ceba7e1ddb86) **doc:** Remove redundant newline at the end


### 1.11.4

* Handle blocked port - **[@jkrems](https://github.com/jkrems)** [#62](https://github.com/nodejs/node-inspect/pull/62)
- [`3388969`](https://github.com/nodejs/node-inspect/commit/3388969d0032a78ff0cdb8146f170b978ec13b7b) **chore:** Disable package-lock
- [`d278b23`](https://github.com/nodejs/node-inspect/commit/d278b233ae5e11a2b62d01ccbaae594f39b32a96) **fix:** Stop asking to report a blocked port - see: [#60](https://github.com/nodejs/node-inspect/issues/60)


### 1.11.3

* [`93caa0f`](https://github.com/nodejs/node-inspect/commit/93caa0f5267c7ab452b258d3b03329a0bb5ac7f7) **docs:** Add missing oc in protocol
Expand Down
21 changes: 16 additions & 5 deletions deps/node-inspect/lib/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ const [ InspectClient, createRepl ] =

const debuglog = util.debuglog('inspect');

class StartupError extends Error {
constructor(message) {
super(message);
this.name = 'StartupError';
}
}

function portIsFree(host, port, timeout = 2000) {
if (port === 0) return Promise.resolve(); // Binding to a random port.

Expand All @@ -51,7 +58,7 @@ function portIsFree(host, port, timeout = 2000) {
return new Promise((resolve, reject) => {
setTimeout(() => {
didTimeOut = true;
reject(new Error(
reject(new StartupError(
`Timeout (${timeout}) waiting for ${host}:${port} to be free`));
}, timeout);

Expand Down Expand Up @@ -346,10 +353,14 @@ function startInspect(argv = process.argv.slice(2),
stdin.resume();

function handleUnexpectedError(e) {
console.error('There was an internal error in node-inspect. ' +
'Please report this bug.');
console.error(e.message);
console.error(e.stack);
if (!(e instanceof StartupError)) {
console.error('There was an internal error in node-inspect. ' +
'Please report this bug.');
console.error(e.message);
console.error(e.stack);
} else {
console.error(e.message);
}
if (inspector.child) inspector.child.kill();
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion deps/node-inspect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-inspect",
"version": "1.11.3",
"version": "1.11.5",
"description": "Node Inspect",
"license": "MIT",
"main": "lib/_inspect.js",
Expand Down
29 changes: 29 additions & 0 deletions deps/node-inspect/test/cli/invalid-args.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict';
const Path = require('path');
const { createServer } = require('net');

const { test } = require('tap');

const startCLI = require('./start-cli');
Expand All @@ -23,3 +26,29 @@ test('launch w/ invalid host:port', (t) => {
t.equal(code, 1, 'exits with non-zero exit code');
});
});

test('launch w/ unavailable port', async (t) => {
const blocker = createServer((socket) => socket.end());
const port = await new Promise((resolve, reject) => {
blocker.on('error', reject);
blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port));
});

try {
const script = Path.join('examples', 'three-lines.js');
const cli = startCLI([`--port=${port}`, script]);
const code = await cli.quit();

t.notMatch(
cli.output,
'report this bug',
'Omits message about reporting this as a bug');
t.match(
cli.output,
`waiting for 127.0.0.1:${port} to be free`,
'Tells the user that the port wasn\'t available');
t.equal(code, 1, 'exits with non-zero exit code');
} finally {
blocker.close();
}
});
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 6
#define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 414
#define V8_PATCH_LEVEL 64
#define V8_PATCH_LEVEL 65

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
89 changes: 59 additions & 30 deletions deps/v8/src/js/intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,11 @@ var AVAILABLE_LOCALES = {
*/
var DEFAULT_ICU_LOCALE = UNDEFINED;

function GetDefaultICULocaleJS(service) {
function GetDefaultICULocaleJS() {
if (IS_UNDEFINED(DEFAULT_ICU_LOCALE)) {
DEFAULT_ICU_LOCALE = %GetDefaultICULocale();
}
// Check that this is a valid default for this service,
// otherwise fall back to "und"
// TODO(littledan,jshin): AvailableLocalesOf sometimes excludes locales
// which don't require tailoring, but work fine with root data. Look into
// exposing this fact in ICU or the way Chrome bundles data.
return (IS_UNDEFINED(service) ||
HAS_OWN_PROPERTY(getAvailableLocalesOf(service), DEFAULT_ICU_LOCALE))
? DEFAULT_ICU_LOCALE : "und";
return DEFAULT_ICU_LOCALE;
}

/**
Expand Down Expand Up @@ -417,6 +410,48 @@ function resolveLocale(service, requestedLocales, options) {
}


/**
* Look up the longest non-empty prefix of |locale| that is an element of
* |availableLocales|. Returns undefined when the |locale| is completely
* unsupported by |availableLocales|.
*/
function bestAvailableLocale(availableLocales, locale) {
do {
if (!IS_UNDEFINED(availableLocales[locale])) {
return locale;
}
// Truncate locale if possible.
var pos = %StringLastIndexOf(locale, '-');
if (pos === -1) {
break;
}
locale = %_Call(StringSubstring, locale, 0, pos);
} while (true);

return UNDEFINED;
}


/**
* Try to match any mutation of |requestedLocale| against |availableLocales|.
*/
function attemptSingleLookup(availableLocales, requestedLocale) {
// Remove all extensions.
var noExtensionsLocale = %RegExpInternalReplace(
GetAnyExtensionRE(), requestedLocale, '');
var availableLocale = bestAvailableLocale(
availableLocales, requestedLocale);
if (!IS_UNDEFINED(availableLocale)) {
// Return the resolved locale and extension.
var extensionMatch = %regexp_internal_match(
GetUnicodeExtensionRE(), requestedLocale);
var extension = IS_NULL(extensionMatch) ? '' : extensionMatch[0];
return {locale: availableLocale, extension: extension};
}
return UNDEFINED;
}


/**
* Returns best matched supported locale and extension info using basic
* lookup algorithm.
Expand All @@ -429,31 +464,25 @@ function lookupMatcher(service, requestedLocales) {
var availableLocales = getAvailableLocalesOf(service);

for (var i = 0; i < requestedLocales.length; ++i) {
// Remove all extensions.
var locale = %RegExpInternalReplace(
GetAnyExtensionRE(), requestedLocales[i], '');
do {
if (!IS_UNDEFINED(availableLocales[locale])) {
// Return the resolved locale and extension.
var extensionMatch = %regexp_internal_match(
GetUnicodeExtensionRE(), requestedLocales[i]);
var extension = IS_NULL(extensionMatch) ? '' : extensionMatch[0];
return {locale: locale, extension: extension, position: i};
}
// Truncate locale if possible.
var pos = %StringLastIndexOf(locale, '-');
if (pos === -1) {
break;
}
locale = %_Call(StringSubstring, locale, 0, pos);
} while (true);
var result = attemptSingleLookup(availableLocales, requestedLocales[i]);
if (!IS_UNDEFINED(result)) {
return result;
}
}

var defLocale = GetDefaultICULocaleJS();

// While ECMA-402 returns defLocale directly, we have to check if it is
// supported, as such support is not guaranteed.
var result = attemptSingleLookup(availableLocales, defLocale);
if (!IS_UNDEFINED(result)) {
return result;
}

// Didn't find a match, return default.
return {
locale: GetDefaultICULocaleJS(service),
extension: '',
position: -1
locale: 'und',
extension: ''
};
}

Expand Down
41 changes: 41 additions & 0 deletions deps/v8/test/intl/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ function assertFalse(value, user_message = '') {
}


/**
* Throws if value is null.
*/
function assertNotNull(value, user_message = '') {
if (value === null) {
fail("not null", value, user_message);
}
}


/**
* Runs code() and asserts that it throws the specified exception.
*/
Expand Down Expand Up @@ -189,3 +199,34 @@ function assertInstanceof(obj, type) {
(actualTypeName ? ' but of < ' + actualTypeName + '>' : ''));
}
}


/**
* Split a BCP 47 language tag into locale and extension.
*/
function splitLanguageTag(tag) {
var extRe = /(-[0-9A-Za-z](-[0-9A-Za-z]{2,8})+)+$/;
var match = %regexp_internal_match(extRe, tag);
if (match) {
return { locale: tag.slice(0, match.index), extension: match[0] };
}

return { locale: tag, extension: '' };
}


/**
* Throw if |parent| is not a more general language tag of |child|, nor |child|
* itself, per BCP 47 rules.
*/
function assertLanguageTag(child, parent) {
var childSplit = splitLanguageTag(child);
var parentSplit = splitLanguageTag(parent);

// Do not compare extensions at this moment, as %GetDefaultICULocale()
// doesn't always output something we support.
if (childSplit.locale !== parentSplit.locale &&
!childSplit.locale.startsWith(parentSplit.locale + '-')) {
fail(child, parent, 'language tag comparison');
}
}
4 changes: 2 additions & 2 deletions deps/v8/test/intl/break-iterator/default-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ assertFalse(options.locale === 'und');
assertFalse(options.locale === '');
assertFalse(options.locale === undefined);

// Then check for equality.
assertEquals(options.locale, %GetDefaultICULocale());
// Then check for legitimacy.
assertLanguageTag(%GetDefaultICULocale(), options.locale);

var iteratorNone = new Intl.v8BreakIterator();
assertEquals(options.locale, iteratorNone.resolvedOptions().locale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

var iterator = Intl.v8BreakIterator(['xx']);

assertEquals(iterator.resolvedOptions().locale, %GetDefaultICULocale());
assertLanguageTag(%GetDefaultICULocale(), iterator.resolvedOptions().locale);
11 changes: 7 additions & 4 deletions deps/v8/test/intl/collator/default-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ assertFalse(options.locale === 'und');
assertFalse(options.locale === '');
assertFalse(options.locale === undefined);

// Then check for equality.
assertEquals(options.locale, %GetDefaultICULocale());
// Then check for legitimacy.
assertLanguageTag(%GetDefaultICULocale(), options.locale);

var collatorNone = new Intl.Collator();
assertEquals(options.locale, collatorNone.resolvedOptions().locale);
Expand All @@ -48,5 +48,8 @@ var collatorBraket = new Intl.Collator({});
assertEquals(options.locale, collatorBraket.resolvedOptions().locale);

var collatorWithOptions = new Intl.Collator(undefined, {usage: 'search'});
assertEquals(%GetDefaultICULocale() + '-u-co-search',
collatorWithOptions.resolvedOptions().locale);
assertLanguageTag(%GetDefaultICULocale(),
collatorWithOptions.resolvedOptions().locale);
assertNotNull(
%regexp_internal_match(/-u(-[a-zA-Z]+-[a-zA-Z]+)*-co-search/,
collatorWithOptions.resolvedOptions().locale));
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

var collator = Intl.Collator(['xx']);

assertEquals(collator.resolvedOptions().locale, %GetDefaultICULocale());
assertLanguageTag(%GetDefaultICULocale(), collator.resolvedOptions().locale);
4 changes: 2 additions & 2 deletions deps/v8/test/intl/date-format/default-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ assertFalse(options.locale === 'und');
assertFalse(options.locale === '');
assertFalse(options.locale === undefined);

// Then check for equality.
assertEquals(options.locale, %GetDefaultICULocale());
// Then check for legitimacy.
assertLanguageTag(%GetDefaultICULocale(), options.locale);

var dtfNone = new Intl.DateTimeFormat();
assertEquals(options.locale, dtfNone.resolvedOptions().locale);
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

var dtf = Intl.DateTimeFormat(['xx']);

assertEquals(dtf.resolvedOptions().locale, %GetDefaultICULocale());
assertLanguageTag(%GetDefaultICULocale(), dtf.resolvedOptions().locale);
4 changes: 2 additions & 2 deletions deps/v8/test/intl/number-format/default-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ assertFalse(options.locale === 'und');
assertFalse(options.locale === '');
assertFalse(options.locale === undefined);

// Then check for equality.
assertEquals(options.locale, %GetDefaultICULocale());
// Then check for legitimacy.
assertLanguageTag(%GetDefaultICULocale(), options.locale);

var nfNone = new Intl.NumberFormat();
assertEquals(options.locale, nfNone.resolvedOptions().locale);
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

var nf = Intl.NumberFormat(['xx']);

assertEquals(nf.resolvedOptions().locale, %GetDefaultICULocale());
assertLanguageTag(%GetDefaultICULocale(), nf.resolvedOptions().locale);
Loading