Index: ext/background.js |
=================================================================== |
--- a/ext/background.js |
+++ b/ext/background.js |
@@ -485,16 +485,26 @@ |
{ |
if (windowId != chrome.windows.WINDOW_ID_NONE) |
updateContextMenu(); |
}); |
/* Web requests */ |
+ const resourceTypeMap = Object.freeze(Object.assign(Object.create(null), |
+ { |
+ web_manifest: "OTHER", |
+ xml_dtd: "OTHER", |
+ xslt: "OTHER", |
+ imageset: "IMAGE", |
+ beacon: "PING" |
+ } |
+ )); |
+ |
let framesOfTabs = Object.create(null); |
ext.getFrame = (tabId, frameId) => |
{ |
return (framesOfTabs[tabId] || {})[frameId]; |
}; |
let handlerBehaviorChangedQuota = |
@@ -588,18 +598,20 @@ |
{ |
frameId = details.parentFrameId; |
type = "SUBDOCUMENT"; |
} |
let frame = ext.getFrame(details.tabId, frameId); |
if (frame) |
{ |
+ type = resourceTypeMap[type] || type.toUpperCase(); |
+ |
let results = ext.webRequest.onBeforeRequest._dispatch( |
- url, type.toUpperCase(), new Page({id: details.tabId}), frame |
+ url, type, new Page({id: details.tabId}), frame |
); |
if (results.indexOf(false) != -1) |
return {cancel: true}; |
} |
}, {urls: ["<all_urls>"]}, ["blocking"]); |