Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions example/tests/sandbox_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
},
));

await test("裸 delete 沙盒全局变量不应删除页面同名全局变量", () =>
await test("裸 delete 页面全局变量不应删除沙盒同名全局变量", () =>
withCleanup(
() => {
const key = `${markerPrefix}_delete_bare_page_global`;
Expand All @@ -286,9 +286,10 @@
assertSame("page-value", unsafeWindow[key], "页面变量应保持存在");

try {
Function(`return delete ${key};`)(); // 半沙盒在頁面執行
Function(`return delete ${key};`)(); // 半沙盒在页面执行
} catch (e) {
throw new Error("This page cannot execute script", e);
console.error(e);
delete unsafeWindow[key]; // fallback
}

assertSame(undefined, unsafeWindow[key], "裸 delete 后页面变量应消失");
Expand Down
2 changes: 1 addition & 1 deletion src/pages/options/routes/ScriptList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@
}
});
}
}, []);

Check warning on line 259 in src/pages/options/routes/ScriptList/index.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has a missing dependency: 'usp'. Either include it or remove the dependency array

return (
<Card id="script-list" className="script-list" style={{ height: "100%", overflowY: "auto" }}>
<div className="tw-flex tw-flex-col">
<div className="tw-flex tw-flex-row tw-relative">
<div className="tw-flex tw-flex-row tw-relative tw-overscroll-none">
<ScriptListSidebar
open={sidebarOpen}
filterItems={filterItems}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/options/routes/script/ScriptEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
return () => {
disposables.forEach((d) => d.dispose());
};
}, [node?.editor]);

Check warning on line 100 in src/pages/options/routes/script/ScriptEditor.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has a missing dependency: 'node'. Either include it or remove the dependency array

return <CodeEditor key={id} id={id} ref={ref} className={className} code={code} diffCode="" editable />;
};
Expand Down Expand Up @@ -875,7 +875,7 @@
</div>
</div>
<Row
className="tw-flex tw-flex-grow tw-flex-1"
className="tw-flex tw-flex-grow tw-flex-1 tw-overscroll-none"
style={{
overflow: "hidden",
}}
Expand Down
Loading