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

Unified Diff: webrequest.js

Issue 8792018: Topic 11477 - Whitelisting doesn`t deal with frames correctly (Closed)
Patch Set: Created Nov. 6, 2012, 10:13 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 | « background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrequest.js
===================================================================
--- a/webrequest.js
+++ b/webrequest.js
@@ -176,20 +176,24 @@ function checkRequest(type, tabId, url,
var documentHost = extractHostFromURL(documentUrl);
var thirdParty = isThirdParty(requestHost, documentHost);
return defaultMatcher.matchesAny(url, type, documentHost, thirdParty);
}
function isFrameWhitelisted(tabId, frameId, type)
{
var parent = frameId;
- while (parent != -1)
+ 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
+ while (parentData)
{
- var parentData = getFrameData(tabId, parent);
- if (!parentData)
- break;
+ var frame = parent;
+ var frameData = parentData;
- if (isWhitelisted(parentData.url, type) || "keyException" in parentData)
+ parent = frameData.parent;
+ parentData = (parent != -1 ? getFrameData(tabId, parent) : null);
+
+ var frameUrl = frameData.url;
+ 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
+ if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type))
return true;
- parent = parentData.parent;
}
return false;
}
« no previous file with comments | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld