Skip to content

Commit 7cc5153

Browse files
committed
src: remove has_experimental_policy option
This would be set when `--experimental-policy` was set, but since an empty string does not refer to a valid file, we can just check the value of `--experimental-policy` directly. PR-URL: #25628 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
1 parent 0640b09 commit 7cc5153

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

lib/internal/bootstrap/node.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ function startup() {
172172
}
173173

174174
// TODO(joyeecheung): move this down further to get better snapshotting
175-
if (getOptionValue('[has_experimental_policy]')) {
175+
const experimentalPolicy = getOptionValue('--experimental-policy');
176+
if (experimentalPolicy) {
176177
process.emitWarning('Policies are experimental.',
177178
'ExperimentalWarning');
178-
const experimentalPolicy = getOptionValue('--experimental-policy');
179179
const { pathToFileURL, URL } = NativeModule.require('url');
180180
// URL here as it is slightly different parsing
181181
// no bare specifiers for now

lib/internal/modules/cjs/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const { getOptionValue } = require('internal/options');
4545
const preserveSymlinks = getOptionValue('--preserve-symlinks');
4646
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
4747
const experimentalModules = getOptionValue('--experimental-modules');
48-
const manifest = getOptionValue('[has_experimental_policy]') ?
48+
const manifest = getOptionValue('--experimental-policy') ?
4949
require('internal/process/policy').manifest :
5050
null;
5151

src/node_options.cc

-4
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
143143
"experimental ES Module support and caching modules",
144144
&EnvironmentOptions::experimental_modules,
145145
kAllowedInEnvironment);
146-
AddOption("[has_experimental_policy]",
147-
"",
148-
&EnvironmentOptions::has_experimental_policy);
149146
AddOption("--experimental-policy",
150147
"use the specified file as a "
151148
"security policy",
152149
&EnvironmentOptions::experimental_policy,
153150
kAllowedInEnvironment);
154-
Implies("--experimental-policy", "[has_experimental_policy]");
155151
AddOption("--experimental-repl-await",
156152
"experimental await keyword support in REPL",
157153
&EnvironmentOptions::experimental_repl_await,

src/node_options.h

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class EnvironmentOptions : public Options {
9595
bool abort_on_uncaught_exception = false;
9696
bool experimental_modules = false;
9797
std::string experimental_policy;
98-
bool has_experimental_policy;
9998
bool experimental_repl_await = false;
10099
bool experimental_vm_modules = false;
101100
bool expose_internals = false;

0 commit comments

Comments
 (0)