PR-URL: https://github.com/nodejs/node/pull/47251 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
124 lines
3.7 KiB
Plaintext
124 lines
3.7 KiB
Plaintext
Test accessing unused private methods at runtime
|
|
|
|
Running test: testScopesPaused
|
|
private members of A in testStatic()
|
|
privateProperties from Runtime.getProperties()
|
|
undefined
|
|
[[PrivateMethods]] in internalProperties from Runtime.getProperties()
|
|
{
|
|
name : [[PrivateMethods]]
|
|
value : {
|
|
className : Array
|
|
description : PrivateMethods[1]
|
|
objectId : <objectId>
|
|
subtype : internal#privateMethodList
|
|
type : object
|
|
}
|
|
}
|
|
{
|
|
result : [
|
|
[0] : {
|
|
configurable : true
|
|
enumerable : true
|
|
isOwn : true
|
|
name : 0
|
|
value : {
|
|
className : Object
|
|
description : #staticMethod() { return 1; }
|
|
objectId : <objectId>
|
|
subtype : internal#privateMethod
|
|
type : object
|
|
}
|
|
writable : true
|
|
}
|
|
]
|
|
}
|
|
Access A.#staticMethod() in testStatic()
|
|
{
|
|
exceptionDetails : {
|
|
columnNumber : 0
|
|
exception : {
|
|
className : ReferenceError
|
|
description : ReferenceError: A is not defined at eval (eval at testStatic (:1:1), <anonymous>:1:1) at A.testStatic (<anonymous>:6:29) at run (<anonymous>:9:7) at <anonymous>:1:1
|
|
objectId : <objectId>
|
|
subtype : error
|
|
type : object
|
|
}
|
|
exceptionId : <exceptionId>
|
|
lineNumber : 0
|
|
scriptId : <scriptId>
|
|
text : Uncaught
|
|
}
|
|
result : {
|
|
className : ReferenceError
|
|
description : ReferenceError: A is not defined at eval (eval at testStatic (:1:1), <anonymous>:1:1) at A.testStatic (<anonymous>:6:29) at run (<anonymous>:9:7) at <anonymous>:1:1
|
|
objectId : <objectId>
|
|
subtype : error
|
|
type : object
|
|
}
|
|
}
|
|
Access this.#staticMethod() in testStatic()
|
|
{
|
|
exceptionDetails : {
|
|
columnNumber : 5
|
|
exception : {
|
|
className : Error
|
|
description : Error: Unused static private method '#staticMethod' cannot be accessed at debug time at eval (eval at testStatic (:1:1), <anonymous>:1:6) at A.testStatic (<anonymous>:6:29) at run (<anonymous>:9:7) at <anonymous>:1:1
|
|
objectId : <objectId>
|
|
subtype : error
|
|
type : object
|
|
}
|
|
exceptionId : <exceptionId>
|
|
lineNumber : 0
|
|
scriptId : <scriptId>
|
|
text : Uncaught
|
|
}
|
|
result : {
|
|
className : Error
|
|
description : Error: Unused static private method '#staticMethod' cannot be accessed at debug time at eval (eval at testStatic (:1:1), <anonymous>:1:6) at A.testStatic (<anonymous>:6:29) at run (<anonymous>:9:7) at <anonymous>:1:1
|
|
objectId : <objectId>
|
|
subtype : error
|
|
type : object
|
|
}
|
|
}
|
|
private members of a in testInstance()
|
|
privateProperties from Runtime.getProperties()
|
|
undefined
|
|
[[PrivateMethods]] in internalProperties from Runtime.getProperties()
|
|
{
|
|
name : [[PrivateMethods]]
|
|
value : {
|
|
className : Array
|
|
description : PrivateMethods[1]
|
|
objectId : <objectId>
|
|
subtype : internal#privateMethodList
|
|
type : object
|
|
}
|
|
}
|
|
{
|
|
result : [
|
|
[0] : {
|
|
configurable : true
|
|
enumerable : true
|
|
isOwn : true
|
|
name : 0
|
|
value : {
|
|
className : Object
|
|
description : #instanceMethod() { return 2; }
|
|
objectId : <objectId>
|
|
subtype : internal#privateMethod
|
|
type : object
|
|
}
|
|
writable : true
|
|
}
|
|
]
|
|
}
|
|
Evaluating this.#instanceMethod() in testInstance()
|
|
{
|
|
result : {
|
|
description : 2
|
|
type : number
|
|
value : 2
|
|
}
|
|
}
|