From 2b63bcde91ec233821b711c02282e0080c7e75d9 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Mon, 14 Dec 2020 22:52:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20sync=20getOwnPropertyDescriptor?= =?UTF-8?q?=20trap=20logic=20of=20legacy=20sandbox=20from=20proxy=20sandbo?= =?UTF-8?q?x=20(#1156)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sandbox/legacy/sandbox.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sandbox/legacy/sandbox.ts b/src/sandbox/legacy/sandbox.ts index 0440f0c..8f5a586 100644 --- a/src/sandbox/legacy/sandbox.ts +++ b/src/sandbox/legacy/sandbox.ts @@ -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; }, });