-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
src,stream: use SetAccessorProperty instead of SetAccessor #17665
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
Changes from 1 commit
329e162
dcca3a5
ebbe147
a03028f
06d8157
0b96b12
26ffff1
9292fa0
354008a
a199e07
5eb6507
232d2be
d89578a
5a60daa
84905d6
73aaf0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| 'use strict'; | ||
|
|
||
| require('../common'); | ||
|
|
||
| // This tests that the accessor properties do not raise assersions | ||
| // when called with incompatible receivers. | ||
|
|
||
| const assert = require('assert'); | ||
|
|
||
| // Examples are things that calls StreamBase::AddMethods when setting up | ||
| // their prototype | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you're here: can you punctuate the comments in this file?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) This comment barely made sense (it was early morning when the last commit came in), hopefully it’s better now. |
||
| const TTY = process.binding('tty_wrap').TTY; | ||
| const UDP = process.binding('udp_wrap').UDP; | ||
|
|
||
| // Or the accessor properties in crypto | ||
| const crypto = process.binding('crypto'); | ||
|
|
||
| { | ||
| // Should throw instead of raise assertions | ||
| assert.throws(() => { | ||
| TTY.prototype.bytesRead; | ||
| }, TypeError); | ||
|
|
||
| assert.throws(() => { | ||
| TTY.prototype.fd; | ||
| }, TypeError); | ||
|
|
||
| assert.throws(() => { | ||
| TTY.prototype._externalStream; | ||
| }, TypeError); | ||
|
|
||
| assert.throws(() => { | ||
| UDP.prototype.fd; | ||
| }, TypeError); | ||
|
|
||
| assert.throws(() => { | ||
| crypto.SecureContext.prototype._external; | ||
| }, TypeError); | ||
|
|
||
| assert.throws(() => { | ||
| crypto.Connection.prototype._external; | ||
| }, TypeError); | ||
|
|
||
|
|
||
| // Should not throw for Object.getOwnPropertyDescriptor | ||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor(TTY.prototype, 'bytesRead'), | ||
| 'object' | ||
| ); | ||
|
|
||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor(TTY.prototype, 'fd'), | ||
| 'object' | ||
| ); | ||
|
|
||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor(TTY.prototype, '_externalStream'), | ||
| 'object' | ||
| ); | ||
|
|
||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor(UDP.prototype, 'fd'), | ||
| 'object' | ||
| ); | ||
|
|
||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor( | ||
| crypto.SecureContext.prototype, '_external'), | ||
| 'object' | ||
| ); | ||
|
|
||
| assert.strictEqual( | ||
| typeof Object.getOwnPropertyDescriptor( | ||
| crypto.Connection.prototype, '_external'), | ||
| 'object' | ||
| ); | ||
| } | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: assertions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Done.