| Left: | ||
| Right: |
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 if (shown instanceof Array && shown.indexOf(notification.id) != -1) | 212 if (shown instanceof Array && shown.indexOf(notification.id) != -1) |
| 213 continue; | 213 continue; |
| 214 if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) | 214 if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) |
| 215 continue; | 215 continue; |
| 216 } | 216 } |
| 217 | 217 |
| 218 if (typeof url === "string" || notification.urlFilters instanceof Array) | 218 if (typeof url === "string" || notification.urlFilters instanceof Array) |
| 219 { | 219 { |
| 220 if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array) | 220 if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array) |
| 221 { | 221 { |
| 222 let host; | 222 let uri = Utils.makeURI(url); |
|
Sebastian Noack
2016/04/04 11:19:46
Utils.makeURI() wraps Services.io.newURI() and ret
Wladimir Palant
2016/04/04 12:57:36
Actually, it is better to use `new URL` unconditio
Sebastian Noack
2016/04/04 13:40:38
Awesome. New patch set is up.
| |
| 223 if (typeof URL == "function") | 223 let host = uri && uri.host || ""; |
| 224 host = new URL(url).hostname; | 224 |
| 225 else | |
| 226 { | |
| 227 try | |
| 228 { | |
| 229 host = Services.io.newURI(url, null, null).host; | |
| 230 } | |
| 231 catch (e) | |
| 232 { | |
| 233 // Ignore, an exception is expected for about: and similar schemes | |
| 234 host = ""; | |
| 235 } | |
| 236 } | |
| 237 let exception = defaultMatcher.matchesAny(url, RegExpFilter.typeMap.DO CUMENT, host, false, null); | 225 let exception = defaultMatcher.matchesAny(url, RegExpFilter.typeMap.DO CUMENT, host, false, null); |
| 238 if (exception instanceof WhitelistFilter) | 226 if (exception instanceof WhitelistFilter) |
| 239 continue; | 227 continue; |
| 240 | 228 |
| 241 let matcher = new Matcher(); | 229 let matcher = new Matcher(); |
| 242 for (let urlFilter of notification.urlFilters) | 230 for (let urlFilter of notification.urlFilters) |
| 243 matcher.add(Filter.fromText(urlFilter)); | 231 matcher.add(Filter.fromText(urlFilter)); |
| 244 if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, fals e, null)) | 232 if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, fals e, null)) |
| 245 continue; | 233 continue; |
| 246 } | 234 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 Prefs.notifications_showui = true; | 391 Prefs.notifications_showui = true; |
| 404 } | 392 } |
| 405 else if (index != -1 && forceValue !== true) | 393 else if (index != -1 && forceValue !== true) |
| 406 categories.splice(index, 1); | 394 categories.splice(index, 1); |
| 407 | 395 |
| 408 // HACK: JSON values aren't saved unless they are assigned a different objec t. | 396 // HACK: JSON values aren't saved unless they are assigned a different objec t. |
| 409 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories )); | 397 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories )); |
| 410 } | 398 } |
| 411 }; | 399 }; |
| 412 Notification.init(); | 400 Notification.init(); |
| OLD | NEW |