int ScriptWrapper::GetPropertyValue(BrowserManager *manager, const std::wstring& property_name, Json::Value *property_value){ std::wstring get_value_script(L"(function(){return function() {return arguments[0][arguments[1]];}})();"); ScriptWrapper get_value_script_wrapper(this->script_engine_host_, get_value_script, 2); get_value_script_wrapper.AddArgument(this->result_); get_value_script_wrapper.AddArgument(property_name); int get_value_result = get_value_script_wrapper.Execute(); if (get_value_result != SUCCESS) { return get_value_result; } int property_value_status = get_value_script_wrapper.ConvertResultToJsonValue(manager, property_value); return SUCCESS; }
int Script::GetPropertyValue(const IECommandExecutor& executor, const std::wstring& property_name, Json::Value* property_value){ LOG(TRACE) << "Entering Script::GetPropertyValue"; std::wstring get_value_script = L"(function(){return function() {return arguments[0][arguments[1]];}})();"; Script get_value_script_wrapper(this->script_engine_host_, get_value_script, 2); get_value_script_wrapper.AddArgument(this->result_); get_value_script_wrapper.AddArgument(property_name); int get_value_result = get_value_script_wrapper.Execute(); if (get_value_result != SUCCESS) { LOG(WARN) << "Unable to get property value, script execution returned error code"; return get_value_result; } int property_value_status = get_value_script_wrapper.ConvertResultToJsonValue(executor, property_value); return SUCCESS; }