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

Side by Side Diff: lib/cssInjection.js

Issue 29737561: Issue 6539, 6782 - Implement support for snippets (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Rebase Created May 2, 2018, 7:50 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
« no previous file with comments | « no previous file | lib/scriptInjection.js » ('j') | lib/scriptInjection.js » ('J')
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-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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 let hostname = extractHostFromFrame(sender.frame); 174 let hostname = extractHostFromFrame(sender.frame);
175 let specificOnly = checkWhitelisted(sender.page, sender.frame, null, 175 let specificOnly = checkWhitelisted(sender.page, sender.frame, null,
176 RegExpFilter.typeMap.GENERICHIDE); 176 RegExpFilter.typeMap.GENERICHIDE);
177 177
178 selectors = ElemHide.getSelectorsForDomain( 178 selectors = ElemHide.getSelectorsForDomain(
179 hostname, 179 hostname,
180 specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.ALL_MATCHING 180 specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.ALL_MATCHING
181 ); 181 );
182 182
183 for (let filter of ElemHideEmulation.getRulesForDomain(hostname)) 183 for (let filter of ElemHideEmulation.getRulesForDomain(hostname))
184 emulatedPatterns.push({selector: filter.selector, text: filter.text}); 184 emulatedPatterns.push({selector: filter.code, text: filter.text});
185 } 185 }
186 186
187 if (!inline && !updateFrameStyles(sender.page.id, sender.frame.id, 187 if (!inline && !updateFrameStyles(sender.page.id, sender.frame.id,
188 selectors, "standard")) 188 selectors, "standard"))
189 { 189 {
190 inline = true; 190 inline = true;
191 } 191 }
192 192
193 let response = {trace, inline, emulatedPatterns}; 193 let response = {trace, inline, emulatedPatterns};
194 if (trace || inline) 194 if (trace || inline)
195 response.selectors = selectors; 195 response.selectors = selectors;
196 196
197 // If we can't remove user style sheets using tabs.removeCSS, we'll only keep 197 // If we can't remove user style sheets using tabs.removeCSS, we'll only keep
198 // adding them, which could cause problems with emulation filters as 198 // adding them, which could cause problems with emulation filters as
199 // described in issue #5864. Instead, we can just ask the content script to 199 // described in issue #5864. Instead, we can just ask the content script to
200 // add styles for emulation filters inline. 200 // add styles for emulation filters inline.
201 if (!styleSheetRemovalSupported) 201 if (!styleSheetRemovalSupported)
202 response.inlineEmulated = true; 202 response.inlineEmulated = true;
203 203
204 return response; 204 return response;
205 }); 205 });
206 206
207 port.on("elemhide.injectSelectors", (message, sender) => 207 port.on("elemhide.injectSelectors", (message, sender) =>
208 { 208 {
209 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, 209 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors,
210 message.groupName, message.appendOnly); 210 message.groupName, message.appendOnly);
211 }); 211 });
OLDNEW
« no previous file with comments | « no previous file | lib/scriptInjection.js » ('j') | lib/scriptInjection.js » ('J')

Powered by Google App Engine
This is Rietveld