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

Unified Diff: chrome/ext/background.js

Issue 5420918314631168: Issue 1372 - Work around a bug in Chrome 38 where 'object' requests have the wrong type (Closed)
Patch Set: Created Sept. 25, 2014, 2:53 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: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -288,7 +288,9 @@
if (details.tabId == -1)
return;
- var isMainFrame = details.type == "main_frame" || (
+ var requestType = details.type;
+ var isMainFrame = requestType == "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".
// https://code.google.com/p/chromium/issues/detail?id=281711
@@ -308,15 +310,24 @@
// is about to load, however if a frame is loading the surrounding
// frame is indicated by parentFrameId instead of frameId
var frameId;
- if (details.type == "sub_frame")
+ if (requestType == "sub_frame")
frameId = details.parentFrameId;
else
frameId = details.frameId;
frame = frames[frameId] || frames[Object.keys(frames)[0]];
- if (frame && !ext.webRequest.onBeforeRequest._dispatch(details.url, details.type, new Page({id: details.tabId}), frame))
- return {cancel: true};
+ if (frame)
+ {
+ // Chrome 38 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
+ if (requestType == "other" && / Chrome\/38\b/.test(navigator.userAgent))
Sebastian Noack 2014/09/25 15:00:53 Just in case you wonder why I didn't used info.pla
Wladimir Palant 2014/09/25 16:18:16 I wonder whether we should really do this for Chro
Sebastian Noack 2014/09/25 16:24:06 In case this isn't fixed in Chrome 39, this workar
+ requestType = "object";
+
+ if (!ext.webRequest.onBeforeRequest._dispatch(details.url, requestType, new Page({id: details.tabId}), frame))
+ return {cancel: true};
+ }
}
if (isMainFrame || details.type == "sub_frame")
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld