Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29421712: Issue 5184 - Support Firefox-specific webRequest types (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created April 25, 2017, 4:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld