| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   67 } |   67 } | 
|   68  |   68  | 
|   69 void Filter::RemoveFromList() |   69 void Filter::RemoveFromList() | 
|   70 { |   70 { | 
|   71   JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList"); |   71   JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList"); | 
|   72   func->Call(*this); |   72   func->Call(*this); | 
|   73 } |   73 } | 
|   74  |   74  | 
|   75 bool Filter::operator==(const Filter& filter) const |   75 bool Filter::operator==(const Filter& filter) const | 
|   76 { |   76 { | 
|   77   return GetProperty("text")->AsString() == filter.GetProperty("text")->AsString
     (); |   77   return GetProperty("text").AsString() == filter.GetProperty("text").AsString()
     ; | 
|   78 } |   78 } | 
|   79  |   79  | 
|   80 Subscription::Subscription(JsValue&& value) |   80 Subscription::Subscription(JsValue&& value) | 
|   81     : JsValue(std::move(value)) |   81     : JsValue(std::move(value)) | 
|   82 { |   82 { | 
|   83   if (!IsObject()) |   83   if (!IsObject()) | 
|   84     throw std::runtime_error("JavaScript value is not an object"); |   84     throw std::runtime_error("JavaScript value is not an object"); | 
|   85 } |   85 } | 
|   86  |   86  | 
|   87 bool Subscription::IsListed() const |   87 bool Subscription::IsListed() const | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  114   return func->Call(*this).AsBool(); |  114   return func->Call(*this).AsBool(); | 
|  115 } |  115 } | 
|  116  |  116  | 
|  117 bool Subscription::IsAA() const |  117 bool Subscription::IsAA() const | 
|  118 { |  118 { | 
|  119   return jsEngine->Evaluate("API.isAASubscription")->Call(*this).AsBool(); |  119   return jsEngine->Evaluate("API.isAASubscription")->Call(*this).AsBool(); | 
|  120 } |  120 } | 
|  121  |  121  | 
|  122 bool Subscription::operator==(const Subscription& subscription) const |  122 bool Subscription::operator==(const Subscription& subscription) const | 
|  123 { |  123 { | 
|  124   return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt
     ring(); |  124   return GetProperty("url").AsString() == subscription.GetProperty("url").AsStri
     ng(); | 
|  125 } |  125 } | 
|  126  |  126  | 
|  127 namespace |  127 namespace | 
|  128 { |  128 { | 
|  129   class Sync |  129   class Sync | 
|  130   { |  130   { | 
|  131   public: |  131   public: | 
|  132     Sync() |  132     Sync() | 
|  133       :initialized(false) |  133       :initialized(false) | 
|  134     { |  134     { | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  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   JsValuePtr preconfiguredPrefsObject = jsEngine->NewObject(); |  200   JsValuePtr 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 | 
|  208   for (int i = 0; !jsSources[i].empty(); i += 2) |  208   for (int i = 0; !jsSources[i].empty(); i += 2) | 
|  209     jsEngine->Evaluate(jsSources[i + 1], jsSources[i]); |  209     jsEngine->Evaluate(jsSources[i + 1], jsSources[i]); | 
|  210 } |  210 } | 
|  211  |  211  | 
|  212 FilterEnginePtr FilterEngine::Create(const JsEnginePtr& jsEngine, |  212 FilterEnginePtr FilterEngine::Create(const JsEnginePtr& jsEngine, | 
|  213   const FilterEngine::CreationParameters& params) |  213   const FilterEngine::CreationParameters& params) | 
|  214 { |  214 { | 
|  215   FilterEnginePtr retValue; |  215   FilterEnginePtr retValue; | 
|  216   Sync sync; |  216   Sync sync; | 
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  574     FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
     Url); |  574     FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent
     Url); | 
|  575     if (filter) |  575     if (filter) | 
|  576     { |  576     { | 
|  577       return filter; |  577       return filter; | 
|  578     } |  578     } | 
|  579     currentUrl = parentUrl; |  579     currentUrl = parentUrl; | 
|  580   } |  580   } | 
|  581   while (urlIterator != documentUrls.end()); |  581   while (urlIterator != documentUrls.end()); | 
|  582   return FilterPtr(); |  582   return FilterPtr(); | 
|  583 } |  583 } | 
| OLD | NEW |