diff --git a/src/bg/main.js b/src/bg/main.js index 6b91524..927b3d7 100644 --- a/src/bg/main.js +++ b/src/bg/main.js @@ -218,8 +218,19 @@ fallback: true }; } - let topUrl = frameId === 0 ? contextUrl : tab && (tab.url || TabCache.get(tab.id)); - if (Sites.isInternal(url) || !ns.isEnforced(tab ? tab.id : -1)) { + + let tabId = tab ? tab.id : -1; + let topUrl; + if (frameId === 0) { + topUrl = url; + } else if (tab) { + if (!tab.url) tab = TabCache.get(tabId); + if (tab) topUrl = tab.url; + } + if (!topUrl) topUrl = url; + if (!contextUrl) contextUrl = topUrl; + + if (Sites.isInternal(url) || !ns.isEnforced(tabId)) { policy = null; }