Agent Zero AI framework
Use inline confirmation for extension deletion
Alessandroa592d3c9ab30
diff --git a/plugins/_browser/webui/browser-config-store.js b/plugins/_browser/webui/browser-config-store.jsindex 6ae665209..ca354444a 100644--- a/plugins/_browser/webui/browser-config-store.js+++ b/plugins/_browser/webui/browser-config-store.js@@ -1,5 +1,6 @@import { createStore } from "/js/AlpineStore.js";import { callJsonApi } from "/js/api.js";+import { showConfirmDialog } from "/js/confirmDialog.js";const BROWSER_EXTENSIONS_API = "/plugins/_browser/extensions";const BROWSER_STATUS_API = "/plugins/_browser/status";@@ -449,9 +450,14 @@ export const store = createStore("browserConfig", {return;}const name = String(extension?.name || "this extension").trim();- if (globalThis.confirm && !globalThis.confirm(`Delete ${name}? This removes the extension folder from Browser.`)) {- return;- }+ const safeName = name.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);+ const confirmed = await showConfirmDialog({+ title: "Delete extension",+ message: `Delete ${safeName}? This removes the extension folder from Browser.`,+ confirmText: "Delete",+ type: "danger",+ });+ if (!confirmed) return;this.extensionDeleteLoadingPath = path;try {diff --git a/tests/test_browser_agent_regressions.py b/tests/test_browser_agent_regressions.pyindex 262019baf..c8317d835 100644--- a/tests/test_browser_agent_regressions.py+++ b/tests/test_browser_agent_regressions.py@@ -1238,6 +1238,10 @@ def test_browser_extension_settings_stay_user_facing():assert "extensionDeleteTitle(extension)" in config_htmlassert "deleteExtension(extension)" in config_htmlassert "Delete extension" in config_store+ assert 'import { showConfirmDialog } from "/js/confirmDialog.js";' in config_store+ assert "const safeName = name.replace" in config_store+ assert "const confirmed = await showConfirmDialog({" in config_store+ assert "globalThis.confirm" not in config_storeassert "<textarea" not in config_htmlassert "Enabled extension directories" not in config_htmlassert "Chrome Web Store URL installs" not in config_html