summaryrefslogtreecommitdiff
path: root/lib/internal/error-serdes.js
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-01-30 22:21:07 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-02-02 05:40:47 +0800
commit39d922123c02aecc2e289a08e3bdb9515a7b193a (patch)
tree6ee18ed6096ced4e248836a89c27ecf0da91a6a3 /lib/internal/error-serdes.js
parent1d996f58af3067617a67c0af8f86f014ed4d139c (diff)
downloadandroid-node-v8-39d922123c02aecc2e289a08e3bdb9515a7b193a.tar.gz
android-node-v8-39d922123c02aecc2e289a08e3bdb9515a7b193a.tar.bz2
android-node-v8-39d922123c02aecc2e289a08e3bdb9515a7b193a.zip
lib: save primordials during bootstrap and use it in builtins
This patches changes the `safe_globals` internal module into a script that gets run during bootstrap and saves JavaScript builtins (primordials) into an object that is available for all other builtin modules to access lexically later. PR-URL: https://github.com/nodejs/node/pull/25816 Refs: https://github.com/nodejs/node/issues/18795 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'lib/internal/error-serdes.js')
-rw-r--r--lib/internal/error-serdes.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/internal/error-serdes.js b/lib/internal/error-serdes.js
index 9da1a86417..6b88f100c8 100644
--- a/lib/internal/error-serdes.js
+++ b/lib/internal/error-serdes.js
@@ -2,7 +2,13 @@
const Buffer = require('buffer').Buffer;
const { serialize, deserialize } = require('v8');
-const { SafeSet } = require('internal/safe_globals');
+const {
+ SafeSet,
+ Object,
+ ObjectPrototype,
+ FunctionPrototype,
+ ArrayPrototype
+} = primordials;
const kSerializedError = 0;
const kSerializedObject = 1;
@@ -14,9 +20,9 @@ const GetOwnPropertyNames = Object.getOwnPropertyNames;
const DefineProperty = Object.defineProperty;
const Assign = Object.assign;
const ObjectPrototypeToString =
- Function.prototype.call.bind(Object.prototype.toString);
-const ForEach = Function.prototype.call.bind(Array.prototype.forEach);
-const Call = Function.prototype.call.bind(Function.prototype.call);
+ FunctionPrototype.call.bind(ObjectPrototype.toString);
+const ForEach = FunctionPrototype.call.bind(ArrayPrototype.forEach);
+const Call = FunctionPrototype.call.bind(FunctionPrototype.call);
const errors = {
Error, TypeError, RangeError, URIError, SyntaxError, ReferenceError, EvalError