summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2015-08-27 15:23:46 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2015-08-27 15:23:46 -0400
commitc2539d6bd4579e0599a5f86a66e7ffd591b049c2 (patch)
treecb282bbc67a14d2b5cebc690e40122f7eae39622 /platform
parent580719c9f9913cf5b412852c38c49e2024e478b4 (diff)
downloadqtlocation-mapboxgl-c2539d6bd4579e0599a5f86a66e7ffd591b049c2.tar.gz
more logging, don't respond to cancelled requests
Diffstat (limited to 'platform')
-rw-r--r--platform/node/src/node_request.cpp5
-rw-r--r--platform/node/test/render.test.js10
2 files changed, 11 insertions, 4 deletions
diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp
index 521b105161..a003e41ee5 100644
--- a/platform/node/src/node_request.cpp
+++ b/platform/node/src/node_request.cpp
@@ -62,7 +62,7 @@ NAN_METHOD(NodeRequest::Respond) {
// Request has already been responded to, or was canceled, fail silently.
if (!nodeRequest->resource) NanReturnUndefined();
- std::cout << "RESPOND: " << nodeRequest->resource->url << std::endl;
+ std::cout << "C++ RESPOND: " << nodeRequest->resource->url << std::endl;
auto source = nodeRequest->source;
auto resource = std::move(nodeRequest->resource);
@@ -136,10 +136,11 @@ NodeRequest::NodeRequest(NodeFileSource* source_, const mbgl::Resource& resource
resource(std::make_unique<mbgl::Resource>(resource_)) {}
NodeRequest::~NodeRequest() {
- if (resource) std::cout << "DESTROY: " << resource->url << std::endl;
+ if (resource) std::cout << "C++ DESTROY: " << resource->url << std::endl;
}
void NodeRequest::cancel() {
+ std::cout << "C++ CANCEL: " << resource->url << std::endl;
resource.reset();
}
diff --git a/platform/node/test/render.test.js b/platform/node/test/render.test.js
index ff0f1684fc..a76e6baf04 100644
--- a/platform/node/test/render.test.js
+++ b/platform/node/test/render.test.js
@@ -42,12 +42,18 @@ function renderTest(style, info, base, key) {
var options = {};
options.request = function(req) {
var url = decodeURIComponent(req.url);
- console.log('REQUEST: ', url);
+ console.log('JAVASCRIPT REQUEST:', url);
fs.readFile(path.join(suitePath, url), function(err, data) {
// t.error(err);
- req.respond(err, { data: data });
+ console.log('CANCELED?', req.canceled, 'ERROR?', err, url);
+ if (!req.canceled) req.respond(err, { data: data });
});
};
+ options.cancel = function(req) {
+ var url = decodeURIComponent(req.url);
+ console.log('JAVASCRIPT CANCEL:', url);
+ req.canceled = true;
+ };
options.ratio = 1.0;
var map = new mbgl.Map(options);