summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);