-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: removed unnecessary prototypes from Environment::SetProtoMethod
Added an optional parameter of type v8::ConstructorBehavior to Environment::NewFunctionTemplate, defaulting to v8::ConstructorBehavior::kAllow. Also modified Environment::SetProtoMethod to pass v8::ConstructorBehavior::kThrow to its call to Environment::NewFunctionTemplate. Fixes: #17668 Refs: #20321 PR-URL: #20321 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- Loading branch information
1 parent
d55f90d
commit 380dfe4
Showing
3 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/parallel/test-env-newprotomethod-remove-unnecessary-prototypes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
// This test ensures that unnecessary prototypes are no longer | ||
// being generated by Environment::NewFunctionTemplate. | ||
|
||
const assert = require('assert'); | ||
|
||
[ | ||
process.binding('udp_wrap').UDP.prototype.bind6, | ||
process.binding('tcp_wrap').TCP.prototype.bind6, | ||
process.binding('udp_wrap').UDP.prototype.send6, | ||
process.binding('tcp_wrap').TCP.prototype.bind, | ||
process.binding('udp_wrap').UDP.prototype.close, | ||
process.binding('tcp_wrap').TCP.prototype.open | ||
].forEach((binding, i) => { | ||
assert.strictEqual('prototype' in binding, false, `Test ${i} failed`); | ||
}); |