Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
build
build
*.tgz
*.log
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*
!.eslintignore
!.eslintrc
!binding.gyp
!getdns.js
!LICENSE
!package.json
!README.md
!resources/logo/*.png
!samples/example-raw.js
!src/*.cpp
!src/*.h
!test/*.js
13 changes: 11 additions & 2 deletions getdns.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ const getdns = require("bindings")("getdns");
module.exports = getdns.constants;

// Wrap context creation.
module.exports.createContext = function(...args) {
const ctx = new getdns.Context(...args);
module.exports.createContext = function(options) {
if (arguments.length > 1) {
// NOTE: duplicated in getdns.js and GNContext.cpp.
// TODO: use new getdns.Context(...args) when not supporting node.js v4 anymore.
const tooManyArgumentsTypeError = new TypeError("Too many arguments.");
tooManyArgumentsTypeError.code = getdns.constants.RETURN_INVALID_PARAMETER;

throw tooManyArgumentsTypeError;
}

const ctx = new getdns.Context(options);
const oldDestroyFunc = ctx.destroy;
let destroyed = false;

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "getdns",
"version": "1.0.0",
"version": "2.0.0-alpha.1",
"description": "getdns bindings for Node.js. getdns is a modern asynchronous DNS API. It implements DNS entry points from a design developed and vetted by application developers, in an API specification.",
"main": "getdns.js",
"keywords": [
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"scripts": {
"install": "npm run --silent rebuild",
"postinstall": "npm run --silent rebuild",
"postinstall": "npm run --silent rebuild && npm run --silent test",
"clean": "node-gyp clean",
"build": "node-gyp configure build",
"rebuild": "node-gyp rebuild",
Expand Down
2 changes: 2 additions & 0 deletions src/GNContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ NAN_METHOD(GNContext::Destroy) {
NAN_METHOD(GNContext::New) {
if (info.IsConstructCall()) {
if (info.Length() > 1) {
// NOTE: duplicated in getdns.js and GNContext.cpp.
// TODO: use new getdns.Context(...args) when not supporting node.js v4 anymore.
Local<Value> typeError = makeTypeErrorWithCode("Too many arguments.", GETDNS_RETURN_INVALID_PARAMETER);
return Nan::ThrowError(typeError);
}
Expand Down
2 changes: 1 addition & 1 deletion test/bad-dns-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("BADDNS", () => {
getdns.BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE,
];

return badDnsValus.includes(badDns);
return badDnsValus.indexOf(badDns) !== -1;
});
expect(badDnsReplies.length).to.be(reply.bad_dns.length);
});
Expand Down
3 changes: 1 addition & 2 deletions test/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ const expect = require("expect.js");
const segfaultHandler = require("segfault-handler");

const initialize = () => {
// Dump segfault stacktraces both to the console and to a file.
const segfaultDumpFilename = "crash.log";

// Dump segfault stacktraces both to the console and to a file.
segfaultHandler.registerHandler(segfaultDumpFilename);
};

Expand Down