mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
v8: move ToNamespacedPath to c++
PR-URL: https://github.com/nodejs/node/pull/53655 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -53,7 +53,6 @@ const { copy } = internalBinding('buffer');
|
||||
const { inspect } = require('internal/util/inspect');
|
||||
const { FastBuffer } = require('internal/buffer');
|
||||
const { getValidatedPath } = require('internal/fs/utils');
|
||||
const { toNamespacedPath } = require('path');
|
||||
const {
|
||||
createHeapSnapshotStream,
|
||||
triggerHeapSnapshot,
|
||||
@@ -78,7 +77,6 @@ const { getOptionValue } = require('internal/options');
|
||||
function writeHeapSnapshot(filename, options) {
|
||||
if (filename !== undefined) {
|
||||
filename = getValidatedPath(filename);
|
||||
filename = toNamespacedPath(filename);
|
||||
}
|
||||
const optionArray = getHeapSnapshotOptions(options);
|
||||
return triggerHeapSnapshot(filename, optionArray);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "env-inl.h"
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "path.h"
|
||||
#include "permission/permission.h"
|
||||
#include "stream_base-inl.h"
|
||||
#include "util-inl.h"
|
||||
@@ -468,6 +469,7 @@ void TriggerHeapSnapshot(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
BufferValue path(isolate, filename_v);
|
||||
CHECK_NOT_NULL(*path);
|
||||
ToNamespacedPath(env, &path);
|
||||
THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env, permission::PermissionScope::kFileSystemWrite, path.ToStringView());
|
||||
if (WriteSnapshot(env, *path, options).IsNothing()) return;
|
||||
|
||||
Reference in New Issue
Block a user