mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
15456e4e57
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/52761 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
31 lines
652 B
JavaScript
31 lines
652 B
JavaScript
// Flags: --experimental-permission --allow-fs-read=*
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfWorker();
|
|
if (!common.hasCrypto)
|
|
common.skip('no crypto');
|
|
|
|
const assert = require('assert');
|
|
const v8 = require('v8');
|
|
const path = require('path');
|
|
|
|
{
|
|
assert.throws(() => {
|
|
v8.writeHeapSnapshot('./secret.txt');
|
|
}, common.expectsError({
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'FileSystemWrite',
|
|
resource: path.toNamespacedPath('./secret.txt'),
|
|
}));
|
|
}
|
|
|
|
{
|
|
assert.throws(() => {
|
|
v8.writeHeapSnapshot();
|
|
}, common.expectsError({
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'FileSystemWrite',
|
|
}));
|
|
}
|