From 19e3aa4433a69499bdf953a79f91d4436c2a4fc0 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Fri, 18 Mar 2022 12:38:48 -0500 Subject: [PATCH] fixup: cleanup and rebase --- lib/internal/policy/manifest.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/internal/policy/manifest.js b/lib/internal/policy/manifest.js index 13e265a849c1f0..174edd99b833e6 100644 --- a/lib/internal/policy/manifest.js +++ b/lib/internal/policy/manifest.js @@ -345,22 +345,20 @@ function findScopeHREF(href, scopeStore, allowSame) { * @typedef {boolean | string | SRI[] | typeof kCascade} Integrity */ -let URL; let shouldAbortOnUncaughtException; -let createHash, timingSafeEqual, HashUpdate, HashDigest; +const crypto = require('crypto'); +const timingSafeEqual = crypto.timingSafeEqual; +const createHash = crypto.createHash; +const HashUpdate = uncurryThis(crypto.Hash.prototype.update); +const HashDigest = uncurryThis(crypto.Hash.prototype.digest); +const { getOptionValue } = require('internal/options'); +const { URL } = require('internal/url'); // To get this in the snapshot we can't have things that use getOptionsValue or // expose C++ functions so we do these lazily function lazyBits() { - const { getOptionValue } = require('internal/options'); shouldAbortOnUncaughtException = getOptionValue( '--abort-on-uncaught-exception' ); - URL = require('internal/url').URL; - const crypto = require('crypto'); - timingSafeEqual = crypto.timingSafeEqual; - createHash = crypto.createHash; - HashUpdate = uncurryThis(crypto.Hash.prototype.update); - HashDigest = uncurryThis(crypto.Hash.prototype.digest); } class Manifest {