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

Unified Diff: src/WebRequestJsObject.cpp

Issue 29377570: Issue 4931 - add possibility to not send data depending on connection properties (Closed)
Patch Set: address comment Created March 16, 2017, 2:38 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/JsEngine.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/WebRequestJsObject.cpp
diff --git a/src/WebRequestJsObject.cpp b/src/WebRequestJsObject.cpp
index 48a703709053895845a5bb83e4036158b9b094f9..e96ed1f6fbce4481936acd53908e5d6c301b4265 100644
--- a/src/WebRequestJsObject.cpp
+++ b/src/WebRequestJsObject.cpp
@@ -56,9 +56,18 @@ namespace
throw std::runtime_error("Third argument to GET must be a function");
}
+ AdblockPlus::ServerResponse NotAllowedResponse()
+ {
+ AdblockPlus::ServerResponse result;
+ result.status = AdblockPlus::WebRequest::NS_ERROR_CONNECTION_REFUSED;
+ result.responseStatus = 0;
+ return result;
+ }
+
void Run()
{
- AdblockPlus::ServerResponse result = jsEngine->GetWebRequest()->GET(url, headers);
+ AdblockPlus::ServerResponse result = jsEngine->IsConnectionAllowed() ?
+ jsEngine->GetWebRequest()->GET(url, headers) : NotAllowedResponse();
AdblockPlus::JsContext context(jsEngine);
« no previous file with comments | « src/JsEngine.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld