Skip to content

Commit

Permalink
fixup: cleanup and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeck committed Mar 18, 2022
1 parent 28c153a commit 19e3aa4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/internal/policy/manifest.js
Expand Up @@ -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 {
Expand Down

0 comments on commit 19e3aa4

Please sign in to comment.