Skip to content

Commit 9e5e24a

Browse files
committed
src: fix permission inspector crash
1 parent 2693f09 commit 9e5e24a

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/inspector_js_api.cc

+4
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ void SetConsoleExtensionInstaller(const FunctionCallbackInfo<Value>& info) {
181181

182182
void CallAndPauseOnStart(const FunctionCallbackInfo<v8::Value>& args) {
183183
Environment* env = Environment::GetCurrent(args);
184+
THROW_IF_INSUFFICIENT_PERMISSIONS(env,
185+
permission::PermissionScope::kInspector,
186+
"PauseOnNextJavascriptStatement"
187+
);
184188
CHECK_GT(args.Length(), 1);
185189
CHECK(args[0]->IsFunction());
186190
SlicedArguments call_args(args, /* start */ 2);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('done');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const { spawnSync } = require('child_process');
6+
const fixtures = require('../common/fixtures');
7+
const file = fixtures.path('permission', 'inspector-brk.js');
8+
9+
common.skipIfWorker();
10+
common.skipIfInspectorDisabled();
11+
12+
const { status, stderr } = spawnSync(
13+
process.execPath,
14+
[
15+
'--experimental-permission',
16+
'--allow-fs-read=*',
17+
'--inspect-brk',
18+
file,
19+
],
20+
);
21+
22+
assert.strictEqual(status, 1);
23+
assert.match(stderr.toString(), /Error: Access to this API has been restricted/);

0 commit comments

Comments
 (0)