Skip to content

Truly independent web browser

LibJS: Make the flag to log all exceptions atomic

Andreas Kling34bbe44c35d2
diff --git a/Libraries/LibJS/Runtime/Completion.cpp b/Libraries/LibJS/Runtime/Completion.cpp
index 6d97ce8023e..237b2fc8f8c 100644
--- a/Libraries/LibJS/Runtime/Completion.cpp
+++ b/Libraries/LibJS/Runtime/Completion.cpp
@@ -5,6 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/Atomic.h>
#include <AK/Format.h>
#include <LibJS/EmbeddingABIConversions.h>
#include <LibJS/Runtime/Completion.h>
@@ -14,7 +15,7 @@ namespace JS {
using namespace EmbeddingABI;
-static bool s_log_all_js_exceptions = false;
+static Atomic<bool, AK::MemoryOrder::memory_order_relaxed> s_log_all_js_exceptions { false };
// Raw native functions, which JS_DEFINE_NATIVE_FUNCTION defines, return a ThrowCompletionOr<Value> straight to the
// Rust interpreter, which reads it as the embedding ABI's JSCompletion: the value or the thrown value in the first