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

Unified Diff: background.js

Issue 4734012065054720: Issue 2634 - Consider alternative URLs for element collapsing (Closed)
Patch Set: Consider all URLs for element collapsing Created June 7, 2015, 3:14 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 | include.postload.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
@@ -333,22 +333,30 @@
break;
}
- var url = new URL(msg.url);
var documentHost = extractHostFromFrame(sender.frame);
- var filter = defaultMatcher.matchesAny(
- stringifyURL(url), msg.mediatype,
- documentHost, isThirdParty(url, documentHost)
- );
+ var blocked = false;
- if (filter instanceof BlockingFilter)
+ for (var i = 0; i < msg.urls.length; i++)
{
- var collapse = filter.collapse;
- if (collapse == null)
- collapse = Prefs.hidePlaceholders;
- sendResponse(collapse);
+ var url = new URL(msg.urls[i], msg.baseURL);
+ var filter = defaultMatcher.matchesAny(
+ stringifyURL(url), msg.mediatype,
+ documentHost, isThirdParty(url, documentHost)
+ );
+
+ if (filter instanceof BlockingFilter)
+ {
+ if (filter.collapse != null)
+ {
+ sendResponse(filter.collapse);
+ return;
+ }
+
+ blocked = true;
+ }
}
- else
- sendResponse(false);
+
+ sendResponse(blocked && Prefs.hidePlaceholders);
break;
case "get-domain-enabled-state":
// Returns whether this domain is in the exclusion list.
« no previous file with comments | « no previous file | include.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld