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: Rebased Created Feb. 13, 2015, 4:16 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.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 <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 29 matching lines...) Expand all
40 this.stringifyURL = stringifyURL; 40 this.stringifyURL = stringifyURL;
41 this.isThirdParty = isThirdParty; 41 this.isThirdParty = isThirdParty;
42 this.extractHostFromFrame = extractHostFromFrame; 42 this.extractHostFromFrame = extractHostFromFrame;
43 } 43 }
44 with(require("icon")) 44 with(require("icon"))
45 { 45 {
46 this.updateIcon = updateIcon; 46 this.updateIcon = updateIcon;
47 this.startIconAnimation = startIconAnimation; 47 this.startIconAnimation = startIconAnimation;
48 this.stopIconAnimation = stopIconAnimation; 48 this.stopIconAnimation = stopIconAnimation;
49 } 49 }
50 with(require("devtools"))
51 {
52 this.hasDevToolsPanel = hasDevToolsPanel;
53 this.logHiddenElements = logHiddenElements;
54 }
50 var FilterStorage = require("filterStorage").FilterStorage; 55 var FilterStorage = require("filterStorage").FilterStorage;
51 var ElemHide = require("elemHide").ElemHide; 56 var ElemHide = require("elemHide").ElemHide;
52 var defaultMatcher = require("matcher").defaultMatcher; 57 var defaultMatcher = require("matcher").defaultMatcher;
53 var Prefs = require("prefs").Prefs; 58 var Prefs = require("prefs").Prefs;
54 var Synchronizer = require("synchronizer").Synchronizer; 59 var Synchronizer = require("synchronizer").Synchronizer;
55 var Utils = require("utils").Utils; 60 var Utils = require("utils").Utils;
56 var NotificationStorage = require("notification").Notification; 61 var NotificationStorage = require("notification").Notification;
57 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication; 62 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti fication;
58 var parseFilters = require("filterValidation").parseFilters; 63 var parseFilters = require("filterValidation").parseFilters;
59 64
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 selectors = ElemHide.getSelectorsForDomain(host, false); 489 selectors = ElemHide.getSelectorsForDomain(host, false);
485 if (noStyleRules) 490 if (noStyleRules)
486 { 491 {
487 selectors = selectors.filter(function(s) 492 selectors = selectors.filter(function(s)
488 { 493 {
489 return !/\[style[\^\$]?=/.test(s); 494 return !/\[style[\^\$]?=/.test(s);
490 }); 495 });
491 } 496 }
492 } 497 }
493 498
494 sendResponse(selectors); 499 sendResponse({selectors: selectors, trace: hasDevToolsPanel(sender.page)}) ;
495 break; 500 break;
496 case "should-collapse": 501 case "should-collapse":
497 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) 502 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
498 { 503 {
499 sendResponse(false); 504 sendResponse(false);
500 break; 505 break;
501 } 506 }
502 507
503 var url = new URL(msg.url); 508 var url = new URL(msg.url);
504 var documentHost = extractHostFromFrame(sender.frame); 509 var documentHost = extractHostFromFrame(sender.frame);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 page.sendMessage(msg); 554 page.sendMessage(msg);
550 }); 555 });
551 break; 556 break;
552 case "add-sitekey": 557 case "add-sitekey":
553 processKey(msg.token, sender.page, sender.frame); 558 processKey(msg.token, sender.page, sender.frame);
554 break; 559 break;
555 case "report-html-page": 560 case "report-html-page":
556 htmlPages.set(sender.page, null); 561 htmlPages.set(sender.page, null);
557 refreshIconAndContextMenu(sender.page); 562 refreshIconAndContextMenu(sender.page);
558 break; 563 break;
564 case "trace-elemhide":
565 logHiddenElements(sender.page, msg.selectors, extractHostFromFrame(sender. frame));
566 break;
559 case "forward": 567 case "forward":
560 if (sender.page) 568 if (sender.page)
561 { 569 {
562 if (msg.expectsResponse) 570 if (msg.expectsResponse)
563 { 571 {
564 sender.page.sendMessage(msg.payload, sendResponse); 572 sender.page.sendMessage(msg.payload, sendResponse);
565 return true; 573 return true;
566 } 574 }
567 575
568 sender.page.sendMessage(msg.payload); 576 sender.page.sendMessage(msg.payload);
569 } 577 }
570 break; 578 break;
571 } 579 }
572 }); 580 });
573 581
574 // update icon when page changes location 582 // update icon when page changes location
575 ext.pages.onLoading.addListener(function(page) 583 ext.pages.onLoading.addListener(function(page)
576 { 584 {
577 page.sendMessage({type: "clickhide-deactivate"}); 585 page.sendMessage({type: "clickhide-deactivate"});
578 refreshIconAndContextMenu(page); 586 refreshIconAndContextMenu(page);
579 }); 587 });
580 588
581 setTimeout(function() 589 setTimeout(function()
582 { 590 {
583 var notificationToShow = NotificationStorage.getNextToShow(); 591 var notificationToShow = NotificationStorage.getNextToShow();
584 if (notificationToShow) 592 if (notificationToShow)
585 showNotification(notificationToShow); 593 showNotification(notificationToShow);
586 }, 3 * 60 * 1000); 594 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | chrome/devtools.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld