dns: Use object without protoype for map
authorBenjamin Gruenbaum <inglor@gmail.com>
Tue, 22 Mar 2016 13:40:36 +0000 (15:40 +0200)
committerMyles Borins <mborins@us.ibm.com>
Fri, 8 Apr 2016 21:23:45 +0000 (17:23 -0400)
commit86e3903626cb6f5328d3ce53b6bbac288d0b7f56
tree6cf5fe5b3782d87554ed4a2ad31c08ecefd41588
parent940d2044013ef3014624eb3192cd02b913298484
dns: Use object without protoype for map

Currently we use `{}` for the `lookup` function to find the relevant
resolver to the dns.resolve function. It is preferable to use an
object without a Object.prototype, currently for example you can do
something like:

```js
dns.resolve("google.com", "toString", console.log);
```

And get `[Object undefined]` logged and the callback would never be
called. This is unexpected and strange behavior in my opinion.
In addition, if someone adds a property to `Object.prototype` might
also create unexpected results.

This pull request fixes it, with it an appropriate error is thrown.

PR-URL: https://github.com/nodejs/node/pull/5843
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
lib/dns.js
test/parallel/test-c-ares.js