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

Unified Diff: chrome/ext/background.js

Issue 5192819564085248: Issue 2063 - Make ext.webRequest use ABP instead Chrome request types (Closed)
Patch Set: Created Feb. 28, 2015, 9:55 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 | safari/ext/content.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
@@ -366,8 +366,7 @@
if (details.tabId == -1)
return;
- var requestType = details.type;
- var isMainFrame = requestType == "main_frame" || (
+ var isMainFrame = details.type == "main_frame" || (
// assume that the first request belongs to the top frame. Chrome
// may give the top frame the type "object" instead of "main_frame".
@@ -389,10 +388,17 @@
// is about to load, however if a frame is loading the surrounding
// frame is indicated by parentFrameId instead of frameId
var frameId;
- if (requestType == "sub_frame")
+ var requestType;
+ if (details.type == "sub_frame")
+ {
frameId = details.parentFrameId;
+ requestType = "SUBDOCUMENT";
+ }
else
+ {
frameId = details.frameId;
+ requestType = details.type.toUpperCase();
+ }
frame = frames[frameId] || frames[Object.keys(frames)[0]];
@@ -401,8 +407,8 @@
// 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
- if (requestType == "other" && parseInt(navigator.userAgent.match(/\bChrome\/(\d+)/)[1], 10) >= 38)
- requestType = "object";
+ if (requestType == "OTHER" && parseInt(navigator.userAgent.match(/\bChrome\/(\d+)/)[1], 10) >= 38)
+ requestType = "OBJECT";
var results = ext.webRequest.onBeforeRequest._dispatch(
url,
« no previous file with comments | « no previous file | safari/ext/content.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld