OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * |
| 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 |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 18 ext.devtools = { |
| 19 connect: function() |
| 20 { |
| 21 return { |
| 22 postMessage: function() {}, |
| 23 |
| 24 onMessage: { |
| 25 addListener: function(listener) |
| 26 { |
| 27 // blocked request |
| 28 listener({ |
| 29 type: "add-record", |
| 30 request: { |
| 31 url: "http://adserver.example.com/ad_banner.png", |
| 32 type: "IMAGE", |
| 33 docDomain: "example.com" |
| 34 }, |
| 35 filter: { |
| 36 text: "/ad_banner*$domain=example.com", |
| 37 whitelisted: false, |
| 38 userDefined: false, |
| 39 subscription: "EasyList" |
| 40 } |
| 41 }); |
| 42 |
| 43 // whiletisted request |
| 44 listener({ |
| 45 type: "add-record", |
| 46 request: { |
| 47 url: "http://example.com/looks_like_an_ad_but_isnt_one.html", |
| 48 type: "SUBDOCUMENT", |
| 49 docDomain: "example.com" |
| 50 }, |
| 51 filter: { |
| 52 text: "@@||example.com/looks_like_an_ad_but_isnt_one.html", |
| 53 whitelisted: true, |
| 54 userDefined: false, |
| 55 subscription: "EasyList" |
| 56 } |
| 57 }); |
| 58 |
| 59 // request with long URL and no filter matches |
| 60 listener({ |
| 61 type: "add-record", |
| 62 request: { |
| 63 url: "https://this.url.has.a.long.domain/and_a_long_path_maybe_not
_long_enough_so_i_keep_typing?there=are&a=couple&of=parameters&as=well&and=even&
some=more", |
| 64 type: "XMLHTTPREQUEST", |
| 65 docDomain: "example.com" |
| 66 }, |
| 67 filter: null |
| 68 }); |
| 69 |
| 70 // matching element hiding filter |
| 71 listener({ |
| 72 type: "add-record", |
| 73 request: { |
| 74 type: "ELEMHIDE", |
| 75 docDomain: "example.com" |
| 76 }, |
| 77 filter: { |
| 78 text: "example.com##.ad_banner", |
| 79 whitelisted: false, |
| 80 userDefined: false, |
| 81 subscription: "EasyList" |
| 82 } |
| 83 }); |
| 84 |
| 85 // user-defined filter |
| 86 listener({ |
| 87 type: "add-record", |
| 88 request: { |
| 89 url: "http://example.com/some-annoying-popup", |
| 90 type: "POPUP", |
| 91 docDomain: "example.com" |
| 92 }, |
| 93 filter: { |
| 94 text: "||example.com/some-annoying-popup$popup", |
| 95 whitelisted: false, |
| 96 userDefined: true, |
| 97 subscription: null |
| 98 } |
| 99 }); |
| 100 |
| 101 } |
| 102 } |
| 103 }; |
| 104 }, |
| 105 |
| 106 panels: { |
| 107 openResource: function() {} |
| 108 }, |
| 109 |
| 110 inspectedWindow: { |
| 111 reload: function() {} |
| 112 } |
| 113 } |
| 114 |
OLD | NEW |