* Synchronizes a single property from `hostTarget` onto `shadowTarget` when required by V8 * Proxy invariants (e.g. non-configurable properties, array `length`, or non-extensible targets).
( shadowTarget: HostTarget, hostTarget: HostTarget, prop: string | symbol, )
| 386 | * Proxy invariants (e.g. non-configurable properties, array `length`, or non-extensible targets). |
| 387 | */ |
| 388 | function syncShadowProperty( |
| 389 | shadowTarget: HostTarget, |
| 390 | hostTarget: HostTarget, |
| 391 | prop: string | symbol, |
| 392 | ): PropertyDescriptor | undefined { |
| 393 | const hostDesc = Reflect.getOwnPropertyDescriptor(hostTarget, prop); |
| 394 | if (!hostDesc) { |
| 395 | const shadowDesc = Reflect.getOwnPropertyDescriptor(shadowTarget, prop); |
| 396 | if (shadowDesc?.configurable) { |
| 397 | Reflect.deleteProperty(shadowTarget, prop); |
| 398 | } |
| 399 | return undefined; |
| 400 | } |
| 401 | const wrappedDesc = mapDescriptorForSandbox(hostDesc); |
| 402 | const shadowDesc = Reflect.getOwnPropertyDescriptor(shadowTarget, prop); |
| 403 | if (!wrappedDesc.configurable || shadowDesc !== undefined || !Reflect.isExtensible(shadowTarget)) { |
| 404 | Reflect.defineProperty(shadowTarget, prop, wrappedDesc); |
| 405 | } |
| 406 | return wrappedDesc; |
| 407 | } |
| 408 | |
| 409 | function pruneShadowKeys(shadowTarget: HostTarget, hostKeySet: ReadonlySet<string | symbol>): Array<string | symbol> { |
| 410 | const retainedNonConfigurable: Array<string | symbol> = []; |
no test coverage detected