summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-01-21 22:36:01 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-01-25 07:36:49 +0100
commitf8d52c25c478c6eb8b182f0b4ea33a58f3fa2aad (patch)
tree4881f3d7e1b0ba44b2f18d9a2decdacd79246d19
parent0f5c14c43e5e79d40726ce6907caf2a76b510be2 (diff)
downloadandroid-node-v8-f8d52c25c478c6eb8b182f0b4ea33a58f3fa2aad.tar.gz
android-node-v8-f8d52c25c478c6eb8b182f0b4ea33a58f3fa2aad.tar.bz2
android-node-v8-f8d52c25c478c6eb8b182f0b4ea33a58f3fa2aad.zip
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: https://github.com/nodejs/node/pull/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>
-rw-r--r--lib/internal/bootstrap/node.js4
-rw-r--r--lib/internal/modules/cjs/loader.js2
-rw-r--r--src/node_options.cc4
-rw-r--r--src/node_options.h1
4 files changed, 3 insertions, 8 deletions
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index bb07bee6f4..86c0cf7aaf 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -180,10 +180,10 @@ function startup() {
}
// TODO(joyeecheung): move this down further to get better snapshotting
- if (getOptionValue('[has_experimental_policy]')) {
+ const experimentalPolicy = getOptionValue('--experimental-policy');
+ if (experimentalPolicy) {
process.emitWarning('Policies are experimental.',
'ExperimentalWarning');
- const experimentalPolicy = getOptionValue('--experimental-policy');
const { pathToFileURL, URL } = NativeModule.require('url');
// URL here as it is slightly different parsing
// no bare specifiers for now
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 1dcf5ef6ac..8b357e5254 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -45,7 +45,7 @@ const { getOptionValue } = require('internal/options');
const preserveSymlinks = getOptionValue('--preserve-symlinks');
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
const experimentalModules = getOptionValue('--experimental-modules');
-const manifest = getOptionValue('[has_experimental_policy]') ?
+const manifest = getOptionValue('--experimental-policy') ?
require('internal/process/policy').manifest :
null;
diff --git a/src/node_options.cc b/src/node_options.cc
index 6d141f52aa..9abd6c870a 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -143,15 +143,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental ES Module support and caching modules",
&EnvironmentOptions::experimental_modules,
kAllowedInEnvironment);
- AddOption("[has_experimental_policy]",
- "",
- &EnvironmentOptions::has_experimental_policy);
AddOption("--experimental-policy",
"use the specified file as a "
"security policy",
&EnvironmentOptions::experimental_policy,
kAllowedInEnvironment);
- Implies("--experimental-policy", "[has_experimental_policy]");
AddOption("--experimental-repl-await",
"experimental await keyword support in REPL",
&EnvironmentOptions::experimental_repl_await,
diff --git a/src/node_options.h b/src/node_options.h
index d77c4fb808..82c2b6e385 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -95,7 +95,6 @@ class EnvironmentOptions : public Options {
bool abort_on_uncaught_exception = false;
bool experimental_modules = false;
std::string experimental_policy;
- bool has_experimental_policy;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool expose_internals = false;