LEFT | RIGHT |
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 convertFilterAddRules(blockingRules, filter, "block", true, | 1307 convertFilterAddRules(blockingRules, filter, "block", true, |
1308 requestFilterExceptionDomains); | 1308 requestFilterExceptionDomains); |
1309 } | 1309 } |
1310 | 1310 |
1311 for (let filter of this.requestExceptions) | 1311 for (let filter of this.requestExceptions) |
1312 { | 1312 { |
1313 convertFilterAddRules(blockingExceptionRules, filter, | 1313 convertFilterAddRules(blockingExceptionRules, filter, |
1314 "ignore-previous-rules", true); | 1314 "ignore-previous-rules", true); |
1315 } | 1315 } |
1316 | 1316 |
| 1317 // If WebRTC is not supported, we still end up generating a lot of rules with |
| 1318 // a generic URL scheme pattern that covers WebRTC anyway. In order to avoid |
| 1319 // inadvertently blocking any WebRTC requests, we must add exceptions here |
| 1320 // for WebRTC URLs. This is not required when WebRTC is supported, because in |
| 1321 // that case we explicitly check if the filter covers WebRTC. |
1317 if (!typeMap.WEBRTC) | 1322 if (!typeMap.WEBRTC) |
1318 { | 1323 { |
1319 urlSchemeExceptionRules.push([ | 1324 urlSchemeExceptionRules.push( |
1320 { | 1325 { |
1321 trigger: {"url-filter": "^stuns?:"}, | 1326 trigger: {"url-filter": "^stuns?:"}, |
1322 action: {type: "ignore-previous-rules"} | 1327 action: {type: "ignore-previous-rules"} |
1323 }, | 1328 }, |
1324 { | 1329 { |
1325 trigger: {"url-filter": "^turns?:"}, | 1330 trigger: {"url-filter": "^turns?:"}, |
1326 action: {type: "ignore-previous-rules"} | 1331 action: {type: "ignore-previous-rules"} |
1327 } | 1332 } |
1328 ]); | 1333 ); |
1329 } | 1334 } |
1330 | 1335 |
1331 return async(ruleGroups, (group, index) => () => | 1336 return async(ruleGroups, (group, index) => () => |
1332 { | 1337 { |
1333 let next = () => | 1338 let next = () => |
1334 { | 1339 { |
1335 if (index == ruleGroups.length - 1) | 1340 if (index == ruleGroups.length - 1) |
1336 return ruleGroups.reduce((all, rules) => all.concat(rules), []); | 1341 return ruleGroups.reduce((all, rules) => all.concat(rules), []); |
1337 }; | 1342 }; |
1338 | 1343 |
1339 if (this.options.merge == "all" || | 1344 if (this.options.merge == "all" || |
1340 (this.options.merge == "auto" && | 1345 (this.options.merge == "auto" && |
1341 ruleGroups.reduce((n, group) => n + group.length, 0) > 50000)) | 1346 ruleGroups.reduce((n, group) => n + group.length, 0) > 50000)) |
1342 { | 1347 { |
1343 return mergeRules(ruleGroups[index], this.options.merge == "all") | 1348 return mergeRules(ruleGroups[index], this.options.merge == "all") |
1344 .then(rules => | 1349 .then(rules => |
1345 { | 1350 { |
1346 ruleGroups[index] = rules; | 1351 ruleGroups[index] = rules; |
1347 return next(); | 1352 return next(); |
1348 }); | 1353 }); |
1349 } | 1354 } |
1350 | 1355 |
1351 return next(); | 1356 return next(); |
1352 }); | 1357 }); |
1353 }; | 1358 }; |
LEFT | RIGHT |