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

Unified Diff: include.postload.js

Issue 5945877571043328: Issue 705 - Generate element hiding instead request blocking filters for non-HTTP URLs (Closed)
Patch Set: Rebased Created Oct. 30, 2014, 4:07 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: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -408,11 +408,18 @@
if (url)
{
- clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||"));
+ var src = elt.getAttribute("src");
+ var selector = src && elt.localName + '[src=' + quote(src) + ']';
Wladimir Palant 2014/10/30 22:36:28 elt.localName still needs escaping, DOM methods al
Sebastian Noack 2014/10/31 13:52:49 The syntax for valid tag names is very restrictive
Wladimir Palant 2014/11/03 18:14:28 document.createElement("foo:bar") might still be p
- var src = elt.getAttribute("src");
- if (src)
- selectorList.push('[src=' + quote(src) + ']');
+ if (/^https?:/i.test(url))
+ {
+ clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||"));
+
+ if (selector)
+ selectorList.push(selector);
+ }
+ else if (selector)
+ addSelector(selector);
}
// restore the original style, before generating the fallback filter that
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld