🐛 sync getOwnPropertyDescriptor trap logic of legacy sandbox from proxy sandbox (#1156)

This commit is contained in:
Kuitos 2020-12-14 22:52:12 +08:00 committed by GitHub
parent 757a8fdc23
commit 2b63bcde91

View File

@ -124,7 +124,12 @@ export default class SingularProxySandbox implements SandBox {
},
getOwnPropertyDescriptor(_: Window, p: PropertyKey): PropertyDescriptor | undefined {
return Object.getOwnPropertyDescriptor(rawWindow, p);
const descriptor = Object.getOwnPropertyDescriptor(rawWindow, p);
// A property cannot be reported as non-configurable, if it does not exists as an own property of the target object
if (descriptor && !descriptor.configurable) {
descriptor.configurable = true;
}
return descriptor;
},
});