| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 for (std::vector<std::string>::const_iterator it = documentUrls.begin(); | 231 for (std::vector<std::string>::const_iterator it = documentUrls.begin(); |
| 232 it != documentUrls.end(); it++) { | 232 it != documentUrls.end(); it++) { |
| 233 const std::string documentUrl = *it; | 233 const std::string documentUrl = *it; |
| 234 AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl, "DOCUMENT", | 234 AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl, "DOCUMENT", |
| 235 lastDocumentUrl); | 235 lastDocumentUrl); |
| 236 if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) | 236 if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) |
| 237 return match; | 237 return match; |
| 238 lastDocumentUrl = documentUrl; | 238 lastDocumentUrl = documentUrl; |
| 239 } | 239 } |
| 240 | 240 |
| 241 return CheckFilterMatch(url, contentType, documentUrls.back()); | 241 return CheckFilterMatch(url, contentType, lastDocumentUrl); |
|
Wladimir Palant
2013/11/04 07:17:28
Nit: use lastDocumentUrl instead of documentUrls.b
Felix Dahlke
2013/11/15 08:18:19
Done.
| |
| 242 } | 242 } |
| 243 | 243 |
| 244 AdblockPlus::FilterPtr FilterEngine::CheckFilterMatch(const std::string& url, | 244 AdblockPlus::FilterPtr FilterEngine::CheckFilterMatch(const std::string& url, |
| 245 const std::string& contentType, | 245 const std::string& contentType, |
| 246 const std::string& documentUrl) const | 246 const std::string& documentUrl) const |
| 247 { | 247 { |
| 248 JsValuePtr func = jsEngine->Evaluate("API.checkFilterMatch"); | 248 JsValuePtr func = jsEngine->Evaluate("API.checkFilterMatch"); |
| 249 JsValueList params; | 249 JsValueList params; |
| 250 params.push_back(jsEngine->NewValue(url)); | 250 params.push_back(jsEngine->NewValue(url)); |
| 251 params.push_back(jsEngine->NewValue(contentType)); | 251 params.push_back(jsEngine->NewValue(contentType)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 { | 318 { |
| 319 jsEngine->RemoveEventCallback("filterChange"); | 319 jsEngine->RemoveEventCallback("filterChange"); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) | 322 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) |
| 323 { | 323 { |
| 324 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); | 324 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); |
| 325 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); | 325 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); |
| 326 callback(action, item); | 326 callback(action, item); |
| 327 } | 327 } |
| LEFT | RIGHT |