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

Delta Between Two Patch Sets: background.js

Issue 5666188336037888: Issue 581 - Fixed element hiding/collapsing in anonymous frames on Chrome (Closed)
Left Patch Set: Rely on document's URL instead frame's src attribute Created June 2, 2014, 10:28 p.m.
Right Patch Set: Addressed comments Created June 17, 2014, 2:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | include.preload.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 { 511 {
512 switch (msg.type) 512 switch (msg.type)
513 { 513 {
514 case "get-selectors": 514 case "get-selectors":
515 var selectors = []; 515 var selectors = [];
516 516
517 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") && 517 if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") &&
518 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) 518 !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE"))
519 { 519 {
520 var noStyleRules = false; 520 var noStyleRules = false;
521 var host = extractHostFromURL(sender.frame.url); 521 var host = extractHostFromFrame(sender.frame);
522 for (var i = 0; i < noStyleRulesHosts.length; i++) 522 for (var i = 0; i < noStyleRulesHosts.length; i++)
523 { 523 {
524 var noStyleHost = noStyleRulesHosts[i]; 524 var noStyleHost = noStyleRulesHosts[i];
525 if (host == noStyleHost || (host.length > noStyleHost.length && 525 if (host == noStyleHost || (host.length > noStyleHost.length &&
526 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost)) 526 host.substr(host.length - noStyleHost.leng th - 1) == "." + noStyleHost))
527 { 527 {
528 noStyleRules = true; 528 noStyleRules = true;
529 } 529 }
530 } 530 }
531 selectors = ElemHide.getSelectorsForDomain(host, false); 531 selectors = ElemHide.getSelectorsForDomain(host, false);
532 if (noStyleRules) 532 if (noStyleRules)
533 { 533 {
534 selectors = selectors.filter(function(s) 534 selectors = selectors.filter(function(s)
535 { 535 {
536 return !/\[style[\^\$]?=/.test(s); 536 return !/\[style[\^\$]?=/.test(s);
537 }); 537 });
538 } 538 }
539 } 539 }
540 540
541 sendResponse(selectors); 541 sendResponse(selectors);
542 break; 542 break;
543 case "should-collapse": 543 case "should-collapse":
544 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) 544 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
545 { 545 {
546 sendResponse(false); 546 sendResponse(false);
547 break; 547 break;
548 } 548 }
549 549
550 var requestHost = extractHostFromURL(msg.url); 550 var requestHost = extractHostFromURL(msg.url);
551 var documentHost = extractHostFromURL(sender.frame.url); 551 var documentHost = extractHostFromFrame(sender.frame);
552 var thirdParty = isThirdParty(requestHost, documentHost); 552 var thirdParty = isThirdParty(requestHost, documentHost);
553 var filter = defaultMatcher.matchesAny(msg.url, msg.mediatype, documentHos t, thirdParty); 553 var filter = defaultMatcher.matchesAny(msg.url, msg.mediatype, documentHos t, thirdParty);
554 if (filter instanceof BlockingFilter) 554 if (filter instanceof BlockingFilter)
555 { 555 {
556 var collapse = filter.collapse; 556 var collapse = filter.collapse;
557 if (collapse == null) 557 if (collapse == null)
558 collapse = Prefs.hidePlaceholders; 558 collapse = Prefs.hidePlaceholders;
559 sendResponse(collapse); 559 sendResponse(collapse);
560 } 560 }
561 else 561 else
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 page.sendMessage({type: "clickhide-deactivate"}); 607 page.sendMessage({type: "clickhide-deactivate"});
608 refreshIconAndContextMenu(page); 608 refreshIconAndContextMenu(page);
609 }); 609 });
610 610
611 setTimeout(function() 611 setTimeout(function()
612 { 612 {
613 var notificationToShow = Notification.getNextToShow(); 613 var notificationToShow = Notification.getNextToShow();
614 if (notificationToShow) 614 if (notificationToShow)
615 showNotification(notificationToShow); 615 showNotification(notificationToShow);
616 }, 3 * 60 * 1000); 616 }, 3 * 60 * 1000);
LEFTRIGHT
« no previous file | include.preload.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld