diff options
Diffstat (limited to 'src/bg/RequestGuard.js')
-rw-r--r-- | src/bg/RequestGuard.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index a174eba..d27bacb 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -20,7 +20,10 @@ var RequestGuard = (() => { media: "media", other: "", }; - const allTypes = Object.keys(policyTypesMap); + const allTypes = UA.isMozilla ? Object.keys(policyTypesMap) + : ["main_frame", "sub_frame", "stylesheet", "script", "image", "font", + "object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "other"]; + Object.assign(policyTypesMap, {"webgl": "webgl"}); // fake types const TabStatus = { map: new Map(), @@ -254,7 +257,7 @@ var RequestGuard = (() => { return redirected; } const ABORT = {cancel: true}, ALLOW = {}; - const INTERNAL_SCHEME = /^(?:chrome|resource|moz-extension|about):/; + const INTERNAL_SCHEME = /^(?:chrome|resource|(?:moz|chrome)-extension|about):/; const listeners = { onBeforeRequest(request) { try { @@ -326,7 +329,7 @@ var RequestGuard = (() => { capabilities = perms.capabilities; } else { capabilities = perms.capabilities; - if (frameAncestors.length > 0) { + if (frameAncestors && frameAncestors.length > 0) { // cascade top document's restrictions to subframes let topUrl = frameAncestors.pop().url; let topPerms = policy.get(topUrl, topUrl).perms; |