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

Unified Diff: src/FilterEngine.cpp

Issue 29396582: Issue 5039 - add support of nullable non-object values in settings
Patch Set: add proper support of nullable setting values Created March 28, 2017, 2:28 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
« lib/prefs.js ('K') | « lib/prefs.js ('k') | src/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp
index 5c1a495619c76e0b51a886b9116807789b135c9a..6f2a1523fae345c1a8f9cf539f4bfb52139d29d9 100644
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -417,8 +417,7 @@ void FilterEngine::SetPref(const std::string& pref, JsValuePtr value)
JsValuePtr func = jsEngine->Evaluate("API.setPref");
JsConstValueList params;
params.push_back(jsEngine->NewValue(pref));
- if (value)
- params.push_back(value);
+ params.push_back(value);
func->Call(params);
}
@@ -485,13 +484,13 @@ void FilterEngine::RemoveFilterChangeCallback()
void FilterEngine::SetAllowedConnectionType(const std::string* value)
{
- SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : nullptr);
+ SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : jsEngine->NullValue());
}
std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const
{
auto prefValue = GetPref("allowed_connection_type");
- if (prefValue->IsUndefined())
+ if (prefValue->IsNull())
return nullptr;
return std::unique_ptr<std::string>(new std::string(prefValue->AsString()));
}
« lib/prefs.js ('K') | « lib/prefs.js ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld