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

Side by Side Diff: background.js

Issue 6393086494113792: Issue 154 - Added devtools panel showing blocked and blockable items (Closed)
Patch Set: Use unprefixed flexbox Created Jan. 6, 2015, 6:08 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 | chrome/devtools/devtools.html » ('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 <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 17 matching lines...) Expand all
28 this.DownloadableSubscription = DownloadableSubscription; 28 this.DownloadableSubscription = DownloadableSubscription;
29 this.SpecialSubscription = SpecialSubscription; 29 this.SpecialSubscription = SpecialSubscription;
30 } 30 }
31 with(require("whitelisting")) 31 with(require("whitelisting"))
32 { 32 {
33 this.isWhitelisted = isWhitelisted; 33 this.isWhitelisted = isWhitelisted;
34 this.isFrameWhitelisted = isFrameWhitelisted; 34 this.isFrameWhitelisted = isFrameWhitelisted;
35 this.processKey = processKey; 35 this.processKey = processKey;
36 this.getKey = getKey; 36 this.getKey = getKey;
37 } 37 }
38 with(require("devtools"))
39 {
40 this.hasPanel = hasPanel;
41 this.logHiddenElements = logHiddenElements;
42 }
38 var FilterStorage = require("filterStorage").FilterStorage; 43 var FilterStorage = require("filterStorage").FilterStorage;
39 var ElemHide = require("elemHide").ElemHide; 44 var ElemHide = require("elemHide").ElemHide;
40 var defaultMatcher = require("matcher").defaultMatcher; 45 var defaultMatcher = require("matcher").defaultMatcher;
41 var Prefs = require("prefs").Prefs; 46 var Prefs = require("prefs").Prefs;
42 var Synchronizer = require("synchronizer").Synchronizer; 47 var Synchronizer = require("synchronizer").Synchronizer;
43 var Utils = require("utils").Utils; 48 var Utils = require("utils").Utils;
44 var Notification = require("notification").Notification; 49 var Notification = require("notification").Notification;
45 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication; 50 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication;
46 var parseFilters = require("filterValidation").parseFilters; 51 var parseFilters = require("filterValidation").parseFilters;
47 52
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 selectors = ElemHide.getSelectorsForDomain(host, false); 494 selectors = ElemHide.getSelectorsForDomain(host, false);
490 if (noStyleRules) 495 if (noStyleRules)
491 { 496 {
492 selectors = selectors.filter(function(s) 497 selectors = selectors.filter(function(s)
493 { 498 {
494 return !/\[style[\^\$]?=/.test(s); 499 return !/\[style[\^\$]?=/.test(s);
495 }); 500 });
496 } 501 }
497 } 502 }
498 503
499 sendResponse(selectors); 504 sendResponse({selectors: selectors, trace: hasPanel(sender.page)});
500 break; 505 break;
501 case "should-collapse": 506 case "should-collapse":
502 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) 507 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
503 { 508 {
504 sendResponse(false); 509 sendResponse(false);
505 break; 510 break;
506 } 511 }
507 512
508 var requestHost = extractHostFromURL(msg.url); 513 var requestHost = extractHostFromURL(msg.url);
509 var documentHost = extractHostFromFrame(sender.frame); 514 var documentHost = extractHostFromFrame(sender.frame);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 page.sendMessage(msg); 556 page.sendMessage(msg);
552 }); 557 });
553 break; 558 break;
554 case "add-sitekey": 559 case "add-sitekey":
555 processKey(msg.token, sender.page, sender.frame); 560 processKey(msg.token, sender.page, sender.frame);
556 break; 561 break;
557 case "report-html-page": 562 case "report-html-page":
558 htmlPages.set(sender.page, null); 563 htmlPages.set(sender.page, null);
559 refreshIconAndContextMenu(sender.page); 564 refreshIconAndContextMenu(sender.page);
560 break; 565 break;
566 case "trace-elemhide":
567 logHiddenElements(sender.page._id, msg.selectors, extractHostFromFrame(sen der.frame));
568 break;
561 case "forward": 569 case "forward":
562 if (sender.page) 570 if (sender.page)
563 { 571 {
564 sender.page.sendMessage(msg.payload, sendResponse); 572 sender.page.sendMessage(msg.payload, sendResponse);
565 // Return true to indicate that we want to call 573 // Return true to indicate that we want to call
566 // sendResponse asynchronously 574 // sendResponse asynchronously
567 return true; 575 return true;
568 } 576 }
569 break; 577 break;
570 default: 578 default:
571 sendResponse({}); 579 sendResponse({});
572 break; 580 break;
573 } 581 }
574 }); 582 });
575 583
576 // update icon when page changes location 584 // update icon when page changes location
577 ext.pages.onLoading.addListener(function(page) 585 ext.pages.onLoading.addListener(function(page)
578 { 586 {
579 page.sendMessage({type: "clickhide-deactivate"}); 587 page.sendMessage({type: "clickhide-deactivate"});
580 refreshIconAndContextMenu(page); 588 refreshIconAndContextMenu(page);
581 }); 589 });
582 590
583 setTimeout(function() 591 setTimeout(function()
584 { 592 {
585 var notificationToShow = Notification.getNextToShow(); 593 var notificationToShow = Notification.getNextToShow();
586 if (notificationToShow) 594 if (notificationToShow)
587 showNotification(notificationToShow); 595 showNotification(notificationToShow);
588 }, 3 * 60 * 1000); 596 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | chrome/devtools/devtools.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld