GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — permission: support v8.setHeapSnapshotNearHeapLimit · nodejs/node@e970e67

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_v8.cc
  • test/parallel
    • test-permission-fs-write-v8.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_v8.cc‎

Copy file name to clipboardExpand all lines: src/node_v8.cc
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "node.h"
2828
#include "node_external_reference.h"
2929
#include "node_profiling.h"
30+
#include "permission/permission.h"
3031
#include "util-inl.h"
3132
#include "v8-profiler.h"
3233
#include "v8.h"
@@ -200,6 +201,14 @@ void SetHeapSnapshotNearHeapLimit(const FunctionCallbackInfo<Value>& args) {
200201
Environment* env = Environment::GetCurrent(args);
201202
uint32_t limit = args[0].As<v8::Uint32>()->Value();
202203
CHECK_GT(limit, 0);
204+
205+
std::string dir = env->options()->diagnostic_dir;
206+
if (dir.empty()) {
207+
dir = Environment::GetCwd(env->exec_path());
208+
}
209+
THROW_IF_INSUFFICIENT_PERMISSIONS(
210+
env, permission::PermissionScope::kFileSystemWrite, dir);
211+
203212
env->AddHeapSnapshotNearHeapLimitCallback();
204213
env->set_heap_snapshot_near_heap_limit(limit);
205214
}
Collapse file

‎test/parallel/test-permission-fs-write-v8.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-permission-fs-write-v8.js
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ const path = require('path');
3434
permission: 'FileSystemWrite',
3535
}));
3636
}
37+
38+
{
39+
assert.throws(() => {
40+
v8.setHeapSnapshotNearHeapLimit(1);
41+
}, common.expectsError({
42+
code: 'ERR_ACCESS_DENIED',
43+
permission: 'FileSystemWrite',
44+
}));
45+
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.