Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/abp2blocklist.js

Issue 29502555: Issue 5464 - Ignore and whitelist WebRTC if not supported (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Left Patch Set: Created Aug. 1, 2017, 8:14 a.m.
Right Patch Set: Fix bug Created Aug. 1, 2017, 8:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 };
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld