Skip to content

Commit 7d63cc2

Browse files
committed
fix(vm-sandbox): safe to define iframe global
1 parent cb7416e commit 7d63cc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/browser-vm/src/dynamicNode/processor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
isJsType,
1818
isCssType,
1919
error,
20+
safeWrapper,
2021
} from '@garfish/utils';
2122
import { rootElm } from '../utils';
2223
import { Sandbox } from '../sandbox';
@@ -311,7 +312,7 @@ export class DynamicNodeProcessor {
311312
const { el, sandbox } = this;
312313
const originOnload = el.onload;
313314
el.onload = function () {
314-
def(el.contentWindow, 'parent', sandbox.global);
315+
safeWrapper(() => def(el.contentWindow, 'parent', sandbox.global));
315316
return originOnload.apply(this, arguments);
316317
};
317318
}

0 commit comments

Comments
 (0)