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

Unified Diff: chrome/ext/background.js

Issue 29333035: Issue 3453 - Adapt indistinguishable request types for changes in Chrome 49 (Closed)
Patch Set: Created Dec. 23, 2015, 12:10 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 | safari/ext/background.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -354,27 +354,33 @@
var onBeforeNavigate = chrome.webNavigation.onBeforeNavigate;
if (!onBeforeNavigate.hasListener(propagateHandlerBehaviorChange))
onBeforeNavigate.addListener(propagateHandlerBehaviorChange);
+ },
+ getIndistinguishableTypes: function()
+ {
+ // Chrome 38-48 mistakenly reports requests of type `object`
+ // (e.g. requests initiated by Flash) with the type `other`.
+ // https://code.google.com/p/chromium/issues/detail?id=410382
+ var match = navigator.userAgent.match(/\bChrome\/(\d+)/);
kzar 2015/12/23 14:43:20 We already parse the application name and version
Sebastian Noack 2015/12/23 14:46:56 adblockplus.js (including the info module) depends
kzar 2015/12/23 14:56:42 Acknowledged.
+ if (match)
+ {
+ var version = parseInt(match[1], 10);
+ if (version >= 38 && version <= 48)
+ return [["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]];
+ }
+
+ // Before Chrome 49, requests of the type `font` and `ping`
+ // have been reported with the type `other`.
+ // https://code.google.com/p/chromium/issues/detail?id=410382
+ var otherTypes = ["OTHER", "MEDIA"];
+ if (!("FONT" in chrome.webRequest.ResourceType))
+ otherTypes.push("FONT");
+ if (!("PING" in chrome.webRequest.ResourceType))
+ otherTypes.push("PING");
+
+ return [["OBJECT", "OBJECT_SUBREQUEST"], otherTypes];
Wladimir Palant 2015/12/23 12:50:51 This logic is very hard to follow, and I'm not rea
Sebastian Noack 2015/12/23 13:08:43 This won't work. If the workaround for Chrome 38-4
}
};
- // Since Chrome 38 requests of type 'object' (e.g. requests
- // initiated by Flash) are mistakenly reported with the type 'other'.
- // https://code.google.com/p/chromium/issues/detail?id=410382
- var match = navigator.userAgent.match(/\bChrome\/(\d+)/);
- if (match && parseInt(match[1], 10) >= 38)
- {
- ext.webRequest.indistinguishableTypes = [
- ["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]
- ];
- }
- else
- {
- ext.webRequest.indistinguishableTypes = [
- ["OBJECT", "OBJECT_SUBREQUEST"],
- ["OTHER", "MEDIA", "FONT"]
- ];
- }
-
chrome.tabs.query({}, function(tabs)
{
tabs.forEach(function(tab)
« no previous file with comments | « no previous file | safari/ext/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld