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