2020-05-05 09:19:02 +02:00
Test accessing unused private methods at runtime
Running test: testScopesPaused
2023-03-30 12:11:08 +02:00
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
2020-05-05 09:19:02 +02:00
}
2023-03-30 12:11:08 +02:00
}
{
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
}
]
}
2020-05-05 09:19:02 +02:00
Access A.#staticMethod() in testStatic()
{
exceptionDetails : {
columnNumber : 0
exception : {
className : ReferenceError
2022-04-19 09:00:36 +02:00
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
2021-02-11 19:03:35 +01:00
objectId : <objectId>
2020-05-05 09:19:02 +02:00
subtype : error
type : object
}
2021-02-11 19:03:35 +01:00
exceptionId : <exceptionId>
2020-05-05 09:19:02 +02:00
lineNumber : 0
2021-02-11 19:03:35 +01:00
scriptId : <scriptId>
2020-05-05 09:19:02 +02:00
text : Uncaught
}
result : {
className : ReferenceError
2022-04-19 09:00:36 +02:00
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
2021-02-11 19:03:35 +01:00
objectId : <objectId>
2020-05-05 09:19:02 +02:00
subtype : error
type : object
}
}
Access this.#staticMethod() in testStatic()
{
exceptionDetails : {
2022-01-29 08:33:07 +01:00
columnNumber : 5
2020-05-05 09:19:02 +02:00
exception : {
className : Error
2022-04-19 09:00:36 +02:00
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
2021-02-11 19:03:35 +01:00
objectId : <objectId>
2020-05-05 09:19:02 +02:00
subtype : error
type : object
}
2021-02-11 19:03:35 +01:00
exceptionId : <exceptionId>
2020-05-05 09:19:02 +02:00
lineNumber : 0
2021-02-11 19:03:35 +01:00
scriptId : <scriptId>
2020-05-05 09:19:02 +02:00
text : Uncaught
}
result : {
className : Error
2022-04-19 09:00:36 +02:00
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
2021-02-11 19:03:35 +01:00
objectId : <objectId>
2020-05-05 09:19:02 +02:00
subtype : error
type : object
}
}
2023-03-30 12:11:08 +02:00
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
2020-05-05 09:19:02 +02:00
}
2023-03-30 12:11:08 +02:00
}
{
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
}
]
}
2020-05-05 09:19:02 +02:00
Evaluating this.#instanceMethod() in testInstance()
{
result : {
description : 2
type : number
value : 2
}
}