Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: Use object without protoype for map #5843

Closed
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
2 changes: 1 addition & 1 deletion lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function resolver(bindingName) {
}


var resolveMap = {};
var resolveMap = Object.create(null);
exports.resolve4 = resolveMap.A = resolver('queryA');
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-c-ares.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ assert.throws(function() {
dns.resolve('www.google.com', 'HI');
}, /Unknown type/);

// Try calling resolve with an unsupported type that's an object key
assert.throws(function() {
dns.resolve('www.google.com', 'toString');
}, /Unknown type/);

// Windows doesn't usually have an entry for localhost 127.0.0.1 in
// C:\Windows\System32\drivers\etc\hosts
// so we disable this test on Windows.
Expand Down