| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  102   insertStyleRule("#" + element.id + " " + styleBlock); |  102   insertStyleRule("#" + element.id + " " + styleBlock); | 
|  103   return element; |  103   return element; | 
|  104 } |  104 } | 
|  105  |  105  | 
|  106 // Create a new ElemHideEmulation instance with @selectors. |  106 // Create a new ElemHideEmulation instance with @selectors. | 
|  107 function applyElemHideEmulation(selectors) |  107 function applyElemHideEmulation(selectors) | 
|  108 { |  108 { | 
|  109   return Promise.resolve().then(() => |  109   return Promise.resolve().then(() => | 
|  110   { |  110   { | 
|  111     let elemHideEmulation = new ElemHideEmulation( |  111     let elemHideEmulation = new ElemHideEmulation( | 
|  112       testDocument.defaultView, |  | 
|  113       callback => |  | 
|  114       { |  | 
|  115         let patterns = []; |  | 
|  116         selectors.forEach(selector => |  | 
|  117         { |  | 
|  118           patterns.push({selector}); |  | 
|  119         }); |  | 
|  120         callback(patterns); |  | 
|  121       }, |  | 
|  122       newSelectors => |  112       newSelectors => | 
|  123       { |  113       { | 
|  124         if (!newSelectors.length) |  114         if (!newSelectors.length) | 
|  125           return; |  115           return; | 
|  126         let selector = newSelectors.join(", "); |  116         let selector = newSelectors.join(", "); | 
|  127         insertStyleRule(selector + "{display: none !important;}"); |  117         insertStyleRule(selector + "{display: none !important;}"); | 
|  128       }, |  118       }, | 
|  129       elems => |  119       elems => | 
|  130       { |  120       { | 
|  131         for (let elem of elems) |  121         for (let elem of elems) | 
|  132           elem.style.display = "none"; |  122           elem.style.display = "none"; | 
|  133       } |  123       } | 
|  134     ); |  124     ); | 
|  135  |  125  | 
 |  126     elemHideEmulation.document = testDocument; | 
|  136     elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2; |  127     elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2; | 
|  137     elemHideEmulation.apply(); |  128     elemHideEmulation.apply(selectors.map(selector => ({selector}))); | 
|  138     return elemHideEmulation; |  129     return elemHideEmulation; | 
|  139   }); |  130   }); | 
|  140 } |  131 } | 
|  141  |  132  | 
|  142 exports.testVerbatimPropertySelector = function(test) |  133 exports.testVerbatimPropertySelector = function(test) | 
|  143 { |  134 { | 
|  144   let toHide = createElementWithStyle("{background-color: #000}"); |  135   let toHide = createElementWithStyle("{background-color: #000}"); | 
|  145   applyElemHideEmulation( |  136   applyElemHideEmulation( | 
|  146     [":-abp-properties(background-color: rgb(0, 0, 0))"] |  137     [":-abp-properties(background-color: rgb(0, 0, 0))"] | 
|  147   ).then(() => |  138   ).then(() => | 
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  589     expectVisible(test, child2); |  580     expectVisible(test, child2); | 
|  590     return timeout(REFRESH_INTERVAL); |  581     return timeout(REFRESH_INTERVAL); | 
|  591   }).then(() => |  582   }).then(() => | 
|  592   { |  583   { | 
|  593     expectHidden(test, parent); |  584     expectHidden(test, parent); | 
|  594     expectVisible(test, child); |  585     expectVisible(test, child); | 
|  595     expectHidden(test, sibling); |  586     expectHidden(test, sibling); | 
|  596     expectVisible(test, child2); |  587     expectVisible(test, child2); | 
|  597   }).catch(unexpectedError.bind(test)).then(() => test.done()); |  588   }).catch(unexpectedError.bind(test)).then(() => test.done()); | 
|  598 }; |  589 }; | 
| OLD | NEW |