diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-05-11 04:48:00 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-05-13 21:33:42 +0200 |
commit | a4564f3649f3253da53c69d7e3836b05311b0e89 (patch) | |
tree | 02862ea6b5572b9ba50304f728f990a5b72c351d /lib/internal/util.js | |
parent | 5d38d543cdd25962fadc49a997798d156a41e4c7 (diff) | |
download | android-node-v8-a4564f3649f3253da53c69d7e3836b05311b0e89.tar.gz android-node-v8-a4564f3649f3253da53c69d7e3836b05311b0e89.tar.bz2 android-node-v8-a4564f3649f3253da53c69d7e3836b05311b0e89.zip |
util: adhere to `noDeprecation` set at runtime
Until now, the docs stated that `process.noDeprecation` could be set
at runtime, but before any modules were loaded. That was not true,
because `lib/internal/util.js` was loaded during the process startup
process, so setting the flag at runtime was pointless.
Minimal test case:
process.noDeprecation = true;
process.EventEmitter;
This patch moves checking `process.noDeprecation` to the place where
it was actually used.
PR-URL: https://github.com/nodejs/node/pull/6683
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/internal/util.js')
-rw-r--r-- | lib/internal/util.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/internal/util.js b/lib/internal/util.js index 56398ccf9d..9ecdf17ecd 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -2,7 +2,6 @@ const binding = process.binding('util'); const prefix = `(${process.release.name}:${process.pid}) `; -const noDeprecation = process.noDeprecation; exports.getHiddenValue = binding.getHiddenValue; exports.setHiddenValue = binding.setHiddenValue; @@ -16,7 +15,7 @@ exports.deprecate = function(fn, msg) { // All the internal deprecations have to use this function only, as this will // prepend the prefix to the actual message. exports.printDeprecationMessage = function(msg, warned, ctor) { - if (warned || noDeprecation) + if (warned || process.noDeprecation) return true; process.emitWarning(msg, 'DeprecationWarning', ctor || exports.printDeprecationMessage); |