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: Rebased. Created March 12, 2015, 8:35 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 | popupBlocker.js » ('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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 { 460 {
461 switch (msg.type) 461 switch (msg.type)
462 { 462 {
463 case "get-selectors": 463 case "get-selectors":
464 var selectors = []; 464 var selectors = [];
465 465
466 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") && 466 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") &&
467 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) 467 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE"))
468 { 468 {
469 var noStyleRules = false; 469 var noStyleRules = false;
470 var specificOnly = isFrameWhitelisted(sender.page, sender.frame, "GENERI CHIDE");
470 var host = extractHostFromFrame(sender.frame); 471 var host = extractHostFromFrame(sender.frame);
472
471 for (var i = 0; i < noStyleRulesHosts.length; i++) 473 for (var i = 0; i < noStyleRulesHosts.length; i++)
472 { 474 {
473 var noStyleHost = noStyleRulesHosts[i]; 475 var noStyleHost = noStyleRulesHosts[i];
474 if (host == noStyleHost || (host.length > noStyleHost.length && 476 if (host == noStyleHost || (host.length > noStyleHost.length &&
475 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) 477 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost))
476 { 478 {
477 noStyleRules = true; 479 noStyleRules = true;
478 } 480 }
479 } 481 }
480 selectors = ElemHide.getSelectorsForDomain(host, false); 482 selectors = ElemHide.getSelectorsForDomain(host, specificOnly);
481 if (noStyleRules) 483 if (noStyleRules)
482 { 484 {
483 selectors = selectors.filter(function(s) 485 selectors = selectors.filter(function(s)
484 { 486 {
485 return !/\[style[\^\$]?=/.test(s); 487 return !/\[style[\^\$]?=/.test(s);
486 }); 488 });
487 } 489 }
488 } 490 }
489 491
490 sendResponse(selectors); 492 sendResponse(selectors);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 page.sendMessage({type: "clickhide-deactivate"}); 589 page.sendMessage({type: "clickhide-deactivate"});
588 refreshIconAndContextMenu(page); 590 refreshIconAndContextMenu(page);
589 }); 591 });
590 592
591 setTimeout(function() 593 setTimeout(function()
592 { 594 {
593 var notificationToShow = NotificationStorage.getNextToShow(); 595 var notificationToShow = NotificationStorage.getNextToShow();
594 if (notificationToShow) 596 if (notificationToShow)
595 showNotification(notificationToShow); 597 showNotification(notificationToShow);
596 }, 3 * 60 * 1000); 598 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld