From 901dac8c7b56c28774a3d0d86bed61f5b9d69756 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Sun, 26 Feb 2023 16:49:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BBnot=20rebind?= =?UTF-8?q?=20a=20bounded=20function=20of=20document=20(#2412)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts b/src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts index 07a992b..ae4a876 100644 --- a/src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts +++ b/src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts @@ -4,7 +4,7 @@ */ import type { Freer, SandBox } from '../../../interfaces'; -import { nativeDocument, nativeGlobal } from '../../../utils'; +import { isBoundedFunction, nativeDocument, nativeGlobal } from '../../../utils'; import { getCurrentRunningApp } from '../../common'; import type { ContainerConfig } from './common'; import { @@ -59,7 +59,7 @@ function patchDocument(cfg: { sandbox: SandBox; speedy: boolean }) { const value = (target)[p]; // must rebind the function to the target otherwise it will cause illegal invocation error - if (typeof value === 'function') { + if (typeof value === 'function' && !isBoundedFunction(value)) { return value.bind(target); }