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

Side by Side Diff: lib/filterComposer.js

Issue 29907589: Issue 7054 - Update the adblockpluscore dependency to 5cb695da5a40, adblockplusui to f86abf2efdfd (Closed)
Patch Set: Update dependency for adblockpluscore Created Dec. 21, 2018, 7:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 { 84 {
85 let typeMask = RegExpFilter.typeMap[details.type]; 85 let typeMask = RegExpFilter.typeMap[details.type];
86 let docDomain = extractHostFromFrame(frame); 86 let docDomain = extractHostFromFrame(frame);
87 let specificOnly = checkWhitelisted(page, frame, null, 87 let specificOnly = checkWhitelisted(page, frame, null,
88 RegExpFilter.typeMap.GENERICBLOCK); 88 RegExpFilter.typeMap.GENERICBLOCK);
89 89
90 // Add a blocking filter for each URL of the element that can be blocked 90 // Add a blocking filter for each URL of the element that can be blocked
91 for (let url of details.urls) 91 for (let url of details.urls)
92 { 92 {
93 let urlObj = new URL(url, details.baseURL); 93 let urlObj = new URL(url, details.baseURL);
94 let filter = defaultMatcher.whitelist.matchesAny( 94 let whitelisted = defaultMatcher.isWhitelisted(
95 urlObj.href, typeMask, docDomain, 95 urlObj.href, typeMask, docDomain,
96 isThirdParty(urlObj, docDomain), 96 isThirdParty(urlObj, docDomain),
97 getKey(page, frame), specificOnly 97 getKey(page, frame), specificOnly
98 ); 98 );
99 99
100 if (!filter) 100 if (!whitelisted)
101 { 101 {
102 let filterText = urlObj.href.replace(/^[\w-]+:\/+(?:www\.)?/, "||"); 102 let filterText = urlObj.href.replace(/^[\w-]+:\/+(?:www\.)?/, "||");
103 103
104 if (specificOnly) 104 if (specificOnly)
105 filterText += "$domain=" + docDomain; 105 filterText += "$domain=" + docDomain;
106 106
107 if (!filters.includes(filterText)) 107 if (!filters.includes(filterText))
108 filters.push(filterText); 108 filters.push(filterText);
109 } 109 }
110 } 110 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 port.on("composer.isPageReady", (message, sender) => 364 port.on("composer.isPageReady", (message, sender) =>
365 { 365 {
366 return readyActivePages.has(new ext.Page({id: message.pageId})); 366 return readyActivePages.has(new ext.Page({id: message.pageId}));
367 }); 367 });
368 368
369 port.on("composer.ready", (message, sender) => 369 port.on("composer.ready", (message, sender) =>
370 { 370 {
371 readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); 371 readyActivePages.set(sender.page, !checkWhitelisted(sender.page));
372 updateContextMenu(sender.page); 372 updateContextMenu(sender.page);
373 }); 373 });
OLDNEW

Powered by Google App Engine
This is Rietveld