Skip to content

Commit

Permalink
v8: move ToNamespacedPath to c++
Browse files Browse the repository at this point in the history
PR-URL: #53655
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
anonrig authored and aduh95 committed Jul 16, 2024
1 parent ecd8fce commit 5aa2163
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/heap_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5aa2163

Please sign in to comment.