diff options
author | hackademix | 2019-09-27 15:33:11 +0200 |
---|---|---|
committer | hackademix | 2019-09-29 17:29:38 +0200 |
commit | 78063f341225b85d68ef45faad5197672d5a01c2 (patch) | |
tree | 5840081585c93f2d078a6a392a08739761b70e66 /src/bg/RequestGuard.js | |
parent | c9e06983ba330ab70d2956e7287dde263278128a (diff) | |
download | noscript-78063f341225b85d68ef45faad5197672d5a01c2.tar.gz noscript-78063f341225b85d68ef45faad5197672d5a01c2.tar.xz noscript-78063f341225b85d68ef45faad5197672d5a01c2.zip |
Remove ChildPolicies and its dependencies.
Diffstat (limited to 'src/bg/RequestGuard.js')
-rw-r--r-- | src/bg/RequestGuard.js | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index f636f23..0de52f4 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -262,14 +262,11 @@ var RequestGuard = (() => { } function intersectCapabilities(perms, frameAncestors) { - if (frameAncestors && frameAncestors.length > 0 && ns.sync.cascadeRestrictions) { + if (frameAncestors && frameAncestors.length && ns.sync.cascadeRestrictions) { // cascade top document's restrictions to subframes - let topUrl = frameAncestors[frameAncestors.length - 1].url; - let topPerms = ns.policy.get(topUrl, topUrl).perms; - if (topPerms !== perms) { - let topCaps = topPerms.capabilities; - return new Set([...perms.capabilities].filter(c => topCaps.has(c))); - } + perms = policy.cascadeRestrictions(perms, + frameAncestors[frameAncestors.length - 1].url) + .capabilities; } return perms.capabilities; } @@ -347,20 +344,12 @@ var RequestGuard = (() => { if (isMainFrame) { if (policy.autoAllowTop && perms === policy.DEFAULT) { policy.set(Sites.optimalKey(url), perms = policy.TRUSTED.tempTwin); - promises.push(ChildPolicies.update(policy)); } capabilities = perms.capabilities; } else { capabilities = intersectCapabilities(perms, request.frameAncestors); } - } else { - if (isMainFrame || type === "sub_frame") { - let unrestricted = ns.unrestrictedTabs.has(tabId) && {unrestricted: true}; - if (unrestricted) { - headersModified = ChildPolicies.addTabInfoCookie(request, unrestricted); - } - } - } + } // else unrestricted, either globally or per-tab if (isMainFrame && !TabStatus.map.has(tabId)) { debug("No TabStatus data yet for noscriptFrame", tabId); TabStatus.record(request, "noscriptFrame", |