Truly independent web browser
LibJS: Hold the bindings of a debugger frame in a ConservativeVector
Shannon Boothf59434bcefb4
diff --git a/Libraries/LibJS/Debugger.cpp b/Libraries/LibJS/Debugger.cppindex 9ebe29181b8..fc3e864d6e5 100644--- a/Libraries/LibJS/Debugger.cpp+++ b/Libraries/LibJS/Debugger.cpp@@ -134,7 +134,7 @@ bool Debugger::is_paused() conststatic void append_frame_binding(void* context, JSDebuggerFrameBinding const* binding){VERIFY(binding);- auto& bindings = *static_cast<Vector<Debugger::FrameBinding>*>(context);+ auto& bindings = *static_cast<GC::ConservativeVector<Debugger::FrameBinding>*>(context);bindings.append({.name = Utf16FlyString::from_utf16(utf16_view_from_abi(binding->name)),.value = value_from_abi(binding->value),@@ -142,10 +142,9 @@ static void append_frame_binding(void* context, JSDebuggerFrameBinding const* bi});}-// The values are the frame's own, which the paused frame keeps alive.-Vector<Debugger::FrameBinding> Debugger::bindings_for_frame(ExecutionContext const& execution_context) const+GC::ConservativeVector<Debugger::FrameBinding> Debugger::bindings_for_frame(ExecutionContext const& execution_context) const{- Vector<FrameBinding> bindings;+ GC::ConservativeVector<FrameBinding> bindings;JSDebuggerFrameBindingSink sink { .context = &bindings, .append = append_frame_binding };js_debugger_bindings_for_frame(vm_to_abi(vm()), execution_context_to_abi(execution_context), &sink);return bindings;diff --git a/Libraries/LibJS/Debugger.h b/Libraries/LibJS/Debugger.hindex 95ae650fbb7..a0039d661f4 100644--- a/Libraries/LibJS/Debugger.h+++ b/Libraries/LibJS/Debugger.h@@ -10,6 +10,7 @@#include <AK/HashMap.h>#include <AK/Utf16View.h>#include <AK/Vector.h>+#include <LibGC/ConservativeVector.h>#include <LibGC/Root.h>#include <LibGC/WeakHashSet.h>#include <LibJS/Breakpoint.h>@@ -79,7 +80,7 @@ public:// Continue after the host filters out a pause without cancelling an active step operation.void continue_execution_preserving_step_state();bool is_paused() const;- Vector<FrameBinding> bindings_for_frame(ExecutionContext const&) const;+ GC::ConservativeVector<FrameBinding> bindings_for_frame(ExecutionContext const&) const;ThrowCompletionOr<Value> evaluate_in_frame(ExecutionContext&, Utf16View source_text, UpdateOriginalBindings = UpdateOriginalBindings::Yes);void request_pause_on_next_bytecode_execution();