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

Delta Between Two Patch Sets: webrequest.js

Issue 11579001: Workaround for Chrome not specifying which request is main_frame under some circumstances (Closed)
Left Patch Set: Created Aug. 28, 2013, 1:04 p.m.
Right Patch Set: Added more checks Created Aug. 30, 2013, 8:24 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 }); 49 });
50 50
51 var frames = {}; 51 var frames = {};
52 52
53 function onBeforeRequest(details) 53 function onBeforeRequest(details)
54 { 54 {
55 if (details.tabId == -1) 55 if (details.tabId == -1)
56 return {}; 56 return {};
57 57
58 var type = details.type; 58 var type = details.type;
59 59
60 // Workaround: Under some circumstances Chrome 29+ gives top frame the 60 // Assume that the first request belongs to the top frame. Chrome may give the
61 // type "object" instead of "main_frame". We work around that by assuming 61 // top frame the type "object" instead of "main_frame".
62 // that the first request belongs to the top frame. 62 // https://code.google.com/p/chromium/issues/detail?id=281711
63 if (!(details.tabId in frames)) 63 if (details.frameId == 0 && !(details.tabId in frames) && type == "object")
Wladimir Palant 2013/08/30 12:16:25 Please ensure details.tabId >= 0, tabId -1 means a
64 type = "main_frame"; 64 type = "main_frame";
Wladimir Palant 2013/08/29 05:57:40 There are two assumption here which both seem to b
65 65
66 if (type == "main_frame" || type == "sub_frame") 66 if (type == "main_frame" || type == "sub_frame")
67 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u rl); 67 recordFrame(details.tabId, details.frameId, details.parentFrameId, details.u rl);
68 68
69 if (type == "main_frame") 69 if (type == "main_frame")
70 return {}; 70 return {};
71 71
72 // Type names match Mozilla's with main_frame and sub_frame being the only exc eptions. 72 // Type names match Mozilla's with main_frame and sub_frame being the only exc eptions.
73 if (type == "sub_frame") 73 if (type == "sub_frame")
74 type = "SUBDOCUMENT"; 74 type = "SUBDOCUMENT";
75 else 75 else
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 parent = frameData.parent; 197 parent = frameData.parent;
198 parentData = getFrameData(tabId, parent); 198 parentData = getFrameData(tabId, parent);
199 199
200 var frameUrl = frameData.url; 200 var frameUrl = frameData.url;
201 var parentUrl = (parentData ? parentData.url : frameUrl); 201 var parentUrl = (parentData ? parentData.url : frameUrl);
202 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) 202 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type))
203 return true; 203 return true;
204 } 204 }
205 return false; 205 return false;
206 } 206 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld