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 f002c3d as of 2017-11-09
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Jack Horton <jahorto@microsoft.com>
  • Loading branch information
chakrabot committed Nov 10, 2017
2 parents b6b3ed8 + f002c3d commit 9f473d4
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 98 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.8',
'v8_embedder_string': '-node.9',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/inspector/inspector.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
'inspector_all_sources': [
'<@(inspector_generated_sources)',
'<(inspector_generated_injected_script)',
'../../include/v8-inspector.h',
'../../include/v8-inspector-protocol.h',
'../include/v8-inspector.h',
'../include/v8-inspector-protocol.h',
'inspector/injected-script.cc',
'inspector/injected-script.h',
'inspector/inspected-context.cc',
Expand Down
20 changes: 20 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,14 @@ fs.realpathSync = function realpathSync(p, options) {
};


fs.realpathSync.native = function(path, options) {
options = getOptions(options, {});
handleError((path = getPathFromURL(path)));
nullCheck(path);
return binding.realpath(path, options.encoding);
};


fs.realpath = function realpath(p, options, callback) {
callback = maybeCallback(typeof options === 'function' ? options : callback);
if (!options)
Expand Down Expand Up @@ -1858,6 +1866,18 @@ fs.realpath = function realpath(p, options, callback) {
}
};


fs.realpath.native = function(path, options, callback) {
callback = maybeCallback(callback || options);
options = getOptions(options, {});
if (handleError((path = getPathFromURL(path)), callback)) return;
if (!nullCheck(path, callback)) return;
const req = new FSReqWrap();
req.oncomplete = callback;
return binding.realpath(path, options.encoding, req);
};


fs.mkdtemp = function(prefix, options, callback) {
callback = makeCallback(typeof options === 'function' ? options : callback);
options = getOptions(options, {});
Expand Down
32 changes: 14 additions & 18 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,17 @@ static void InternalModuleReadFile(const FunctionCallbackInfo<Value>& args) {
start = 3; // Skip UTF-8 BOM.
}

Local<String> chars_string =
String::NewFromUtf8(env->isolate(),
&chars[start],
String::kNormalString,
offset - start);
args.GetReturnValue().Set(chars_string);
const size_t size = offset - start;
if (size == 0) {
args.GetReturnValue().SetEmptyString();
} else {
Local<String> chars_string =
String::NewFromUtf8(env->isolate(),
&chars[start],
String::kNormalString,
size);
args.GetReturnValue().Set(chars_string);
}
}

// Used to speed up module loading. Returns 0 if the path refers to
Expand Down Expand Up @@ -851,24 +856,15 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
}

static void RealPath(const FunctionCallbackInfo<Value>& args) {
CHECK_GE(args.Length(), 2);
Environment* env = Environment::GetCurrent(args);

const int argc = args.Length();

if (argc < 1)
return TYPE_ERROR("path required");

BufferValue path(env->isolate(), args[0]);
ASSERT_PATH(path)

const enum encoding encoding = ParseEncoding(env->isolate(), args[1], UTF8);

Local<Value> callback = Null(env->isolate());
if (argc == 3)
callback = args[2];

if (callback->IsObject()) {
ASYNC_CALL(realpath, callback, encoding, *path);
if (args[2]->IsObject()) {
ASYNC_CALL(realpath, args[2], encoding, *path);
} else {
SYNC_CALL(realpath, *path, *path);
const char* link_path = static_cast<const char*>(SYNC_REQ.ptr);
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/empty-with-bom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions test/parallel/test-fs-realpath-native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const fs = require('fs');

if (!common.isOSX) common.skip('MacOS-only test.');

assert.strictEqual(fs.realpathSync.native('/users'), '/Users');
fs.realpath.native('/users', common.mustCall((err, res) => {
assert.ifError(err);
assert.strictEqual(res, '/Users');
}));
Loading

0 comments on commit 9f473d4

Please sign in to comment.