🧑💻not rebind a bounded function of document (#2412)
This commit is contained in:
parent
97af9ab187
commit
901dac8c7b
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Freer, SandBox } from '../../../interfaces';
|
import type { Freer, SandBox } from '../../../interfaces';
|
||||||
import { nativeDocument, nativeGlobal } from '../../../utils';
|
import { isBoundedFunction, nativeDocument, nativeGlobal } from '../../../utils';
|
||||||
import { getCurrentRunningApp } from '../../common';
|
import { getCurrentRunningApp } from '../../common';
|
||||||
import type { ContainerConfig } from './common';
|
import type { ContainerConfig } from './common';
|
||||||
import {
|
import {
|
||||||
|
|
@ -59,7 +59,7 @@ function patchDocument(cfg: { sandbox: SandBox; speedy: boolean }) {
|
||||||
|
|
||||||
const value = (<any>target)[p];
|
const value = (<any>target)[p];
|
||||||
// must rebind the function to the target otherwise it will cause illegal invocation error
|
// 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);
|
return value.bind(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user