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

Unified Diff: background.js

Issue 29338761: Issue 3841 - Remove workaround stripping [style] selectors on certain websites (Closed)
Patch Set: Created March 19, 2016, 8:16 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: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -43,10 +43,6 @@
var port = require("messaging").port;
var devtools = require("devtools");
-// Special-case domains for which we cannot use style-based hiding rules.
-// See http://crbug.com/68705.
-var noStyleRulesHosts = ["mail.google.com", "mail.yahoo.com", "www.google.com"];
-
var htmlPages = new ext.PageMap();
var contextMenuItem = {
@@ -116,36 +112,19 @@
port.on("get-selectors", function(msg, sender)
{
- var selectors = [];
+ var selectors;
var trace = devtools && devtools.hasPanel(sender.page);
if (!checkWhitelisted(sender.page, sender.frame,
RegExpFilter.typeMap.DOCUMENT |
RegExpFilter.typeMap.ELEMHIDE))
- {
- var noStyleRules = false;
- var specificOnly = checkWhitelisted(sender.page, sender.frame,
- RegExpFilter.typeMap.GENERICHIDE);
- var host = extractHostFromFrame(sender.frame);
-
- for (var i = 0; i < noStyleRulesHosts.length; i++)
- {
- var noStyleHost = noStyleRulesHosts[i];
- if (host == noStyleHost || (host.length > noStyleHost.length &&
- host.substr(host.length - noStyleHost.length - 1) == "." + noStyleHost))
- {
- noStyleRules = true;
- }
- }
- selectors = ElemHide.getSelectorsForDomain(host, specificOnly);
- if (noStyleRules)
- {
- selectors = selectors.filter(function(s)
- {
- return !/\[style[\^\$]?=/.test(s);
- });
- }
- }
+ selectors = ElemHide.getSelectorsForDomain(
+ extractHostFromFrame(sender.frame),
+ checkWhitelisted(sender.page, sender.frame,
+ RegExpFilter.typeMap.GENERICHIDE)
+ );
+ else
+ selectors = [];
return {selectors: selectors, trace: trace};
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld