-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: don't throw on bytesWritten access
If bytesWritten is accessed before the object has been properly constructed then return undefined. Fixes: #3298 PR-URL: #3305 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- Loading branch information
1 parent
3202456
commit a713024
Showing
2 changed files
with
19 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const net = require('net'); | ||
const tls = require('tls'); | ||
const tty = require('tty'); | ||
|
||
// Check that the bytesWritten getter doesn't crash if object isn't | ||
// constructed. | ||
assert.strictEqual(net.Socket.prototype.bytesWritten, undefined); | ||
assert.strictEqual(tls.TLSSocket.super_.prototype.bytesWritten, undefined); | ||
assert.strictEqual(tls.TLSSocket.prototype.bytesWritten, undefined); | ||
assert.strictEqual(tty.ReadStream.super_.prototype.bytesWritten, undefined); | ||
assert.strictEqual(tty.ReadStream.prototype.bytesWritten, undefined); | ||
assert.strictEqual(tty.WriteStream.prototype.bytesWritten, undefined); |