| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 removeSubscription: function(subscription) | 97 removeSubscription: function(subscription) |
| 98 { | 98 { |
| 99 var index = subscriptions.indexOf(subscription.url); | 99 var index = subscriptions.indexOf(subscription.url); |
| 100 if (index >= 0) | 100 if (index >= 0) |
| 101 { | 101 { |
| 102 subscriptions.splice(index, 1); | 102 subscriptions.splice(index, 1); |
| 103 modules.filterNotifier.FilterNotifier.triggerListeners("subscription.r
emoved", subscription); | 103 modules.filterNotifier.FilterNotifier.triggerListeners("subscription.r
emoved", subscription); |
| 104 } | 104 } |
| 105 } | 105 }, |
| 106 |
| 107 addFilter: function() {}, |
| 108 removeFilter: function() {} |
| 106 } | 109 } |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 modules.filterClasses = { | 112 modules.filterClasses = { |
| 113 Filter: function(text) |
| 114 { |
| 115 this.text = text; |
| 116 }, |
| 110 BlockingFilter: function() {} | 117 BlockingFilter: function() {} |
| 111 }; | 118 }; |
| 119 modules.filterClasses.Filter.fromText = function(text) |
| 120 { |
| 121 return new modules.filterClasses.Filter(text); |
| 122 }; |
| 112 | 123 |
| 113 modules.synchronizer = { | 124 modules.synchronizer = { |
| 114 Synchronizer: {} | 125 Synchronizer: {} |
| 115 }; | 126 }; |
| 116 | 127 |
| 117 modules.matcher = { | 128 modules.matcher = { |
| 118 defaultMatcher: { | 129 defaultMatcher: { |
| 119 matchesAny: function(url, requestType, docDomain, thirdParty) | 130 matchesAny: function(url, requestType, docDomain, thirdParty) |
| 120 { | 131 { |
| 121 var params = {blockedURLs: ""}; | 132 var params = {blockedURLs: ""}; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 148 triggerListeners: function() | 159 triggerListeners: function() |
| 149 { | 160 { |
| 150 var args = Array.prototype.slice.apply(arguments); | 161 var args = Array.prototype.slice.apply(arguments); |
| 151 var listeners = notifierListeners.slice(); | 162 var listeners = notifierListeners.slice(); |
| 152 for (var i = 0; i < listeners.length; i++) | 163 for (var i = 0; i < listeners.length; i++) |
| 153 listeners[i].apply(null, args); | 164 listeners[i].apply(null, args); |
| 154 } | 165 } |
| 155 } | 166 } |
| 156 }; | 167 }; |
| 157 | 168 |
| 169 modules.devtools = { |
| 170 initDevToolsPanel: function(page, inspectedTabId) |
| 171 { |
| 172 // blocked request |
| 173 page.sendMessage({ |
| 174 type: "add-record", |
| 175 request: { |
| 176 url: "http://adserver.example.com/ad_banner.png", |
| 177 type: "IMAGE", |
| 178 docDomain: "example.com" |
| 179 }, |
| 180 filter: { |
| 181 text: "/ad_banner*$domain=example.com", |
| 182 whitelisted: false, |
| 183 userDefined: false, |
| 184 subscription: "EasyList" |
| 185 } |
| 186 }); |
| 187 |
| 188 // whiletisted request |
| 189 page.sendMessage({ |
| 190 type: "add-record", |
| 191 request: { |
| 192 url: "http://example.com/looks_like_an_ad_but_isnt_one.html", |
| 193 type: "SUBDOCUMENT", |
| 194 docDomain: "example.com" |
| 195 }, |
| 196 filter: { |
| 197 text: "@@||example.com/looks_like_an_ad_but_isnt_one.html", |
| 198 whitelisted: true, |
| 199 userDefined: false, |
| 200 subscription: "EasyList" |
| 201 } |
| 202 }); |
| 203 |
| 204 // request with long URL and no filter matches |
| 205 page.sendMessage({ |
| 206 type: "add-record", |
| 207 request: { |
| 208 url: "https://this.url.has.a.long.domain/and_a_long_path_maybe_not_lon
g_enough_so_i_keep_typing?there=are&a=couple&of=parameters&as=well&and=even&some
=more", |
| 209 type: "XMLHTTPREQUEST", |
| 210 docDomain: "example.com" |
| 211 }, |
| 212 filter: null |
| 213 }); |
| 214 |
| 215 // matching element hiding filter |
| 216 page.sendMessage({ |
| 217 type: "add-record", |
| 218 request: { |
| 219 type: "ELEMHIDE", |
| 220 docDomain: "example.com" |
| 221 }, |
| 222 filter: { |
| 223 text: "example.com##.ad_banner", |
| 224 whitelisted: false, |
| 225 userDefined: false, |
| 226 subscription: "EasyList" |
| 227 } |
| 228 }); |
| 229 |
| 230 // user-defined filter |
| 231 page.sendMessage({ |
| 232 type: "add-record", |
| 233 request: { |
| 234 url: "http://example.com/some-annoying-popup", |
| 235 type: "POPUP", |
| 236 docDomain: "example.com" |
| 237 }, |
| 238 filter: { |
| 239 text: "||example.com/some-annoying-popup$popup", |
| 240 whitelisted: false, |
| 241 userDefined: true, |
| 242 subscription: null |
| 243 } |
| 244 }); |
| 245 } |
| 246 }; |
| 247 |
| 158 modules.info = { | 248 modules.info = { |
| 159 platform: "gecko", | 249 platform: "gecko", |
| 160 platformVersion: "34.0", | 250 platformVersion: "34.0", |
| 161 application: "firefox", | 251 application: "firefox", |
| 162 applicationVersion: "34.0" | 252 applicationVersion: "34.0" |
| 163 }; | 253 }; |
| 164 updateFromURL(modules.info); | 254 updateFromURL(modules.info); |
| 165 | 255 |
| 166 global.Services = { | 256 global.Services = { |
| 167 vc: { | 257 vc: { |
| 168 compare: function(v1, v2) | 258 compare: function(v1, v2) |
| 169 { | 259 { |
| 170 return parseFloat(v1) - parseFloat(v2); | 260 return parseFloat(v1) - parseFloat(v2); |
| 171 } | 261 } |
| 172 } | 262 } |
| 173 }; | 263 }; |
| 174 | 264 |
| 175 var issues = {seenDataCorruption: false, filterlistsReinitialized: false}; | 265 var issues = {seenDataCorruption: false, filterlistsReinitialized: false}; |
| 176 updateFromURL(issues); | 266 updateFromURL(issues); |
| 177 global.seenDataCorruption = issues.seenDataCorruption; | 267 global.seenDataCorruption = issues.seenDataCorruption; |
| 178 global.filterlistsReinitialized = issues.filterlistsReinitialized; | 268 global.filterlistsReinitialized = issues.filterlistsReinitialized; |
| 179 })(this); | 269 })(this); |
| OLD | NEW |