Fallback context to same URL when documentUrl is missing.
This commit is contained in:
parent
9c7fd70d57
commit
cd30505fe1
|
@ -231,9 +231,9 @@
|
||||||
policyContext(contextualData) {
|
policyContext(contextualData) {
|
||||||
// contextualData (e.g. a request details object) must contain a tab, a tabId or a documentUrl
|
// contextualData (e.g. a request details object) must contain a tab, a tabId or a documentUrl
|
||||||
// (used as a fallback if tab's top URL cannot be retrieved, e.g. in service workers)
|
// (used as a fallback if tab's top URL cannot be retrieved, e.g. in service workers)
|
||||||
let {tab, tabId, documentUrl} = contextualData;
|
let {tab, tabId, documentUrl, url} = contextualData;
|
||||||
if (!tab) tab = tabId !== -1 && TabCache.get(tabId);
|
if (!tab) tab = tabId !== -1 && TabCache.get(tabId);
|
||||||
return tab && tab.url || documentUrl;
|
return tab && tab.url || documentUrl || url;
|
||||||
},
|
},
|
||||||
requestCan(request, capability) {
|
requestCan(request, capability) {
|
||||||
return !this.isEnforced(request.tabId) || this.policy.can(request.url, capability, this.policyContext(request));
|
return !this.isEnforced(request.tabId) || this.policy.can(request.url, capability, this.policyContext(request));
|
||||||
|
|
Loading…
Reference in New Issue