summaryrefslogtreecommitdiff
path: root/lib/internal/freeze_intrinsics.js
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-06 05:56:00 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-16 04:24:26 +0800
commita38e9c438ae872da37999c39d974facd4d524ea2 (patch)
treeafd23a9511e2e306760b71f1dabfdded92c8a25b /lib/internal/freeze_intrinsics.js
parent7938238b31f69d1a8bfa8069387cc2374435996c (diff)
downloadandroid-node-v8-a38e9c438ae872da37999c39d974facd4d524ea2.tar.gz
android-node-v8-a38e9c438ae872da37999c39d974facd4d524ea2.tar.bz2
android-node-v8-a38e9c438ae872da37999c39d974facd4d524ea2.zip
lib: require globals instead of using the global proxy
In addition, use process.stderr instead of console.error when there is no need to swallow the error. PR-URL: https://github.com/nodejs/node/pull/27112 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/freeze_intrinsics.js')
-rw-r--r--lib/internal/freeze_intrinsics.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js
index ef32a8dc35..753fb00acb 100644
--- a/lib/internal/freeze_intrinsics.js
+++ b/lib/internal/freeze_intrinsics.js
@@ -19,11 +19,20 @@
// https://github.com/google/caja/blob/master/src/com/google/caja/ses/repairES5.js
// https://github.com/tc39/proposal-frozen-realms/blob/91ac390e3451da92b5c27e354b39e52b7636a437/shim/src/deep-freeze.js
-/* global WebAssembly, SharedArrayBuffer, console */
+/* global WebAssembly, SharedArrayBuffer */
/* eslint-disable no-restricted-globals */
'use strict';
module.exports = function() {
+ const {
+ clearImmediate,
+ clearInterval,
+ clearTimeout,
+ setImmediate,
+ setInterval,
+ setTimeout
+ } = require('timers');
+ const console = require('internal/console/global');
const intrinsics = [
// Anonymous Intrinsics
@@ -124,16 +133,12 @@ module.exports = function() {
clearImmediate,
clearInterval,
clearTimeout,
- decodeURI,
- decodeURIComponent,
- encodeURI,
- encodeURIComponent,
setImmediate,
setInterval,
setTimeout,
+ console,
// Other APIs
- console,
BigInt,
Atomics,
WebAssembly,