| 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, | 
 |  113       null, | 
|  112       newSelectors => |  114       newSelectors => | 
|  113       { |  115       { | 
|  114         if (!newSelectors.length) |  116         if (!newSelectors.length) | 
|  115           return; |  117           return; | 
|  116         let selector = newSelectors.join(", "); |  118         let selector = newSelectors.join(", "); | 
|  117         insertStyleRule(selector + "{display: none !important;}"); |  119         insertStyleRule(selector + "{display: none !important;}"); | 
|  118       }, |  120       }, | 
|  119       elems => |  121       elems => | 
|  120       { |  122       { | 
|  121         for (let elem of elems) |  123         for (let elem of elems) | 
|  122           elem.style.display = "none"; |  124           elem.style.display = "none"; | 
|  123       } |  125       } | 
|  124     ); |  126     ); | 
|  125  |  127  | 
|  126     elemHideEmulation.document = testDocument; |  | 
|  127     elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2; |  128     elemHideEmulation.MIN_INVOCATION_INTERVAL = REFRESH_INTERVAL / 2; | 
|  128     elemHideEmulation.apply(selectors.map(selector => ({selector}))); |  129     elemHideEmulation.apply(selectors.map(selector => ({selector}))); | 
|  129     return elemHideEmulation; |  130     return elemHideEmulation; | 
|  130   }); |  131   }); | 
|  131 } |  132 } | 
|  132  |  133  | 
|  133 exports.testVerbatimPropertySelector = function(test) |  134 exports.testVerbatimPropertySelector = function(test) | 
|  134 { |  135 { | 
|  135   let toHide = createElementWithStyle("{background-color: #000}"); |  136   let toHide = createElementWithStyle("{background-color: #000}"); | 
|  136   applyElemHideEmulation( |  137   applyElemHideEmulation( | 
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  580     expectVisible(test, child2); |  581     expectVisible(test, child2); | 
|  581     return timeout(REFRESH_INTERVAL); |  582     return timeout(REFRESH_INTERVAL); | 
|  582   }).then(() => |  583   }).then(() => | 
|  583   { |  584   { | 
|  584     expectHidden(test, parent); |  585     expectHidden(test, parent); | 
|  585     expectVisible(test, child); |  586     expectVisible(test, child); | 
|  586     expectHidden(test, sibling); |  587     expectHidden(test, sibling); | 
|  587     expectVisible(test, child2); |  588     expectVisible(test, child2); | 
|  588   }).catch(unexpectedError.bind(test)).then(() => test.done()); |  589   }).catch(unexpectedError.bind(test)).then(() => test.done()); | 
|  589 }; |  590 }; | 
| OLD | NEW |