Skip to content
Open
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
8 changes: 4 additions & 4 deletions blink-extension/background.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === "eval") {

try {
//alert(message.code);
const result = eval("(()=>{"+message.code+"})()");
// Use Function constructor instead of eval for better security
const result = new Function(message.code)();
sendResponse({ result });
} catch (error) {
sendResponse({ error: error.message });
}
return true; // Indicate that the response will be sent asynchronously
// Use sendResponse correctly with a clear indication of asynchronous behav
return true;
}
});