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 and fixed documentation mistakenly indicating arguments as optional Created Feb. 28, 2015, 5:52 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 63
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 selectors = ElemHide.getSelectorsForDomain(host, false); 484 selectors = ElemHide.getSelectorsForDomain(host, false);
480 if (noStyleRules) 485 if (noStyleRules)
481 { 486 {
482 selectors = selectors.filter(function(s) 487 selectors = selectors.filter(function(s)
483 { 488 {
484 return !/\[style[\^\$]?=/.test(s); 489 return !/\[style[\^\$]?=/.test(s);
485 }); 490 });
486 } 491 }
487 } 492 }
488 493
489 sendResponse(selectors); 494 sendResponse({selectors: selectors, trace: hasDevToolsPanel(sender.page)}) ;
490 break; 495 break;
491 case "should-collapse": 496 case "should-collapse":
492 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) 497 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
493 { 498 {
494 sendResponse(false); 499 sendResponse(false);
495 break; 500 break;
496 } 501 }
497 502
498 var url = new URL(msg.url); 503 var url = new URL(msg.url);
499 var documentHost = extractHostFromFrame(sender.frame); 504 var documentHost = extractHostFromFrame(sender.frame);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 page.sendMessage(msg); 549 page.sendMessage(msg);
545 }); 550 });
546 break; 551 break;
547 case "add-sitekey": 552 case "add-sitekey":
548 processKey(msg.token, sender.page, sender.frame); 553 processKey(msg.token, sender.page, sender.frame);
549 break; 554 break;
550 case "report-html-page": 555 case "report-html-page":
551 htmlPages.set(sender.page, null); 556 htmlPages.set(sender.page, null);
552 refreshIconAndContextMenu(sender.page); 557 refreshIconAndContextMenu(sender.page);
553 break; 558 break;
559 case "trace-elemhide":
560 logHiddenElements(sender.page, msg.selectors, extractHostFromFrame(sender. frame));
561 break;
554 case "forward": 562 case "forward":
555 if (sender.page) 563 if (sender.page)
556 { 564 {
557 if (msg.expectsResponse) 565 if (msg.expectsResponse)
558 { 566 {
559 sender.page.sendMessage(msg.payload, sendResponse); 567 sender.page.sendMessage(msg.payload, sendResponse);
560 return true; 568 return true;
561 } 569 }
562 570
563 sender.page.sendMessage(msg.payload); 571 sender.page.sendMessage(msg.payload);
564 } 572 }
565 break; 573 break;
566 } 574 }
567 }); 575 });
568 576
569 // update icon when page changes location 577 // update icon when page changes location
570 ext.pages.onLoading.addListener(function(page) 578 ext.pages.onLoading.addListener(function(page)
571 { 579 {
572 page.sendMessage({type: "clickhide-deactivate"}); 580 page.sendMessage({type: "clickhide-deactivate"});
573 refreshIconAndContextMenu(page); 581 refreshIconAndContextMenu(page);
574 }); 582 });
575 583
576 setTimeout(function() 584 setTimeout(function()
577 { 585 {
578 var notificationToShow = NotificationStorage.getNextToShow(); 586 var notificationToShow = NotificationStorage.getNextToShow();
579 if (notificationToShow) 587 if (notificationToShow)
580 showNotification(notificationToShow); 588 showNotification(notificationToShow);
581 }, 3 * 60 * 1000); 589 }, 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