移除冗余代码;覆盖测试代码

This commit is contained in:
IceCola 2024-05-27 15:59:48 +08:00
parent 7c0fa0b02e
commit 7a8a98424c
1 changed files with 5 additions and 17 deletions

View File

@ -565,18 +565,6 @@ function createSandbox() {
// TODO: 仅提供必要的document函数(?)
box.document = document;
if (topVariables.game
&& topVariables.game.ws) {
const match = WSURL_FOR_IP.exec(topVariables.game.ws.url);
if (match && TRUSTED_IPS.includes(match[1])) {
box.scope.ArrayBuffer = ArrayBuffer;
box.scope.localStorage = localStorage;
box.scope.exports = undefined;
box.scope.define = undefined;
}
}
// 传递七个变量
Object.assign(box.scope, topVariables);
// 复制垫片函数
@ -897,11 +885,11 @@ function setupPolyfills(sandbox) {
}
// 测试暴露喵
Reflect.defineProperty(window, "sandbox", {
get: () => defaultSandbox,
set: () => { },
configurable: true,
});
// Reflect.defineProperty(window, "sandbox", {
// get: () => defaultSandbox,
// set: () => { },
// configurable: true,
// });
const exports = {
enterSandbox,