From f0f6585314a4c1585aeb3fdae163da8f3e04c2c7 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 30 Sep 2019 08:47:36 +0200 Subject: Make policy fetching resilient to missing tab information. --- src/bg/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/bg') 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(); -- cgit v1.2.3