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 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 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 | 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 | 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 | 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. | 1321 // that case we explicitly check if the filter covers WebRTC. |
1322 if (!typeMap.WEBRTC) | 1322 if (!typeMap.WEBRTC) |
1323 { | 1323 { |
1324 urlSchemeExceptionRules.push([ | 1324 urlSchemeExceptionRules.push( |
1325 { | 1325 { |
1326 trigger: {"url-filter": "^stuns?:"}, | 1326 trigger: {"url-filter": "^stuns?:"}, |
1327 action: {type: "ignore-previous-rules"} | 1327 action: {type: "ignore-previous-rules"} |
1328 }, | 1328 }, |
1329 { | 1329 { |
1330 trigger: {"url-filter": "^turns?:"}, | 1330 trigger: {"url-filter": "^turns?:"}, |
1331 action: {type: "ignore-previous-rules"} | 1331 action: {type: "ignore-previous-rules"} |
1332 } | 1332 } |
1333 ]); | 1333 ); |
1334 } | 1334 } |
1335 | 1335 |
1336 return async(ruleGroups, (group, index) => () => | 1336 return async(ruleGroups, (group, index) => () => |
1337 { | 1337 { |
1338 let next = () => | 1338 let next = () => |
1339 { | 1339 { |
1340 if (index == ruleGroups.length - 1) | 1340 if (index == ruleGroups.length - 1) |
1341 return ruleGroups.reduce((all, rules) => all.concat(rules), []); | 1341 return ruleGroups.reduce((all, rules) => all.concat(rules), []); |
1342 }; | 1342 }; |
1343 | 1343 |
1344 if (this.options.merge == "all" || | 1344 if (this.options.merge == "all" || |
1345 (this.options.merge == "auto" && | 1345 (this.options.merge == "auto" && |
1346 ruleGroups.reduce((n, group) => n + group.length, 0) > 50000)) | 1346 ruleGroups.reduce((n, group) => n + group.length, 0) > 50000)) |
1347 { | 1347 { |
1348 return mergeRules(ruleGroups[index], this.options.merge == "all") | 1348 return mergeRules(ruleGroups[index], this.options.merge == "all") |
1349 .then(rules => | 1349 .then(rules => |
1350 { | 1350 { |
1351 ruleGroups[index] = rules; | 1351 ruleGroups[index] = rules; |
1352 return next(); | 1352 return next(); |
1353 }); | 1353 }); |
1354 } | 1354 } |
1355 | 1355 |
1356 return next(); | 1356 return next(); |
1357 }); | 1357 }); |
1358 }; | 1358 }; |
LEFT | RIGHT |