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

Unified Diff: chrome/ext/background.js

Issue 29334532: Issue 3580 - Handle missing chrome.webRequest.ResourceType on old Chrome versions (Closed)
Patch Set: Created Jan. 26, 2016, 10:33 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: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -376,13 +376,16 @@
return [["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]];
}
+ // Chrome <44 doesn't have ResourceType.
+ var ResourceType = chrome.webRequest.ResourceType || {};
+
// 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))
+ if (!("FONT" in ResourceType))
otherTypes.push("FONT");
- if (!("PING" in chrome.webRequest.ResourceType))
+ if (!("PING" in ResourceType))
otherTypes.push("PING");
return [["OBJECT", "OBJECT_SUBREQUEST"], otherTypes];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld