| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 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("url")) | 38 with(require("url")) |
| 39 { | 39 { |
| 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("devtools")) |
| 45 { |
| 46 this.hasDevToolsPanel = hasDevToolsPanel; |
| 47 this.logHiddenElements = logHiddenElements; |
| 48 } |
| 44 var FilterStorage = require("filterStorage").FilterStorage; | 49 var FilterStorage = require("filterStorage").FilterStorage; |
| 45 var ElemHide = require("elemHide").ElemHide; | 50 var ElemHide = require("elemHide").ElemHide; |
| 46 var defaultMatcher = require("matcher").defaultMatcher; | 51 var defaultMatcher = require("matcher").defaultMatcher; |
| 47 var Prefs = require("prefs").Prefs; | 52 var Prefs = require("prefs").Prefs; |
| 48 var Synchronizer = require("synchronizer").Synchronizer; | 53 var Synchronizer = require("synchronizer").Synchronizer; |
| 49 var Utils = require("utils").Utils; | 54 var Utils = require("utils").Utils; |
| 50 var NotificationStorage = require("notification").Notification; | 55 var NotificationStorage = require("notification").Notification; |
| 51 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; | 56 var initAntiAdblockNotification = require("antiadblockInit").initAntiAdblockNoti
fication; |
| 52 var parseFilters = require("filterValidation").parseFilters; | 57 var parseFilters = require("filterValidation").parseFilters; |
| 53 | 58 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 selectors = ElemHide.getSelectorsForDomain(host, false); | 495 selectors = ElemHide.getSelectorsForDomain(host, false); |
| 491 if (noStyleRules) | 496 if (noStyleRules) |
| 492 { | 497 { |
| 493 selectors = selectors.filter(function(s) | 498 selectors = selectors.filter(function(s) |
| 494 { | 499 { |
| 495 return !/\[style[\^\$]?=/.test(s); | 500 return !/\[style[\^\$]?=/.test(s); |
| 496 }); | 501 }); |
| 497 } | 502 } |
| 498 } | 503 } |
| 499 | 504 |
| 500 sendResponse(selectors); | 505 sendResponse({selectors: selectors, trace: hasDevToolsPanel(sender.page)})
; |
| 501 break; | 506 break; |
| 502 case "should-collapse": | 507 case "should-collapse": |
| 503 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) | 508 if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT")) |
| 504 { | 509 { |
| 505 sendResponse(false); | 510 sendResponse(false); |
| 506 break; | 511 break; |
| 507 } | 512 } |
| 508 | 513 |
| 509 var url = new URL(msg.url); | 514 var url = new URL(msg.url); |
| 510 var documentHost = extractHostFromFrame(sender.frame); | 515 var documentHost = extractHostFromFrame(sender.frame); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 page.sendMessage(msg); | 560 page.sendMessage(msg); |
| 556 }); | 561 }); |
| 557 break; | 562 break; |
| 558 case "add-sitekey": | 563 case "add-sitekey": |
| 559 processKey(msg.token, sender.page, sender.frame); | 564 processKey(msg.token, sender.page, sender.frame); |
| 560 break; | 565 break; |
| 561 case "report-html-page": | 566 case "report-html-page": |
| 562 htmlPages.set(sender.page, null); | 567 htmlPages.set(sender.page, null); |
| 563 refreshIconAndContextMenu(sender.page); | 568 refreshIconAndContextMenu(sender.page); |
| 564 break; | 569 break; |
| 570 case "trace-elemhide": |
| 571 logHiddenElements(sender.page, msg.selectors, extractHostFromFrame(sender.
frame)); |
| 572 break; |
| 565 case "forward": | 573 case "forward": |
| 566 if (sender.page) | 574 if (sender.page) |
| 567 { | 575 { |
| 568 if (msg.expectsResponse) | 576 if (msg.expectsResponse) |
| 569 { | 577 { |
| 570 sender.page.sendMessage(msg.payload, sendResponse); | 578 sender.page.sendMessage(msg.payload, sendResponse); |
| 571 return true; | 579 return true; |
| 572 } | 580 } |
| 573 | 581 |
| 574 sender.page.sendMessage(msg.payload); | 582 sender.page.sendMessage(msg.payload); |
| 575 } | 583 } |
| 576 break; | 584 break; |
| 577 } | 585 } |
| 578 }); | 586 }); |
| 579 | 587 |
| 580 // update icon when page changes location | 588 // update icon when page changes location |
| 581 ext.pages.onLoading.addListener(function(page) | 589 ext.pages.onLoading.addListener(function(page) |
| 582 { | 590 { |
| 583 page.sendMessage({type: "clickhide-deactivate"}); | 591 page.sendMessage({type: "clickhide-deactivate"}); |
| 584 refreshIconAndContextMenu(page); | 592 refreshIconAndContextMenu(page); |
| 585 }); | 593 }); |
| 586 | 594 |
| 587 setTimeout(function() | 595 setTimeout(function() |
| 588 { | 596 { |
| 589 var notificationToShow = NotificationStorage.getNextToShow(); | 597 var notificationToShow = NotificationStorage.getNextToShow(); |
| 590 if (notificationToShow) | 598 if (notificationToShow) |
| 591 showNotification(notificationToShow); | 599 showNotification(notificationToShow); |
| 592 }, 3 * 60 * 1000); | 600 }, 3 * 60 * 1000); |
| OLD | NEW |