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

Delta Between Two Patch Sets: webrequest.js

Issue 8792018: Topic 11477 - Whitelisting doesn`t deal with frames correctly (Closed)
Left Patch Set: Created Nov. 6, 2012, 10:13 a.m.
Right Patch Set: Created Nov. 6, 2012, 11:05 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 | « background.js ('k') | 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 the Adblock Plus extension, 2 * This file is part of the Adblock Plus extension,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 var requestHost = extractHostFromURL(url); 175 var requestHost = extractHostFromURL(url);
176 var documentHost = extractHostFromURL(documentUrl); 176 var documentHost = extractHostFromURL(documentUrl);
177 var thirdParty = isThirdParty(requestHost, documentHost); 177 var thirdParty = isThirdParty(requestHost, documentHost);
178 return defaultMatcher.matchesAny(url, type, documentHost, thirdParty); 178 return defaultMatcher.matchesAny(url, type, documentHost, thirdParty);
179 } 179 }
180 180
181 function isFrameWhitelisted(tabId, frameId, type) 181 function isFrameWhitelisted(tabId, frameId, type)
182 { 182 {
183 var parent = frameId; 183 var parent = frameId;
184 var parentData = getFrameData(tabId, parent); 184 var parentData = getFrameData(tabId, parent);
Felix Dahlke 2012/11/06 10:20:59 Can the supplied frameId be -1? The previous versi
Wladimir Palant 2012/11/06 11:02:02 Yes, it could be -1. getFrameData() will return nu
185 while (parentData) 185 while (parentData)
186 { 186 {
187 var frame = parent; 187 var frame = parent;
188 var frameData = parentData; 188 var frameData = parentData;
189 189
190 parent = frameData.parent; 190 parent = frameData.parent;
191 parentData = (parent != -1 ? getFrameData(tabId, parent) : null); 191 parentData = getFrameData(tabId, parent);
192 192
193 var frameUrl = frameData.url; 193 var frameUrl = frameData.url;
194 var parentUrl = (parentData ? parentData.url : frameUrl); 194 var parentUrl = (parentData ? parentData.url : frameUrl);
Felix Dahlke 2012/11/06 10:20:59 Shouldn't parentUrl be null if there is no parent?
Wladimir Palant 2012/11/06 11:02:02 I considered this but decided that it would be bet
195 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) 195 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type))
196 return true; 196 return true;
197 } 197 }
198 return false; 198 return false;
199 } 199 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld