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-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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return isConnectionAllowedCallback(filterEngine->GetAllowedConnectionTyp
e().get()); | 187 return isConnectionAllowedCallback(filterEngine->GetAllowedConnectionTyp
e().get()); |
188 }); | 188 }); |
189 } | 189 } |
190 sync->Set(); | 190 sync->Set(); |
191 onCreated(filterEngine); | 191 onCreated(filterEngine); |
192 jsEngine->RemoveEventCallback("_init"); | 192 jsEngine->RemoveEventCallback("_init"); |
193 }); | 193 }); |
194 | 194 |
195 // Lock the JS engine while we are loading scripts, no timeouts should fire | 195 // Lock the JS engine while we are loading scripts, no timeouts should fire |
196 // until we are done. | 196 // until we are done. |
197 const JsContext context(jsEngine); | 197 const JsContext context(*jsEngine); |
198 | 198 |
199 // Set the preconfigured prefs | 199 // Set the preconfigured prefs |
200 auto preconfiguredPrefsObject = jsEngine->NewObject(); | 200 auto preconfiguredPrefsObject = jsEngine->NewObject(); |
201 for (FilterEngine::Prefs::const_iterator it = params.preconfiguredPrefs.begin(
); | 201 for (FilterEngine::Prefs::const_iterator it = params.preconfiguredPrefs.begin(
); |
202 it != params.preconfiguredPrefs.end(); it++) | 202 it != params.preconfiguredPrefs.end(); it++) |
203 { | 203 { |
204 preconfiguredPrefsObject.SetProperty(it->first, it->second); | 204 preconfiguredPrefsObject.SetProperty(it->first, it->second); |
205 } | 205 } |
206 jsEngine->SetGlobalProperty("_preconfiguredPrefs", preconfiguredPrefsObject); | 206 jsEngine->SetGlobalProperty("_preconfiguredPrefs", preconfiguredPrefsObject); |
207 // Load adblockplus scripts | 207 // Load adblockplus scripts |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); | 573 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
Url); |
574 if (filter) | 574 if (filter) |
575 { | 575 { |
576 return filter; | 576 return filter; |
577 } | 577 } |
578 currentUrl = parentUrl; | 578 currentUrl = parentUrl; |
579 } | 579 } |
580 while (urlIterator != documentUrls.end()); | 580 while (urlIterator != documentUrls.end()); |
581 return FilterPtr(); | 581 return FilterPtr(); |
582 } | 582 } |
OLD | NEW |