feat: add support for --no-experimental-global-navigator (#47418)
chore: add support for --no-experimental-global-navigator Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
parent
221f5ee3d6
commit
cfa2efe0c2
4 changed files with 35 additions and 0 deletions
|
@ -325,6 +325,10 @@ Set the directory to which all Node.js diagnostic output files are written. Defa
|
|||
|
||||
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
|
||||
|
||||
### `--no-experimental-global-navigator`
|
||||
|
||||
Disable exposition of [Navigator API][] on the global scope from Node.js.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
|
@ -333,3 +337,4 @@ Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https:
|
|||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[ready]: app.md#event-ready
|
||||
[severities]: https://source.chromium.org/chromium/chromium/src/+/main:base/logging.h?q=logging::LogSeverity&ss=chromium
|
||||
[Navigator API]: https://github.com/nodejs/node/blob/main/doc/api/globals.md#navigator
|
||||
|
|
|
@ -375,6 +375,7 @@ bool IsAllowedOption(const std::string_view option) {
|
|||
"--throw-deprecation",
|
||||
"--trace-deprecation",
|
||||
"--trace-warnings",
|
||||
"--no-experimental-global-navigator",
|
||||
});
|
||||
|
||||
if (debug_options.contains(option))
|
||||
|
|
|
@ -800,5 +800,33 @@ describe('utilityProcess module', () => {
|
|||
expect(stat.size).to.be.greaterThan(0);
|
||||
await fs.rm(tmpDir, { recursive: true });
|
||||
});
|
||||
|
||||
it('supports --no-experimental-global-navigator flag', async () => {
|
||||
{
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'navigator.js'), [], {
|
||||
stdio: 'ignore'
|
||||
});
|
||||
await once(child, 'spawn');
|
||||
const [data] = await once(child, 'message');
|
||||
expect(data).to.be.true();
|
||||
const exit = once(child, 'exit');
|
||||
expect(child.kill()).to.be.true();
|
||||
await exit;
|
||||
}
|
||||
{
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'navigator.js'), [], {
|
||||
stdio: 'ignore',
|
||||
execArgv: [
|
||||
'--no-experimental-global-navigator'
|
||||
]
|
||||
});
|
||||
await once(child, 'spawn');
|
||||
const [data] = await once(child, 'message');
|
||||
expect(data).to.be.false();
|
||||
const exit = once(child, 'exit');
|
||||
expect(child.kill()).to.be.true();
|
||||
await exit;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
spec/fixtures/api/utility-process/navigator.js
vendored
Normal file
1
spec/fixtures/api/utility-process/navigator.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
process.parentPort.postMessage(typeof navigator === 'object');
|
Loading…
Add table
Add a link
Reference in a new issue