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

Side by Side Diff: test/browser/elemHideEmulation.js

Issue 29485613: Noissue - Throw an error if the client code doesn't load (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created July 10, 2017, 8:40 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 | 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 insertStyleRule("#" + element.id + " " + styleBlock); 87 insertStyleRule("#" + element.id + " " + styleBlock);
88 return element; 88 return element;
89 } 89 }
90 90
91 function createPseudoElementWithStyle(element, pseudo, styleBlock) 91 function createPseudoElementWithStyle(element, pseudo, styleBlock)
92 { 92 {
93 insertStyleRule(`#${element.id}${pseudo} ${styleBlock}`); 93 insertStyleRule(`#${element.id}${pseudo} ${styleBlock}`);
94 } 94 }
95 95
96 // Will ensure the class ElemHideEmulation is loaded. 96 // Will ensure the class ElemHideEmulation is loaded.
97 // NOTE: if it never loads, this will probably hang. 97 // Pass true when it calls itself.
98 function loadElemHideEmulation() 98 function loadElemHideEmulation(inside)
99 { 99 {
100 if (typeof ElemHideEmulation == "undefined") 100 if (typeof ElemHideEmulation == "undefined")
101 { 101 {
102 if (inside)
103 return Promise.reject("Failed to load ElemHideEmulation.");
104
102 return loadScript(myUrl + "/../../../lib/common.js").then(() => 105 return loadScript(myUrl + "/../../../lib/common.js").then(() =>
103 { 106 {
104 return loadScript(myUrl + "/../../../chrome/content/elemHideEmulation.js") ; 107 return loadScript(myUrl + "/../../../chrome/content/elemHideEmulation.js") ;
105 }).then(() => 108 }).then(() =>
106 { 109 {
107 return loadElemHideEmulation(); 110 return loadElemHideEmulation(true);
108 }); 111 });
109 } 112 }
110 113
111 return Promise.resolve(); 114 return Promise.resolve();
112 } 115 }
113 116
114 // Create a new ElemHideEmulation instance with @selectors. 117 // Create a new ElemHideEmulation instance with @selectors.
115 function applyElemHideEmulation(selectors) 118 function applyElemHideEmulation(selectors)
116 { 119 {
117 return loadElemHideEmulation().then(() => 120 return loadElemHideEmulation().then(() =>
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 createPseudoElementWithStyle(child, "::before", "{content: \"publicite\"}"); 479 createPseudoElementWithStyle(child, "::before", "{content: \"publicite\"}");
477 480
478 applyElemHideEmulation( 481 applyElemHideEmulation(
479 ["div:-abp-has(:-abp-properties-before(content: \"publicite\"))"] 482 ["div:-abp-has(:-abp-properties-before(content: \"publicite\"))"]
480 ).then(() => 483 ).then(() =>
481 { 484 {
482 expectVisible(test, child); 485 expectVisible(test, child);
483 expectHidden(test, parent); 486 expectHidden(test, parent);
484 }).catch(unexpectedError.bind(test)).then(() => test.done()); 487 }).catch(unexpectedError.bind(test)).then(() => test.done());
485 }; 488 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld