| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 ::Sleep(10); | 153 ::Sleep(10); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void FilterEngine::InitDone(JsValueList& params) | 156 void FilterEngine::InitDone(JsValueList& params) |
| 157 { | 157 { |
| 158 jsEngine->RemoveEventCallback("init"); | 158 jsEngine->RemoveEventCallback("init"); |
| 159 initialized = true; | 159 initialized = true; |
| 160 firstRun = params.size() && params[0]->AsBool(); | 160 firstRun = params.size() && params[0]->AsBool(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool FilterEngine::IsFirstRun() const | 163 bool FilterEngine::IsFirstRun() |
| 164 { | 164 { |
| 165 return firstRun; | 165 bool temp = firstRun; |
| 166 firstRun = false; | |
| 167 return temp; | |
|
Wladimir Palant
2013/07/11 11:36:21
Debug code?
Oleksandr
2013/07/11 12:18:45
Not actually. My thinking was that the first run a
Wladimir Palant
2013/07/11 12:56:20
I see. I actually suggested in the other review th
| |
| 166 } | 168 } |
| 167 | 169 |
| 168 FilterPtr FilterEngine::GetFilter(const std::string& text) | 170 FilterPtr FilterEngine::GetFilter(const std::string& text) |
| 169 { | 171 { |
| 170 JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText"); | 172 JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText"); |
| 171 JsValueList params; | 173 JsValueList params; |
| 172 params.push_back(jsEngine->NewValue(text)); | 174 params.push_back(jsEngine->NewValue(text)); |
| 173 return FilterPtr(new Filter(func->Call(params))); | 175 return FilterPtr(new Filter(func->Call(params))); |
| 174 } | 176 } |
| 175 | 177 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 func->Call(params); | 272 func->Call(params); |
| 271 } | 273 } |
| 272 | 274 |
| 273 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params) | 275 void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::U pdaterCallback callback, JsValueList& params) |
| 274 { | 276 { |
| 275 jsEngine->RemoveEventCallback(eventName); | 277 jsEngine->RemoveEventCallback(eventName); |
| 276 | 278 |
| 277 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : ""); | 279 std::string error(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsSt ring() : ""); |
| 278 callback(error); | 280 callback(error); |
| 279 } | 281 } |
| OLD | NEW |