From 803c7ba8a7088103d4eae83401f8372e7c7983a3 Mon Sep 17 00:00:00 2001 From: Matt Gajownik Date: Sat, 11 Nov 2023 17:52:13 +1100 Subject: [PATCH] Don't allow browser docks to arbitrarily close OBS --- panel/browser-panel-client.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panel/browser-panel-client.cpp b/panel/browser-panel-client.cpp index 7523faf2b..f5d5a3040 100644 --- a/panel/browser-panel-client.cpp +++ b/panel/browser-panel-client.cpp @@ -405,6 +405,12 @@ void QCefBrowserClient::OnLoadEnd(CefRefPtr, frame->ExecuteJavaScript(widget->script, CefString(), 0); else if (!script.empty()) frame->ExecuteJavaScript(script, CefString(), 0); + + std::string script2 = "window.close = () => "; + script2 += "console.log("; + script2 += "'OBS browser docks cannot be closed using JavaScript.'"; + script2 += ");"; + frame->ExecuteJavaScript(script2, "", 0); } bool QCefBrowserClient::OnJSDialog(CefRefPtr, const CefString &,