(obj: any, callback: ForEachCallback<[string | symbol, PropertyDescriptor]>)
| 159 | |
| 160 | // 取物件本身及所有父类(不包含Object)的PropertyDescriptor |
| 161 | const getAllPropertyDescriptors = (obj: any, callback: ForEachCallback<[string | symbol, PropertyDescriptor]>) => { |
| 162 | while (obj && obj !== Object) { |
| 163 | const descs = Object.getOwnPropertyDescriptors(obj); |
| 164 | Object.entries(descs).forEach(callback); |
| 165 | obj = Object.getPrototypeOf(obj); |
| 166 | } |
| 167 | }; |
| 168 | |
| 169 | // 在 CacheSet 加入的propKeys将会在 mySandbox 实装阶段时设置 |
| 170 | const descsCache: Set<string | symbol> = new Set(["eval", "window", "self", "globalThis", "top", "parent"]); |
no test coverage detected