From 78609bb065844921d008c7ec2567ed965b700101 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 14 Feb 2022 22:52:30 +0100 Subject: [PATCH] Support contextual policies in permission updates. --- src/bg/LifeCycle.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bg/LifeCycle.js b/src/bg/LifeCycle.js index 1fcd5a6..0a23e55 100644 --- a/src/bg/LifeCycle.js +++ b/src/bg/LifeCycle.js @@ -265,6 +265,11 @@ var LifeCycle = (() => { let changed = false; for (let p of ns.policy.getPresets(presetNames)) { if (callback(p)) changed = true; + if (p.contextual) { + for (let ctxP of p.contextual.values()) { + if (callback(ctxP)) changed = true; + } + } } if (changed) { await ns.savePolicy(); @@ -305,6 +310,10 @@ var LifeCycle = (() => { if (Ver.is(previousVersion, "<=", "11.2.5rc1")) { await renameCap("csspp0", "unchecked_css"); } + if (Ver.is(previousVersion, "<=", "11.3rc2")) { + // add the lan capability to any preset which already has the script capability + await configureNewCap("lan", ["DEFAULT", "TRUSTED", "CUSTOM"], caps => caps.has("script")); + } }, async onUpdateAvailable(details) {