chore: use indirect eval, avoid exposing stuff to the global scope (#11646)

* chore: use indirect eval, avoid exposing stuff to the global scope

* prettier
pull/11645/head
Rich Harris 1 year ago committed by GitHub
parent c131e6f494
commit 2e7e399160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -85,7 +85,7 @@
if (action === 'eval') {
try {
const { script } = ev.data.args;
eval(script);
(0, eval)(script);
send_ok();
} catch (e) {
send_error(e.message, e.stack);
@ -140,7 +140,6 @@
window.addEventListener('unhandledrejection', (event) => {
parent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*');
});
}).call(this);
let previous = { level: null, args: null };
@ -200,7 +199,11 @@
);
} else {
parent.postMessage(
{ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] },
{
action: 'console',
level: 'system-warn',
args: [`Timer '${label}' does not exist`]
},
'*'
);
}
@ -219,7 +222,11 @@
);
} else {
parent.postMessage(
{ action: 'console', level: 'system-warn', args: [`Timer '${label}' does not exist`] },
{
action: 'console',
level: 'system-warn',
args: [`Timer '${label}' does not exist`]
},
'*'
);
}
@ -294,6 +301,7 @@
return null;
}
}
})();
</script>
</head>
<body></body>

Loading…
Cancel
Save