diff options
author | hackademix | 2019-09-30 08:47:36 +0200 |
---|---|---|
committer | hackademix | 2019-09-30 08:47:36 +0200 |
commit | f0f6585314a4c1585aeb3fdae163da8f3e04c2c7 (patch) | |
tree | 4f73e991210b6ff84d15f3b998b8ab47ae646394 | |
parent | 54dc58393a7922de27bf9f37f5f497a7f43d3131 (diff) | |
download | noscript-f0f6585314a4c1585aeb3fdae163da8f3e04c2c7.tar.gz noscript-f0f6585314a4c1585aeb3fdae163da8f3e04c2c7.tar.xz noscript-f0f6585314a4c1585aeb3fdae163da8f3e04c2c7.zip |
Make policy fetching resilient to missing tab information.
-rw-r--r-- | src/bg/main.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bg/main.js b/src/bg/main.js index 9c30d4f..5e1b692 100644 --- a/src/bg/main.js +++ b/src/bg/main.js @@ -141,16 +141,16 @@ }, fetchChildPolicy({url, contextUrl}, sender) { - let {tab} = sender; - let topUrl = tab.url || TabCache.get(tab.id); - let policy = !Sites.isInternal(url) && ns.isEnforced(tab.id) + let {tab, frameId} = sender; + let topUrl = frameId === 0 ? contextUrl : tab && (tab.url || TabCache.get(tab.id)); + let policy = !Sites.isInternal(url) && ns.isEnforced(tab ? tab.id : -1) ? ns.policy : null; let permissions, unrestricted, cascaded; if (policy) { let perms = policy.get(url, contextUrl).perms; - cascaded = ns.sync.cascadeRestrictions; - if (topUrl && cascaded) { + cascaded = topUrl && ns.sync.cascadeRestrictions; + if (cascaded) { perms = policy.cascadeRestrictions(perms, topUrl); } permissions = perms.dry(); |