|
| 1 | +class PrivateMembersTestClassParent { |
| 2 | + parentInstancePublicProperty = 'parentInstancePublicPropertyValue'; |
| 3 | + #parentInstancePrivateProperty = 'parentInstancePrivatePropertyValue'; |
| 4 | + parentInstancePublicMethod() { } |
| 5 | + #parentInstancePrivateMethod() { } |
| 6 | + get parentInstancePublicGetter() { } |
| 7 | + set parentInstancePublicSetter(x) { } |
| 8 | + get parentInstancePublicGetterSetter() { } |
| 9 | + set parentInstancePublicGetterSetter(x) { } |
| 10 | + get #parentInstancePrivateGetter() { } |
| 11 | + set #parentInstancePrivateSetter(x) { } |
| 12 | + get #parentInstancePrivateGetterSetter() { } |
| 13 | + set #parentInstancePrivateGetterSetter(x) { } |
| 14 | + static parentClassPublicProperty = 'parentClassPublicPropertyValue'; |
| 15 | + static #parentClassPrivateProperty = 'parentClassPrivatePropertyValue'; |
| 16 | + static parentClassPublicMethod() { } |
| 17 | + static #parentClassPrivateMethod() { } |
| 18 | + static get parentClassPublicGetter() { } |
| 19 | + static set parentClassPublicSetter(x) { } |
| 20 | + static get parentClassPublicGetterSetter() { } |
| 21 | + static set parentClassPublicGetterSetter(x) { } |
| 22 | + static get #parentClassPrivateGetter() { } |
| 23 | + static set #parentClassPrivateSetter(x) { } |
| 24 | + static get #parentClassPrivateGetterSetter() { } |
| 25 | + static set #parentClassPrivateGetterSetter(x) { } |
| 26 | + static toString() { return "<redacted>"; } |
| 27 | +} |
| 28 | + |
| 29 | +class PrivateMembersTestClassChild extends PrivateMembersTestClassParent { |
| 30 | + childInstancePublicProperty = 'childInstancePublicPropertyValue'; |
| 31 | + #childInstancePrivateProperty = 'childInstancePrivatePropertyValue'; |
| 32 | + childInstancePublicMethod() { } |
| 33 | + #childInstancePrivateMethod() { } |
| 34 | + get childInstancePublicGetter() { } |
| 35 | + set childInstancePublicSetter(x) { } |
| 36 | + get childInstancePublicGetterSetter() { } |
| 37 | + set childInstancePublicGetterSetter(x) { } |
| 38 | + get #childInstancePrivateGetter() { } |
| 39 | + set #childInstancePrivateSetter(x) { } |
| 40 | + get #childInstancePrivateGetterSetter() { } |
| 41 | + set #childInstancePrivateGetterSetter(x) { } |
| 42 | + static childClassPublicProperty = 'childClassPublicPropertyValue'; |
| 43 | + static #childClassPrivateProperty = 'childClassPrivatePropertyValue'; |
| 44 | + static childClassPublicMethod() { } |
| 45 | + static #childClassPrivateMethod() { } |
| 46 | + static get childClassPublicGetter() { } |
| 47 | + static set childClassPublicSetter(x) { } |
| 48 | + static get childClassPublicGetterSetter() { } |
| 49 | + static set childClassPublicGetterSetter(x) { } |
| 50 | + static get #childClassPrivateGetter() { } |
| 51 | + static set #childClassPrivateSetter(x) { } |
| 52 | + static get #childClassPrivateGetterSetter() { } |
| 53 | + static set #childClassPrivateGetterSetter(x) { } |
| 54 | + static toString() { return "<redacted>"; } |
| 55 | +} |
| 56 | + |
1 | 57 | function makeArray(length) { |
2 | 58 | return Array(length).fill().map((item, i) => { |
3 | 59 | let code = (i % 2) ? ("Z".charCodeAt(0) - i) : ("A".charCodeAt(0) + i); |
@@ -32,18 +88,23 @@ function makeWeakSet(length) { |
32 | 88 | TestPage.registerInitializer(() => { |
33 | 89 | ProtocolTest.PropertyDescriptorUtilities = {}; |
34 | 90 |
|
35 | | - ProtocolTest.PropertyDescriptorUtilities.logForEach = function({name, value, ...extra}, index, array) { |
| 91 | + ProtocolTest.PropertyDescriptorUtilities.logForEach = function({name, value, get, set, ...extra}, index, array) { |
36 | 92 | let maxPropertyNameLength = array.reduce((max, {name}) => name.length > max ? name.length : max, 0) + 2; // add 2 for the surrounding quotes |
37 | 93 | let paddedName = JSON.stringify(name).padEnd(maxPropertyNameLength, " "); |
38 | 94 | let descriptorKeys = []; |
39 | 95 | for (let [key, value] of Object.entries(extra)) { |
40 | 96 | if (value) { |
41 | | - ProtocolTest.assert(typeof value === "boolean", `Property descriptor '${key}' has a non-boolean value '${value}'.`); |
| 97 | + ProtocolTest.assert(typeof value === "boolean", `Property descriptor '${key}' has a non-boolean value '${JSON.stringify(value)}'.`); |
42 | 98 | descriptorKeys.push(key); |
43 | 99 | } |
44 | 100 | } |
45 | 101 |
|
46 | | - ProtocolTest.log(` ${paddedName} => ${ProtocolTest.PropertyDescriptorUtilities.stringifyRemoteObject(value)} [${descriptorKeys.join(" | ")}]`); |
| 102 | + if (value) |
| 103 | + ProtocolTest.log(` ${paddedName} => ${ProtocolTest.PropertyDescriptorUtilities.stringifyRemoteObject(value)} [${descriptorKeys.join(" | ")}]`); |
| 104 | + if (get) |
| 105 | + ProtocolTest.log(` ${paddedName} => get ${ProtocolTest.PropertyDescriptorUtilities.stringifyRemoteObject(get)} [${descriptorKeys.join(" | ")}]`); |
| 106 | + if (set) |
| 107 | + ProtocolTest.log(` ${paddedName} => set ${ProtocolTest.PropertyDescriptorUtilities.stringifyRemoteObject(set)} [${descriptorKeys.join(" | ")}]`); |
47 | 108 | }; |
48 | 109 |
|
49 | 110 | ProtocolTest.PropertyDescriptorUtilities.stringifyRemoteObject = function(remoteObject) { |
|
0 commit comments