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

Unified Diff: lib/requestBlocker.js

Issue 29463558: Issue 5300 - Add feature detection for object_subrequest (Closed)
Patch Set: Created June 12, 2017, 9:51 a.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: lib/requestBlocker.js
===================================================================
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -24,19 +24,20 @@
const {defaultMatcher} = require("matcher");
const {FilterNotifier} = require("filterNotifier");
const {Prefs} = require("prefs");
const {checkWhitelisted, getKey} = require("whitelisting");
const {stringifyURL, extractHostFromFrame, isThirdParty} = require("url");
const {port} = require("messaging");
const devtools = require("devtools");
-// Chrome and Firefox (WebExtensions) can't distinguish between
-// OBJECT_SUBREQUEST and OBJECT requests.
-RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
+// Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests.
+if (!("OBJECT_SUBREQUEST" in chrome.webRequest.ResourceType))
+ RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
+
Sebastian Noack 2017/06/12 12:20:43 Nit: The extra blank line added here is redundant.
Jon Sonesen 2017/06/12 15:37:47 Acknowledged.
// Map of content types reported by the browser to the respecitve content types
// used by Adblock Plus. Other content types are simply mapped to OTHER.
let resourceTypes = new Map(function*()
{
for (let type in RegExpFilter.typeMap)
yield [type.toLowerCase(), type];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld