✨ add some bom variables to white list and optimize runtime get trap in sandbox (#1845)
Co-authored-by: zexuan.dzx <zexuan.dzx@myxiaojin.cn>
This commit is contained in:
parent
4691c652ec
commit
908264ccd0
|
|
@ -6,7 +6,7 @@
|
||||||
import type { SandBox } from '../interfaces';
|
import type { SandBox } from '../interfaces';
|
||||||
import { SandBoxType } from '../interfaces';
|
import { SandBoxType } from '../interfaces';
|
||||||
import { nativeGlobal, nextTask } from '../utils';
|
import { nativeGlobal, nextTask } from '../utils';
|
||||||
import { getTargetValue, setCurrentRunningApp } from './common';
|
import { getTargetValue, setCurrentRunningApp, getCurrentRunningApp } from './common';
|
||||||
|
|
||||||
type SymbolTarget = 'target' | 'globalContext';
|
type SymbolTarget = 'target' | 'globalContext';
|
||||||
|
|
||||||
|
|
@ -59,6 +59,18 @@ const unscopables = {
|
||||||
Symbol: true,
|
Symbol: true,
|
||||||
parseFloat: true,
|
parseFloat: true,
|
||||||
Float32Array: true,
|
Float32Array: true,
|
||||||
|
isNaN: true,
|
||||||
|
Infinity: true,
|
||||||
|
Reflect: true,
|
||||||
|
Float64Array: true,
|
||||||
|
Function: true,
|
||||||
|
Map: true,
|
||||||
|
NaN: true,
|
||||||
|
Promise: true,
|
||||||
|
Proxy: true,
|
||||||
|
Set: true,
|
||||||
|
parseInt: true,
|
||||||
|
requestAnimationFrame: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeWindowForBindingsProps = new Map<PropertyKey, boolean>([
|
const useNativeWindowForBindingsProps = new Map<PropertyKey, boolean>([
|
||||||
|
|
@ -148,7 +160,10 @@ export default class ProxySandbox implements SandBox {
|
||||||
|
|
||||||
private registerRunningApp(name: string, proxy: Window) {
|
private registerRunningApp(name: string, proxy: Window) {
|
||||||
if (this.sandboxRunning) {
|
if (this.sandboxRunning) {
|
||||||
|
const currentRunningApp = getCurrentRunningApp();
|
||||||
|
if (!currentRunningApp || currentRunningApp.name !== name) {
|
||||||
setCurrentRunningApp({ name, window: proxy });
|
setCurrentRunningApp({ name, window: proxy });
|
||||||
|
}
|
||||||
// FIXME if you have any other good ideas
|
// FIXME if you have any other good ideas
|
||||||
// remove the mark in next tick, thus we can identify whether it in micro app or not
|
// remove the mark in next tick, thus we can identify whether it in micro app or not
|
||||||
// this approach is just a workaround, it could not cover all complex cases, such as the micro app runs in the same task context with master in some case
|
// this approach is just a workaround, it could not cover all complex cases, such as the micro app runs in the same task context with master in some case
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user