Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/FilterEngine.cpp

Issue 29416579: Issue 5034 - Part 1: Pass a JsValue directly to SetProperty() and return from GetProperty() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Remove JsValue test Created April 19, 2017, 2:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/FileSystemJsObject.cpp ('k') | src/GlobalJsObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
===================================================================
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -69,17 +69,17 @@
void Filter::RemoveFromList()
{
JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList");
func->Call(*this);
}
bool Filter::operator==(const Filter& filter) const
{
- return GetProperty("text")->AsString() == filter.GetProperty("text")->AsString();
+ return GetProperty("text").AsString() == filter.GetProperty("text").AsString();
}
Subscription::Subscription(JsValue&& value)
: JsValue(std::move(value))
{
if (!IsObject())
throw std::runtime_error("JavaScript value is not an object");
}
@@ -116,17 +116,17 @@
bool Subscription::IsAA() const
{
return jsEngine->Evaluate("API.isAASubscription")->Call(*this).AsBool();
}
bool Subscription::operator==(const Subscription& subscription) const
{
- return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsString();
+ return GetProperty("url").AsString() == subscription.GetProperty("url").AsString();
}
namespace
{
class Sync
{
public:
Sync()
@@ -196,19 +196,19 @@
// until we are done.
const JsContext context(jsEngine);
// Set the preconfigured prefs
JsValuePtr preconfiguredPrefsObject = jsEngine->NewObject();
for (FilterEngine::Prefs::const_iterator it = params.preconfiguredPrefs.begin();
it != params.preconfiguredPrefs.end(); it++)
{
- preconfiguredPrefsObject->SetProperty(it->first, it->second);
+ preconfiguredPrefsObject->SetProperty(it->first, *it->second);
}
- jsEngine->SetGlobalProperty("_preconfiguredPrefs", preconfiguredPrefsObject);
+ jsEngine->SetGlobalProperty("_preconfiguredPrefs", *preconfiguredPrefsObject);
// Load adblockplus scripts
for (int i = 0; !jsSources[i].empty(); i += 2)
jsEngine->Evaluate(jsSources[i + 1], jsSources[i]);
}
FilterEnginePtr FilterEngine::Create(const JsEnginePtr& jsEngine,
const FilterEngine::CreationParameters& params)
{
« no previous file with comments | « src/FileSystemJsObject.cpp ('k') | src/GlobalJsObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld