Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.
Merged
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
ea927b3
doc: fix some broken references
gromnitsky Jun 20, 2017
20b00f3
test: replace indexOf with includes and startsWith
Jun 21, 2017
51bb4ac
doc: add default values to functions in fs.md
matejkrajcovic Jun 18, 2017
ed19a18
test: mark test-npm-install flaky on arm
refack Jul 2, 2017
0794c10
doc: fix example in child_process.md
rus0000 Jun 16, 2017
31349e2
deps: cherry-pick 3f4536894ac from V8 upstream
oliverchang May 5, 2017
4dff05f
src: fix process.abort() interaction with V8
addaleax Jun 29, 2017
bce27c2
tools: change var to const in ./doc/addon-verify
BridgeAR Jun 19, 2017
0808989
tools: change var to const in ./doc/html
BridgeAR Jun 19, 2017
461049f
tools: change var to const in ./doc/json
BridgeAR Jun 19, 2017
a7e1cee
tools: change var to const in ./doc/preprocess
BridgeAR Jun 19, 2017
ea67c27
tools: change var to const in ./eslint-rules
BridgeAR Jun 19, 2017
a5347c9
tools: change var to const in ./license2rtf
BridgeAR Jun 19, 2017
017122a
test: change var to const in ./common
BridgeAR Jun 19, 2017
5bbae25
test: refactor test-http-hostname-typechecking
Trott Jun 29, 2017
7a2b3e2
doc,assert: document stackStartFunction in fail
BridgeAR Jul 2, 2017
0455fff
assert: refactor the code
BridgeAR Jun 27, 2017
9955c30
test: refactor test-http-invalidheaderfield
Trott Jun 30, 2017
8b2c61c
doc: fix api docs style
watilde Jun 28, 2017
1d74143
assert: fix incorrect use of ERR_INVALID_ARG_TYPE
tniessen Jun 30, 2017
44256bb
path: fix incorrect use of ERR_INVALID_ARG_TYPE
tniessen Jun 30, 2017
fe730d3
child_process: use internal/errors
tniessen Jun 30, 2017
a6e02dd
Merge nodejs/master
kfarnung Jul 6, 2017
1417fa2
chakrashim: updating platform shim
kfarnung Jul 6, 2017
1b50f3d
src: fix cpplint error
kfarnung Jul 6, 2017
1477c31
cctest: Fix cctest failure on windows
MSLaguana Jul 6, 2017
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
29 changes: 29 additions & 0 deletions deps/chakrashim/include/libplatform/libplatform-export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
#define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_

#if defined(_WIN32)

#ifdef BUILDING_V8_PLATFORM_SHARED
#define V8_PLATFORM_EXPORT __declspec(dllexport)
#elif USING_V8_PLATFORM_SHARED
#define V8_PLATFORM_EXPORT __declspec(dllimport)
#else
#define V8_PLATFORM_EXPORT
#endif // BUILDING_V8_PLATFORM_SHARED

#else // defined(_WIN32)

// Setup for Linux shared library export.
#ifdef BUILDING_V8_PLATFORM_SHARED
#define V8_PLATFORM_EXPORT __attribute__((visibility("default")))
#else
#define V8_PLATFORM_EXPORT
#endif

#endif // defined(_WIN32)

#endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
11 changes: 10 additions & 1 deletion deps/chakrashim/include/libplatform/libplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
#define V8_LIBPLATFORM_LIBPLATFORM_H_

#include "libplatform/libplatform-export.h"
#include "libplatform/v8-tracing.h"
#include "include/v8-platform.h"

namespace v8 {
namespace platform {

v8::Platform* CreateDefaultPlatform(int thread_pool_size = 0);
enum class IdleTaskSupport { kDisabled, kEnabled };
enum class InProcessStackDumping { kDisabled, kEnabled };

V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping =
InProcessStackDumping::kEnabled);

bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate);

/**
Expand Down
5 changes: 4 additions & 1 deletion deps/chakrashim/src/v8v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "v8chakra.h"
#include "jsrtutils.h"
#include "v8-debug.h"
#include "libplatform/libplatform.h"
#include "libplatform/v8-tracing.h"
#include "jsrtplatform.h"

Expand Down Expand Up @@ -210,7 +211,9 @@ void V8::ToLocalEmpty() {
}

namespace platform {
v8::Platform* CreateDefaultPlatform(int thread_pool_size) {
v8::Platform* CreateDefaultPlatform(
int thread_pool_size, IdleTaskSupport idle_task_support,
InProcessStackDumping in_process_stack_dumping) {
jsrt::DefaultPlatform* platform = new jsrt::DefaultPlatform();
return platform;
}
Expand Down
5 changes: 4 additions & 1 deletion deps/v8/include/libplatform/libplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace v8 {
namespace platform {

enum class IdleTaskSupport { kDisabled, kEnabled };
enum class InProcessStackDumping { kDisabled, kEnabled };

/**
* Returns a new instance of the default v8::Platform implementation.
Expand All @@ -27,7 +28,9 @@ enum class IdleTaskSupport { kDisabled, kEnabled };
*/
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled);
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
InProcessStackDumping in_process_stack_dumping =
InProcessStackDumping::kEnabled);

/**
* Pumps the message loop for the given isolate.
Expand Down
12 changes: 11 additions & 1 deletion deps/v8/src/d8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strncmp(argv[i], "--lcov=", 7) == 0) {
options.lcov_file = argv[i] + 7;
argv[i] = NULL;
} else if (strcmp(argv[i], "--disable-in-process-stack-traces") == 0) {
options.disable_in_process_stack_traces = true;
argv[i] = NULL;
}
}

Expand Down Expand Up @@ -2998,10 +3001,17 @@ int Shell::Main(int argc, char* argv[]) {
#endif // defined(_WIN32) || defined(_WIN64)
if (!SetOptions(argc, argv)) return 1;
v8::V8::InitializeICUDefaultLocation(argv[0], options.icu_data_file);

v8::platform::InProcessStackDumping in_process_stack_dumping =
options.disable_in_process_stack_traces
? v8::platform::InProcessStackDumping::kDisabled
: v8::platform::InProcessStackDumping::kEnabled;

g_platform = i::FLAG_verify_predictable
? new PredictablePlatform()
: v8::platform::CreateDefaultPlatform(
0, v8::platform::IdleTaskSupport::kEnabled);
0, v8::platform::IdleTaskSupport::kEnabled,
in_process_stack_dumping);

platform::tracing::TracingController* tracing_controller;
if (options.trace_enabled) {
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/d8.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ class ShellOptions {
snapshot_blob(NULL),
trace_enabled(false),
trace_config(NULL),
lcov_file(NULL) {}
lcov_file(NULL),
disable_in_process_stack_traces(false) {}

~ShellOptions() {
delete[] isolate_sources;
Expand Down Expand Up @@ -336,6 +337,7 @@ class ShellOptions {
bool trace_enabled;
const char* trace_config;
const char* lcov_file;
bool disable_in_process_stack_traces;
};

class Shell : public i::AllStatic {
Expand Down
9 changes: 6 additions & 3 deletions deps/v8/src/libplatform/default-platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ void PrintStackTrace() {

} // namespace

v8::Platform* CreateDefaultPlatform(int thread_pool_size,
IdleTaskSupport idle_task_support) {
v8::base::debug::EnableInProcessStackDumping();
v8::Platform* CreateDefaultPlatform(
int thread_pool_size, IdleTaskSupport idle_task_support,
InProcessStackDumping in_process_stack_dumping) {
if (in_process_stack_dumping == InProcessStackDumping::kEnabled) {
v8::base::debug::EnableInProcessStackDumping();
}
DefaultPlatform* platform = new DefaultPlatform(idle_task_support);
platform->SetThreadPoolSize(thread_pool_size);
platform->EnsureInitialized();
Expand Down
44 changes: 35 additions & 9 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,37 +257,62 @@ property set equal to the value of the `message` parameter. If the `message`
parameter is undefined, a default error message is assigned.

## assert.fail([message])
## assert.fail(actual, expected, message, operator)
## assert.fail(actual, expected[, message[, operator[, stackStartFunction]]])
<!-- YAML
added: v0.1.21
-->
* `actual` {any}
* `expected` {any}
* `message` {any} (default: 'Failed')
* `operator` {string} (default: '!=')
* `stackStartFunction` {function} (default: `assert.fail`)

Throws an `AssertionError`. If `message` is falsy, the error message is set as
the values of `actual` and `expected` separated by the provided `operator`.
Otherwise, the error message is the value of `message`.
If no arguments are provided at all, a default message will be used instead.
If just the two `actual` and `expected` arguments are provided, `operator` will
default to `'!='`. If `message` is provided only it will be used as the error
message, the other arguments will be stored as properties on the thrown object.
If `stackStartFunction` is provided, all stack frames above that function will
be removed from stacktrace (see [`Error.captureStackTrace`]). If no arguments
are given, the default message `Failed` will be used.

```js
const assert = require('assert');

assert.fail(1, 2, undefined, '>');
// AssertionError: 1 > 2
// AssertionError [ERR_ASSERTION]: 1 > 2

assert.fail(1, 2, 'fail');
// AssertionError [ERR_ASSERTION]: fail

assert.fail(1, 2, 'whoops', '>');
// AssertionError: whoops
// AssertionError [ERR_ASSERTION]: whoops
```

*Note*: Is the last two cases `actual`, `expected`, and `operator` have no
influence on the error message.

```js
assert.fail();
// AssertionError [ERR_ASSERTION]: Failed

assert.fail('boom');
// AssertionError: boom
// AssertionError [ERR_ASSERTION]: boom

assert.fail('a', 'b');
// AssertionError: 'a' != 'b'
// AssertionError [ERR_ASSERTION]: 'a' != 'b'
```

assert.fail();
// AssertionError: Failed
Example use of `stackStartFunction` for truncating the exception's stacktrace:
```js
function suppressFrame() {
assert.fail('a', 'b', undefined, '!==', suppressFrame);
}
suppressFrame();
// AssertionError [ERR_ASSERTION]: 'a' !== 'b'
// at repl:1:1
// at ContextifyScript.Script.runInThisContext (vm.js:44:33)
// ...
```

## assert.ifError(value)
Expand Down Expand Up @@ -594,6 +619,7 @@ For more information, see
[MDN's guide on equality comparisons and sameness][mdn-equality-guide].

[`Error`]: errors.html#errors_class_error
[`Error.captureStackTrace`]: errors.html#errors_error_capturestacktrace_targetobject_constructoropt
[`Map`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map
[`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
[`RegExp`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
Expand Down
2 changes: 1 addition & 1 deletion doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ grep.on('close', (code) => {
```


Example of checking for failed exec:
Example of checking for failed `spawn`:

```js
const { spawn } = require('child_process');
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,4 @@ equivalent to using the `--redirect-warnings=file` command-line flag.
[REPL]: repl.html
[SlowBuffer]: buffer.html#buffer_class_slowbuffer
[debugger]: debugger.html
[emit_warning]: process.html#process_process_emitwarning_warning_name_ctor
[emit_warning]: process.html#process_process_emitwarning_warning_type_code_ctor
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ added: v6.0.0

Set by calling `.kill()` or `.disconnect()`. Until then, it is `undefined`.

The boolean `worker.exitedAfterDisconnect` allows distinguishing between
The boolean [`worker.exitedAfterDisconnect`][] allows distinguishing between
voluntary and accidental exit, the master may choose not to respawn a worker
based on this value.

Expand Down
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ In an earlier version of the Node.js `cluster`, a boolean property with the name
`suicide` was added to the `Worker` object. The intent of this property was to
provide an indication of how and why the `Worker` instance exited. In Node.js
6.0.0, the old property was deprecated and replaced with a new
[worker.exitedAfterDisconnect][] property. The old property name did not
[`worker.exitedAfterDisconnect`][] property. The old property name did not
precisely describe the actual semantics and was unnecessarily emotion-laden.

<a id="DEP0008"></a>
Expand Down
3 changes: 1 addition & 2 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ installed.
[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE
[`child.kill()`]: child_process.html#child_process_child_kill_signal
[`child.send()`]: child_process.html#child_process_child_send_message_sendhandle_options_callback
[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_file_options
[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_path_options
[`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback
[`fs.unlink`]: fs.html#fs_fs_unlink_path_callback
[`fs`]: fs.html
Expand All @@ -894,7 +894,6 @@ installed.
[domains]: domain.html
[event emitter-based]: events.html#events_class_eventemitter
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
[intl wiki]: https://github.com/nodejs/node/wiki/Intl
[online]: http://man7.org/linux/man-pages/man3/errno.3.html
[stream-based]: stream.html
[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html
Expand Down
Loading