Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 else | 226 else |
227 return FilterPtr(); | 227 return FilterPtr(); |
228 } | 228 } |
229 | 229 |
230 std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::stri ng& domain) const | 230 std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::stri ng& domain) const |
231 { | 231 { |
232 JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); | 232 JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); |
233 JsValueList params; | 233 JsValueList params; |
234 params.push_back(jsEngine->NewValue(domain)); | 234 params.push_back(jsEngine->NewValue(domain)); |
235 JsValueList result = func->Call(params)->AsList(); | 235 JsValueList result = func->Call(params)->AsList(); |
236 jsEngine->Gc(); | |
Wladimir Palant
2013/10/08 08:12:19
This is a really bad idea, it will cause unnecessa
Felix Dahlke
2013/10/10 08:36:26
I don't think we should look into this at this poi
| |
236 std::vector<std::string> selectors; | 237 std::vector<std::string> selectors; |
237 for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) | 238 for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) |
238 selectors.push_back((*it)->AsString()); | 239 selectors.push_back((*it)->AsString()); |
239 return selectors; | 240 return selectors; |
240 } | 241 } |
241 | 242 |
242 JsValuePtr FilterEngine::GetPref(const std::string& pref) const | 243 JsValuePtr FilterEngine::GetPref(const std::string& pref) const |
243 { | 244 { |
244 JsValuePtr func = jsEngine->Evaluate("API.getPref"); | 245 JsValuePtr func = jsEngine->Evaluate("API.getPref"); |
245 JsValueList params; | 246 JsValueList params; |
(...skipping 24 matching lines...) Expand all Loading... | |
270 func->Call(params); | 271 func->Call(params); |
271 } | 272 } |
272 | 273 |
273 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params) | 274 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params) |
274 { | 275 { |
275 jsEngine->RemoveEventCallback(eventName); | 276 jsEngine->RemoveEventCallback(eventName); |
276 | 277 |
277 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : ""); | 278 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : ""); |
278 callback(error); | 279 callback(error); |
279 } | 280 } |
OLD | NEW |