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

Side by Side Diff: background.js

Issue 5138680696012800: Issue 616 - Enforce $generichide and $genericblock in Chrome (Closed)
Patch Set: Updated adblockplustests dependency Created Oct. 5, 2015, 9:52 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dependencies » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 { 298 {
299 switch (msg.type) 299 switch (msg.type)
300 { 300 {
301 case "get-selectors": 301 case "get-selectors":
302 var selectors = []; 302 var selectors = [];
303 303
304 if (!isFrameWhitelisted(sender.page, sender.frame, 304 if (!isFrameWhitelisted(sender.page, sender.frame,
305 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeM ap.ELEMHIDE)) 305 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeM ap.ELEMHIDE))
306 { 306 {
307 var noStyleRules = false; 307 var noStyleRules = false;
308 var specificOnly = isFrameWhitelisted(sender.page, sender.frame,
309 RegExpFilter.typeMap.GENERICHIDE);
308 var host = extractHostFromFrame(sender.frame); 310 var host = extractHostFromFrame(sender.frame);
311
309 for (var i = 0; i < noStyleRulesHosts.length; i++) 312 for (var i = 0; i < noStyleRulesHosts.length; i++)
310 { 313 {
311 var noStyleHost = noStyleRulesHosts[i]; 314 var noStyleHost = noStyleRulesHosts[i];
312 if (host == noStyleHost || (host.length > noStyleHost.length && 315 if (host == noStyleHost || (host.length > noStyleHost.length &&
313 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) 316 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost))
314 { 317 {
315 noStyleRules = true; 318 noStyleRules = true;
316 } 319 }
317 } 320 }
318 selectors = ElemHide.getSelectorsForDomain(host, false); 321 selectors = ElemHide.getSelectorsForDomain(host, specificOnly);
319 if (noStyleRules) 322 if (noStyleRules)
320 { 323 {
321 selectors = selectors.filter(function(s) 324 selectors = selectors.filter(function(s)
322 { 325 {
323 return !/\[style[\^\$]?=/.test(s); 326 return !/\[style[\^\$]?=/.test(s);
324 }); 327 });
325 } 328 }
326 } 329 }
327 330
328 sendResponse(selectors); 331 sendResponse(selectors);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 break; 427 break;
425 } 428 }
426 }); 429 });
427 430
428 // update icon when page changes location 431 // update icon when page changes location
429 ext.pages.onLoading.addListener(function(page) 432 ext.pages.onLoading.addListener(function(page)
430 { 433 {
431 page.sendMessage({type: "clickhide-deactivate"}); 434 page.sendMessage({type: "clickhide-deactivate"});
432 refreshIconAndContextMenu(page); 435 refreshIconAndContextMenu(page);
433 }); 436 });
OLDNEW
« no previous file with comments | « no previous file | dependencies » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld