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

Unified Diff: background.js

Issue 8792018: Topic 11477 - Whitelisting doesn`t deal with frames correctly (Closed)
Patch Set: Created Nov. 6, 2012, 11:05 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 | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -82,27 +82,28 @@ function setDefaultOptions()
}
// Upgrade options before we do anything else.
setDefaultOptions();
/**
* Checks whether a page is whitelisted.
* @param {String} url
+ * @param {String} [parentUrl] URL of the parent frame
* @param {String} [type] content type to be checked, default is "DOCUMENT"
* @return {Filter} filter that matched the URL or null if not whitelisted
*/
-function isWhitelisted(url, type)
+function isWhitelisted(url, parentUrl, type)
{
// Ignore fragment identifier
var index = url.indexOf("#");
if (index >= 0)
url = url.substring(0, index);
- var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFromURL(url), false);
+ var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFromURL(parentUrl || url), false);
return (result instanceof WhitelistFilter ? result : null);
}
// Adds or removes page action icon according to options.
function refreshIconAndContextMenu(tab)
{
// The tab could have been closed by the time this function is called
if(!tab)
« no previous file with comments | « no previous file | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld