Commit 86e3903
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: #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>1 parent 940d204 commit 86e3903Copy full SHA for 86e3903
File tree
Expand file treeCollapse file tree
2 files changed
+6
-1
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+6
-1
lines changedOpen diff view settings
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
241 | 241 | |
242 | 242 | |
243 | 243 | |
244 | | - |
| 244 | + |
245 | 245 | |
246 | 246 | |
247 | 247 | |
|
Collapse file
test/parallel/test-c-ares.js
Copy file name to clipboardExpand all lines: test/parallel/test-c-ares.js+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
27 | 27 | |
28 | 28 | |
29 | 29 | |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
30 | 35 | |
31 | 36 | |
32 | 37 | |
|
0 commit comments