| OLD | NEW |
| 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 Loading... |
| 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 }); |
| OLD | NEW |