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

Unified Diff: src/WebRequestJsObject.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/WebRequestJsObject.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/WebRequestJsObject.cpp
===================================================================
--- a/src/WebRequestJsObject.cpp
+++ b/src/WebRequestJsObject.cpp
@@ -38,17 +38,17 @@
{
AdblockPlus::JsConstValuePtr headersObj = arguments[1];
if (!headersObj->IsObject())
throw std::runtime_error("Second argument to GET must be an object");
std::vector<std::string> properties = headersObj->GetOwnPropertyNames();
for (const auto& header : properties)
{
- std::string headerValue = headersObj->GetProperty(header)->AsString();
+ std::string headerValue = headersObj->GetProperty(header).AsString();
if (header.length() && headerValue.length())
headers.push_back(std::pair<std::string, std::string>(header, headerValue));
}
}
callback = arguments[2];
if (!callback->IsFunction())
throw std::runtime_error("Third argument to GET must be a function");
@@ -74,17 +74,17 @@
resultObject->SetProperty("responseStatus", result.responseStatus);
resultObject->SetProperty("responseText", result.responseText);
AdblockPlus::JsValuePtr headersObject = jsEngine->NewObject();
for (const auto& header : result.responseHeaders)
{
headersObject->SetProperty(header.first, header.second);
}
- resultObject->SetProperty("responseHeaders", headersObject);
+ resultObject->SetProperty("responseHeaders", *headersObject);
AdblockPlus::JsConstValueList params;
params.push_back(resultObject);
callback->Call(params);
}
private:
AdblockPlus::JsEnginePtr jsEngine;
@@ -110,14 +110,14 @@
v8::Isolate* isolate = arguments.GetIsolate();
return v8::ThrowException(ToV8String(isolate, e.what()));
}
thread->Start();
return v8::Undefined();
}
}
-AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup(
- AdblockPlus::JsEngine& jsEngine, const AdblockPlus::JsValuePtr& obj)
+AdblockPlus::JsValue& AdblockPlus::WebRequestJsObject::Setup(
+ AdblockPlus::JsEngine& jsEngine, AdblockPlus::JsValue& obj)
{
- obj->SetProperty("GET", jsEngine.NewCallback(::GETCallback));
+ obj.SetProperty("GET", *jsEngine.NewCallback(::GETCallback));
return obj;
}
« no previous file with comments | « src/WebRequestJsObject.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld