diff options
Diffstat (limited to 'lib/internal/process/policy.js')
-rw-r--r-- | lib/internal/process/policy.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/internal/process/policy.js b/lib/internal/process/policy.js index f5ca4eeb07..0b037d4ef5 100644 --- a/lib/internal/process/policy.js +++ b/lib/internal/process/policy.js @@ -5,6 +5,7 @@ const { } = require('internal/errors').codes; const { Manifest } = require('internal/policy/manifest'); let manifest; + module.exports = Object.freeze({ __proto__: null, setup(src, url) { @@ -12,6 +13,7 @@ module.exports = Object.freeze({ manifest = null; return; } + const json = JSON.parse(src, (_, o) => { if (o && typeof o === 'object') { Reflect.setPrototypeOf(o, null); @@ -21,12 +23,14 @@ module.exports = Object.freeze({ }); manifest = new Manifest(json, url); }, + get manifest() { if (typeof manifest === 'undefined') { throw new ERR_MANIFEST_TDZ(); } return manifest; }, + assertIntegrity(moduleURL, content) { this.manifest.matchesIntegrity(moduleURL, content); } |