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

Side by Side Diff: lib/requestBlocker.js

Issue 29347167: Issue 4210 - Fix dynamic-frame collapsing in Chrome (Closed)
Patch Set: Created June 30, 2016, 1:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 setTimeout(onBeforeRequestAsync, 0, page, urlString, 72 setTimeout(onBeforeRequestAsync, 0, page, urlString,
73 type, docDomain, 73 type, docDomain,
74 thirdParty, sitekey, 74 thirdParty, sitekey,
75 specificOnly, filter); 75 specificOnly, filter);
76 76
77 return !(filter instanceof BlockingFilter); 77 return !(filter instanceof BlockingFilter);
78 }); 78 });
79 79
80 port.on("filters.collapse", (message, sender) => 80 port.on("filters.collapse", (message, sender) =>
81 { 81 {
82 if (checkWhitelisted(sender.page, sender.frame)) 82 var sender_frame = sender.frame;
83 if (message.dynamicFrameURL)
84 {
85 sender_frame = {
86 url: new URL(message.dynamicFrameURL, message.baseURL),
87 parent: sender.frame
88 };
89 }
90
91 if (checkWhitelisted(sender.page, sender_frame))
83 return false; 92 return false;
84 93
85 let typeMask = RegExpFilter.typeMap[message.mediatype]; 94 let typeMask = RegExpFilter.typeMap[message.mediatype];
86 let documentHost = extractHostFromFrame(sender.frame); 95 let documentHost = extractHostFromFrame(sender_frame);
87 let sitekey = getKey(sender.page, sender.frame); 96 let sitekey = getKey(sender.page, sender_frame);
88 let blocked = false; 97 let blocked = false;
89 98
90 let specificOnly = checkWhitelisted( 99 let specificOnly = checkWhitelisted(
91 sender.page, sender.frame, 100 sender.page, sender_frame,
92 RegExpFilter.typeMap.GENERICBLOCK 101 RegExpFilter.typeMap.GENERICBLOCK
93 ); 102 );
94 103
95 for (let url of message.urls) 104 for (let url of message.urls)
96 { 105 {
97 let urlObj = new URL(url, message.baseURL); 106 let urlObj = new URL(url, message.baseURL);
98 let filter = defaultMatcher.matchesAny( 107 let filter = defaultMatcher.matchesAny(
99 stringifyURL(urlObj), 108 stringifyURL(urlObj),
100 typeMask, documentHost, 109 typeMask, documentHost,
101 isThirdParty(urlObj, documentHost), 110 isThirdParty(urlObj, documentHost),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 156 }
148 157
149 FilterNotifier.on("subscription.added", onFilterChange) 158 FilterNotifier.on("subscription.added", onFilterChange)
150 FilterNotifier.on("subscription.removed", onFilterChange); 159 FilterNotifier.on("subscription.removed", onFilterChange);
151 FilterNotifier.on("subscription.updated", onFilterChange); 160 FilterNotifier.on("subscription.updated", onFilterChange);
152 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); 161 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true));
153 FilterNotifier.on("filter.added", onFilterChange); 162 FilterNotifier.on("filter.added", onFilterChange);
154 FilterNotifier.on("filter.removed", onFilterChange); 163 FilterNotifier.on("filter.removed", onFilterChange);
155 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); 164 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true));
156 FilterNotifier.on("load", onFilterChange); 165 FilterNotifier.on("load", onFilterChange);
OLDNEW
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld