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: Created March 11, 2015, 5:09 p.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 | webrequest.js » ('j') | webrequest.js » ('J')
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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 { 464 {
465 switch (msg.type) 465 switch (msg.type)
466 { 466 {
467 case "get-selectors": 467 case "get-selectors":
468 var selectors = []; 468 var selectors = [];
469 469
470 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") && 470 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") &&
471 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) 471 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE"))
472 { 472 {
473 var noStyleRules = false; 473 var noStyleRules = false;
474 var specificOnly = isFrameWhitelisted(sender.page, sender.frame, "GENERI CHIDE");
Sebastian Noack 2015/03/12 12:36:12 I'm concerned about the performance implications r
kzar 2015/03/12 19:22:45 That sound sensible to me but as you mentioned to
474 var host = extractHostFromFrame(sender.frame); 475 var host = extractHostFromFrame(sender.frame);
476
475 for (var i = 0; i < noStyleRulesHosts.length; i++) 477 for (var i = 0; i < noStyleRulesHosts.length; i++)
476 { 478 {
477 var noStyleHost = noStyleRulesHosts[i]; 479 var noStyleHost = noStyleRulesHosts[i];
478 if (host == noStyleHost || (host.length > noStyleHost.length && 480 if (host == noStyleHost || (host.length > noStyleHost.length &&
479 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) 481 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost))
480 { 482 {
481 noStyleRules = true; 483 noStyleRules = true;
482 } 484 }
483 } 485 }
484 selectors = ElemHide.getSelectorsForDomain(host, false); 486 selectors = ElemHide.getSelectorsForDomain(host, specificOnly);
485 if (noStyleRules) 487 if (noStyleRules)
486 { 488 {
487 selectors = selectors.filter(function(s) 489 selectors = selectors.filter(function(s)
488 { 490 {
489 return !/\[style[\^\$]?=/.test(s); 491 return !/\[style[\^\$]?=/.test(s);
490 }); 492 });
491 } 493 }
492 } 494 }
493 495
494 sendResponse(selectors); 496 sendResponse(selectors);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 page.sendMessage({type: "clickhide-deactivate"}); 579 page.sendMessage({type: "clickhide-deactivate"});
578 refreshIconAndContextMenu(page); 580 refreshIconAndContextMenu(page);
579 }); 581 });
580 582
581 setTimeout(function() 583 setTimeout(function()
582 { 584 {
583 var notificationToShow = NotificationStorage.getNextToShow(); 585 var notificationToShow = NotificationStorage.getNextToShow();
584 if (notificationToShow) 586 if (notificationToShow)
585 showNotification(notificationToShow); 587 showNotification(notificationToShow);
586 }, 3 * 60 * 1000); 588 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | webrequest.js » ('j') | webrequest.js » ('J')

Powered by Google App Engine
This is Rietveld