LibGC: Rename MarkedVector => RootVector

Let's try to make it a bit more clear that this is a Vector of GC roots.
This commit is contained in:
Andreas Kling 2024-12-26 14:32:52 +01:00 committed by Andreas Kling
commit 3bfb0534be
Notes: github-actions[bot] 2024-12-26 18:11:36 +00:00
117 changed files with 281 additions and 281 deletions

View file

@ -797,7 +797,7 @@ Optional<CSS::Selector::PseudoElement::Type> KeyframeEffect::pseudo_element_type
}
// https://www.w3.org/TR/web-animations-1/#dom-keyframeeffect-getkeyframes
WebIDL::ExceptionOr<GC::MarkedVector<JS::Object*>> KeyframeEffect::get_keyframes()
WebIDL::ExceptionOr<GC::RootVector<JS::Object*>> KeyframeEffect::get_keyframes()
{
if (m_keyframe_objects.size() != m_keyframes.size()) {
auto& vm = this->vm();
@ -832,7 +832,7 @@ WebIDL::ExceptionOr<GC::MarkedVector<JS::Object*>> KeyframeEffect::get_keyframes
}
}
GC::MarkedVector<JS::Object*> keyframes { heap() };
GC::RootVector<JS::Object*> keyframes { heap() };
for (auto const& keyframe : m_keyframe_objects)
keyframes.append(keyframe);
return keyframes;

View file

@ -97,7 +97,7 @@ public:
Bindings::CompositeOperation composite() const { return m_composite; }
void set_composite(Bindings::CompositeOperation value) { m_composite = value; }
WebIDL::ExceptionOr<GC::MarkedVector<JS::Object*>> get_keyframes();
WebIDL::ExceptionOr<GC::RootVector<JS::Object*>> get_keyframes();
WebIDL::ExceptionOr<void> set_keyframes(Optional<GC::Root<JS::Object>> const&);
KeyFrameSet const* key_frame_set() { return m_key_frame_set; }

View file

@ -709,7 +709,7 @@ void queue_mutation_observer_microtask(DOM::Document const& document)
custom_data.mutation_observer_microtask_queued = false;
// 2. Let notifySet be a clone of the surrounding agents mutation observers.
GC::MarkedVector<DOM::MutationObserver*> notify_set(heap);
GC::RootVector<DOM::MutationObserver*> notify_set(heap);
for (auto& observer : custom_data.mutation_observers)
notify_set.append(observer);

View file

@ -400,7 +400,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_prevent_extensions()
}
// https://webidl.spec.whatwg.org/#legacy-platform-object-ownpropertykeys
JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> PlatformObject::internal_own_property_keys() const
JS::ThrowCompletionOr<GC::RootVector<JS::Value>> PlatformObject::internal_own_property_keys() const
{
if (!m_legacy_platform_object_flags.has_value() || m_legacy_platform_object_flags->has_global_interface_extended_attribute)
return Base::internal_own_property_keys();
@ -408,7 +408,7 @@ JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> PlatformObject::internal_own_
auto& vm = this->vm();
// 1. Let keys be a new empty list of ECMAScript String and Symbol values.
GC::MarkedVector<JS::Value> keys { heap() };
GC::RootVector<JS::Value> keys { heap() };
// 2. If O supports indexed properties, then for each index of Os supported property indices, in ascending numerical order, append ! ToString(index) to keys.
if (m_legacy_platform_object_flags->supports_indexed_properties) {

View file

@ -40,7 +40,7 @@ public:
virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&, Optional<JS::PropertyDescriptor>* precomputed_get_own_property = nullptr) override;
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
virtual JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual JS::ThrowCompletionOr<GC::RootVector<JS::Value>> internal_own_property_keys() const override;
JS::ThrowCompletionOr<bool> is_named_property_exposed_on_object(JS::PropertyKey const&) const;

View file

@ -21,7 +21,7 @@ namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CSSRuleList);
GC::Ref<CSSRuleList> CSSRuleList::create(JS::Realm& realm, GC::MarkedVector<CSSRule*> const& rules)
GC::Ref<CSSRuleList> CSSRuleList::create(JS::Realm& realm, GC::RootVector<CSSRule*> const& rules)
{
auto rule_list = realm.create<CSSRuleList>(realm);
for (auto* rule : rules)

View file

@ -25,7 +25,7 @@ class CSSRuleList : public Bindings::PlatformObject {
GC_DECLARE_ALLOCATOR(CSSRuleList);
public:
[[nodiscard]] static GC::Ref<CSSRuleList> create(JS::Realm&, GC::MarkedVector<CSSRule*> const&);
[[nodiscard]] static GC::Ref<CSSRuleList> create(JS::Realm&, GC::RootVector<CSSRule*> const&);
[[nodiscard]] static GC::Ref<CSSRuleList> create_empty(JS::Realm&);
~CSSRuleList() = default;

View file

@ -218,7 +218,7 @@ GC::Ref<WebIDL::Promise> CSSStyleSheet::replace(String text)
auto& rules = parsed_stylesheet->rules();
// 2. If rules contains one or more @import rules, remove those rules from rules.
GC::MarkedVector<GC::Ref<CSSRule>> rules_without_import(realm.heap());
GC::RootVector<GC::Ref<CSSRule>> rules_without_import(realm.heap());
for (auto rule : rules) {
if (rule->type() != CSSRule::Type::Import)
rules_without_import.append(rule);
@ -252,7 +252,7 @@ WebIDL::ExceptionOr<void> CSSStyleSheet::replace_sync(StringView text)
auto& rules = parsed_stylesheet->rules();
// 3. If rules contains one or more @import rules, remove those rules from rules.
GC::MarkedVector<GC::Ref<CSSRule>> rules_without_import(realm().heap());
GC::RootVector<GC::Ref<CSSRule>> rules_without_import(realm().heap());
for (auto rule : rules) {
if (rule->type() != CSSRule::Type::Import)
rules_without_import.append(rule);

View file

@ -249,7 +249,7 @@ JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> FontFaceSet::load(String const&
// 4. Queue a task to run the following steps synchronously:
HTML::queue_a_task(HTML::Task::Source::FontLoading, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise, matched_font_faces] {
GC::MarkedVector<GC::Ref<WebIDL::Promise>> promises(realm.heap());
GC::RootVector<GC::Ref<WebIDL::Promise>> promises(realm.heap());
// 1. For all of the font faces in the font face list, call their load() method.
for (auto font_face_value : *matched_font_faces) {

View file

@ -624,7 +624,7 @@ GC::Ptr<CSSMediaRule> Parser::convert_to_media_rule(AtRule const& rule, Nested n
auto media_query_list = parse_a_media_query_list(media_query_tokens);
auto media_list = MediaList::create(m_context.realm(), move(media_query_list));
GC::MarkedVector<CSSRule*> child_rules { m_context.realm().heap() };
GC::RootVector<CSSRule*> child_rules { m_context.realm().heap() };
for (auto const& child : rule.child_rules_and_lists_of_declarations) {
child.visit(
[&](Rule const& rule) {

View file

@ -158,7 +158,7 @@ CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<URL::URL> location)
auto const& style_sheet = parse_a_stylesheet(m_token_stream, {});
// Interpret all of the resulting top-level qualified rules as style rules, defined below.
GC::MarkedVector<CSSRule*> rules(m_context.realm().heap());
GC::RootVector<CSSRule*> rules(m_context.realm().heap());
for (auto const& raw_rule : style_sheet.rules) {
auto rule = convert_to_rule(raw_rule, Nested::No);
// If any style rule is invalid, or any at-rule is not recognized or is invalid according to its grammar or context, its a parse error.

View file

@ -107,7 +107,7 @@ GC::Ptr<CSSStyleRule> Parser::convert_to_style_rule(QualifiedRule const& qualifi
return {};
}
GC::MarkedVector<CSSRule*> child_rules { m_context.realm().heap() };
GC::RootVector<CSSRule*> child_rules { m_context.realm().heap() };
for (auto& child : qualified_rule.child_rules) {
child.visit(
[&](Rule const& rule) {
@ -246,7 +246,7 @@ GC::Ptr<CSSRule> Parser::convert_to_layer_rule(AtRule const& rule, Nested nested
}
// Then the rules
GC::MarkedVector<CSSRule*> child_rules { m_context.realm().heap() };
GC::RootVector<CSSRule*> child_rules { m_context.realm().heap() };
for (auto const& child : rule.child_rules_and_lists_of_declarations) {
child.visit(
[&](Rule const& rule) {
@ -341,7 +341,7 @@ GC::Ptr<CSSKeyframesRule> Parser::convert_to_keyframes_rule(AtRule const& rule)
auto name = name_token.to_string();
GC::MarkedVector<CSSRule*> keyframes(m_context.realm().heap());
GC::RootVector<CSSRule*> keyframes(m_context.realm().heap());
rule.for_each_as_qualified_rule_list([&](auto& qualified_rule) {
if (!qualified_rule.child_rules.is_empty()) {
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: @keyframes keyframe rule contains at-rules; discarding them.");
@ -468,7 +468,7 @@ GC::Ptr<CSSSupportsRule> Parser::convert_to_supports_rule(AtRule const& rule, Ne
return {};
}
GC::MarkedVector<CSSRule*> child_rules { m_context.realm().heap() };
GC::RootVector<CSSRule*> child_rules { m_context.realm().heap() };
for (auto const& child : rule.child_rules_and_lists_of_declarations) {
child.visit(
[&](Rule const& rule) {

View file

@ -106,7 +106,7 @@ void Attr::handle_attribute_changes(Element& element, Optional<String> const& ol
if (element.is_custom()) {
auto& vm = this->vm();
GC::MarkedVector<JS::Value> arguments { vm.heap() };
GC::RootVector<JS::Value> arguments { vm.heap() };
arguments.append(JS::PrimitiveString::create(vm, local_name()));
arguments.append(!old_value.has_value() ? JS::js_null() : JS::PrimitiveString::create(vm, old_value.value()));
arguments.append(!new_value.has_value() ? JS::js_null() : JS::PrimitiveString::create(vm, new_value.value()));

View file

@ -15,7 +15,7 @@
#include <AK/StringBuilder.h>
#include <AK/Utf8View.h>
#include <LibCore/Timer.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/NativeFunction.h>
@ -1973,7 +1973,7 @@ void Document::adopt_node(Node& node)
if (element.is_custom()) {
auto& vm = this->vm();
GC::MarkedVector<JS::Value> arguments { vm.heap() };
GC::RootVector<JS::Value> arguments { vm.heap() };
arguments.append(&old_document);
arguments.append(this);
@ -4208,7 +4208,7 @@ void Document::run_the_update_intersection_observations_steps(HighResolutionTime
// 2. For each observer in observer list:
// NOTE: We make a copy of the intersection observers list to avoid modifying it while iterating.
GC::MarkedVector<GC::Ref<IntersectionObserver::IntersectionObserver>> intersection_observers(heap());
GC::RootVector<GC::Ref<IntersectionObserver::IntersectionObserver>> intersection_observers(heap());
intersection_observers.ensure_capacity(m_intersection_observers.size());
for (auto& observer : m_intersection_observers)
intersection_observers.append(observer);
@ -5058,10 +5058,10 @@ Element const* Document::element_from_point(double x, double y)
}
// https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint
GC::MarkedVector<GC::Ref<Element>> Document::elements_from_point(double x, double y)
GC::RootVector<GC::Ref<Element>> Document::elements_from_point(double x, double y)
{
// 1. Let sequence be a new empty sequence.
GC::MarkedVector<GC::Ref<Element>> sequence(heap());
GC::RootVector<GC::Ref<Element>> sequence(heap());
// 2. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any),
// or y is greater than the viewport height excluding the size of a rendered scroll bar (if any),
@ -5288,7 +5288,7 @@ size_t Document::broadcast_active_resize_observations()
// 2. For each observer in document.[[resizeObservers]] run these steps:
// NOTE: We make a copy of the resize observers list to avoid modifying it while iterating.
GC::MarkedVector<GC::Ref<ResizeObserver::ResizeObserver>> resize_observers(heap());
GC::RootVector<GC::Ref<ResizeObserver::ResizeObserver>> resize_observers(heap());
resize_observers.ensure_capacity(m_resize_observers.size());
for (auto const& observer : m_resize_observers)
resize_observers.append(observer);
@ -5300,7 +5300,7 @@ size_t Document::broadcast_active_resize_observations()
}
// 2. Let entries be an empty list of ResizeObserverEntryies.
GC::MarkedVector<GC::Ref<ResizeObserver::ResizeObserverEntry>> entries(heap());
GC::RootVector<GC::Ref<ResizeObserver::ResizeObserverEntry>> entries(heap());
// 3. For each observation in [[activeTargets]] perform these steps:
for (auto const& observation : observer->active_targets()) {

View file

@ -662,7 +662,7 @@ public:
WebIDL::ExceptionOr<void> set_design_mode(String const&);
Element const* element_from_point(double x, double y);
GC::MarkedVector<GC::Ref<Element>> elements_from_point(double x, double y);
GC::RootVector<GC::Ref<Element>> elements_from_point(double x, double y);
GC::Ptr<Element const> scrolling_element() const;
void set_needs_to_resolve_paint_only_properties() { m_needs_to_resolve_paint_only_properties = true; }

View file

@ -2107,7 +2107,7 @@ void Element::enqueue_a_custom_element_upgrade_reaction(HTML::CustomElementDefin
enqueue_an_element_on_the_appropriate_element_queue();
}
void Element::enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::MarkedVector<JS::Value> arguments)
void Element::enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::RootVector<JS::Value> arguments)
{
// 1. Let definition be element's custom element definition.
auto& definition = m_custom_element_definition;
@ -2164,7 +2164,7 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(GC::Ref<HTML::CustomElement
auto const* attribute = m_attributes->item(attribute_index);
VERIFY(attribute);
GC::MarkedVector<JS::Value> arguments { vm.heap() };
GC::RootVector<JS::Value> arguments { vm.heap() };
arguments.append(JS::PrimitiveString::create(vm, attribute->local_name()));
arguments.append(JS::js_null());
@ -2176,7 +2176,7 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(GC::Ref<HTML::CustomElement
// 5. If element is connected, then enqueue a custom element callback reaction with element, callback name "connectedCallback", and « ».
if (is_connected()) {
GC::MarkedVector<JS::Value> empty_arguments { vm.heap() };
GC::RootVector<JS::Value> empty_arguments { vm.heap() };
enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::connectedCallback, move(empty_arguments));
}

View file

@ -72,7 +72,7 @@ struct CustomElementUpgradeReaction {
// A callback reaction, which will call a lifecycle callback, and contains a callback function as well as a list of arguments.
struct CustomElementCallbackReaction {
GC::Root<WebIDL::CallbackType> callback;
GC::MarkedVector<JS::Value> arguments;
GC::RootVector<JS::Value> arguments;
};
// https://dom.spec.whatwg.org/#concept-element-custom-element-state
@ -306,7 +306,7 @@ public:
bool has_referenced_and_hidden_ancestor() const;
void enqueue_a_custom_element_upgrade_reaction(HTML::CustomElementDefinition& custom_element_definition);
void enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::MarkedVector<JS::Value> arguments);
void enqueue_a_custom_element_callback_reaction(FlyString const& callback_name, GC::RootVector<JS::Value> arguments);
using CustomElementReactionQueue = Vector<Variant<CustomElementUpgradeReaction, CustomElementCallbackReaction>>;
CustomElementReactionQueue* custom_element_reaction_queue() { return m_custom_element_reaction_queue; }

View file

@ -98,10 +98,10 @@ void HTMLCollection::update_cache_if_needed() const
m_cached_dom_tree_version = root()->document().dom_tree_version();
}
GC::MarkedVector<GC::Ref<Element>> HTMLCollection::collect_matching_elements() const
GC::RootVector<GC::Ref<Element>> HTMLCollection::collect_matching_elements() const
{
update_cache_if_needed();
GC::MarkedVector<GC::Ref<Element>> elements(heap());
GC::RootVector<GC::Ref<Element>> elements(heap());
for (auto& element : m_cached_elements)
elements.append(element);
return elements;

View file

@ -38,7 +38,7 @@ public:
Element* item(size_t index) const;
Element* named_item(FlyString const& key) const;
GC::MarkedVector<GC::Ref<Element>> collect_matching_elements() const;
GC::RootVector<GC::Ref<Element>> collect_matching_elements() const;
virtual Optional<JS::Value> item_value(size_t index) const override;
virtual JS::Value named_item_value(FlyString const& name) const override;

View file

@ -35,9 +35,9 @@ void LiveNodeList::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_root);
}
GC::MarkedVector<Node*> LiveNodeList::collection() const
GC::RootVector<Node*> LiveNodeList::collection() const
{
GC::MarkedVector<Node*> nodes(heap());
GC::RootVector<Node*> nodes(heap());
if (m_scope == Scope::Descendants) {
m_root->for_each_in_subtree([&](auto& node) {
if (m_filter(node))

View file

@ -38,7 +38,7 @@ protected:
private:
virtual void visit_edges(Cell::Visitor&) override;
GC::MarkedVector<Node*> collection() const;
GC::RootVector<Node*> collection() const;
GC::Ref<Node const> m_root;
Function<bool(Node const&)> m_filter;

View file

@ -673,7 +673,7 @@ void Node::insert_before(GC::Ref<Node> node, GC::Ptr<Node> child, bool suppress_
// 1. If inclusiveDescendant is custom, then enqueue a custom element callback reaction with inclusiveDescendant,
// callback name "connectedCallback", and an empty argument list.
if (element.is_custom()) {
GC::MarkedVector<JS::Value> empty_arguments { vm().heap() };
GC::RootVector<JS::Value> empty_arguments { vm().heap() };
element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::connectedCallback, move(empty_arguments));
}
@ -702,7 +702,7 @@ void Node::insert_before(GC::Ref<Node> node, GC::Ptr<Node> child, bool suppress_
// the post-connection steps while were traversing the node tree. This is because the post-connection
// steps can modify the trees structure, making live traversal unsafe, possibly leading to the
// post-connection steps being called multiple times on the same node.
GC::MarkedVector<GC::Ref<Node>> static_node_list(heap());
GC::RootVector<GC::Ref<Node>> static_node_list(heap());
// 11. For each node of nodes, in tree order:
for (auto& node : nodes) {
@ -882,7 +882,7 @@ void Node::remove(bool suppress_observers)
auto& element = static_cast<DOM::Element&>(*this);
if (element.is_custom() && is_parent_connected) {
GC::MarkedVector<JS::Value> empty_arguments { vm().heap() };
GC::RootVector<JS::Value> empty_arguments { vm().heap() };
element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::disconnectedCallback, move(empty_arguments));
}
}
@ -898,7 +898,7 @@ void Node::remove(bool suppress_observers)
auto& element = static_cast<DOM::Element&>(descendant);
if (element.is_custom() && is_parent_connected) {
GC::MarkedVector<JS::Value> empty_arguments { vm().heap() };
GC::RootVector<JS::Value> empty_arguments { vm().heap() };
element.enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::disconnectedCallback, move(empty_arguments));
}
}

View file

@ -1105,7 +1105,7 @@ WebIDL::ExceptionOr<void> Range::delete_contents()
}
// 4. Let nodes to remove be a list of all the nodes that are contained in this, in tree order, omitting any node whose parent is also contained in this.
GC::MarkedVector<Node*> nodes_to_remove(heap());
GC::RootVector<Node*> nodes_to_remove(heap());
for (GC::Ptr<Node> node = start_container(); node != end_container()->next_sibling(); node = node->next_in_pre_order()) {
if (contains_node(*node) && (!node->parent_node() || !contains_node(*node->parent_node())))
nodes_to_remove.append(node);

View file

@ -1645,7 +1645,7 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> http_network_or_cache_fetch(JS::Re
// 5. Let storedResponse be null.
GC::Ptr<Infrastructure::Response> stored_response;
GC::MarkedVector<GC::Ptr<Infrastructure::Response>> initial_set_of_stored_responses(realm.heap());
GC::RootVector<GC::Ptr<Infrastructure::Response>> initial_set_of_stored_responses(realm.heap());
// 6. Let httpCache be null.
// (Typeless until we actually implement it, needed for checks below)

View file

@ -8,7 +8,7 @@
#include <AK/Badge.h>
#include <AK/String.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/AudioTrack.h>

View file

@ -121,7 +121,7 @@ WebIDL::ExceptionOr<void> BroadcastChannel::post_message(JS::Value message)
auto source_storage_key = Web::StorageAPI::obtain_a_storage_key_for_non_storage_purposes(relevant_settings_object(*this));
// 6. Let destinations be a list of BroadcastChannel objects that match the following criteria:
GC::MarkedVector<GC::Ref<BroadcastChannel>> destinations(vm.heap());
GC::RootVector<GC::Ref<BroadcastChannel>> destinations(vm.heap());
// * The result of running obtain a storage key for non-storage purposes with their relevant settings object equals sourceStorageKey.
auto same_origin_broadcast_channels = s_broadcast_channel_repository.registered_channels_for_key(source_storage_key);

View file

@ -31,7 +31,7 @@ void CloseWatcherManager::add(GC::Ref<CloseWatcher> close_watcher)
// If manager's groups's size is less than manager's allowed number of groups
if (m_groups.size() < m_allowed_number_of_groups) {
// then append « closeWatcher » to manager's groups.
GC::MarkedVector<GC::Ref<CloseWatcher>> new_group(realm().heap());
GC::RootVector<GC::Ref<CloseWatcher>> new_group(realm().heap());
new_group.append(close_watcher);
m_groups.append(move(new_group));
} else {
@ -68,7 +68,7 @@ bool CloseWatcherManager::process_close_watchers()
auto& group = m_groups.last();
// Ambiguous spec wording. We copy the groups to avoid modifying the original while iterating.
// See https://github.com/whatwg/html/issues/10240
GC::MarkedVector<GC::Ref<CloseWatcher>> group_copy(realm().heap());
GC::RootVector<GC::Ref<CloseWatcher>> group_copy(realm().heap());
group_copy.ensure_capacity(group.size());
for (auto& close_watcher : group) {
group_copy.append(close_watcher);

View file

@ -237,13 +237,13 @@ JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM& vm, JS::Object& object, JS:
}
// 7.2.3.7 CrossOriginOwnPropertyKeys ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-)
GC::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<HTML::Location const*, HTML::Window const*> const& object)
GC::RootVector<JS::Value> cross_origin_own_property_keys(Variant<HTML::Location const*, HTML::Window const*> const& object)
{
auto& event_loop = HTML::main_thread_event_loop();
auto& vm = event_loop.vm();
// 1. Let keys be a new empty List.
auto keys = GC::MarkedVector<JS::Value> { vm.heap() };
auto keys = GC::RootVector<JS::Value> { vm.heap() };
// 2. For each e of CrossOriginProperties(O), append e.[[Property]] to keys.
for (auto& entry : cross_origin_properties(object))

View file

@ -21,6 +21,6 @@ bool is_platform_object_same_origin(JS::Object const&);
Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HTML::Location*, HTML::Window*> const&, JS::PropertyKey const&);
JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::VM&, JS::Object const&, JS::PropertyKey const&, JS::Value receiver);
JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM&, JS::Object&, JS::PropertyKey const&, JS::Value, JS::Value receiver);
GC::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<HTML::Location const*, HTML::Window const*> const&);
GC::RootVector<JS::Value> cross_origin_own_property_keys(Variant<HTML::Location const*, HTML::Window const*> const&);
}

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/EventLoop/TaskQueue.h>
@ -63,9 +63,9 @@ void TaskQueue::remove_tasks_matching(Function<bool(HTML::Task const&)> filter)
});
}
GC::MarkedVector<GC::Ref<Task>> TaskQueue::take_tasks_matching(Function<bool(HTML::Task const&)> filter)
GC::RootVector<GC::Ref<Task>> TaskQueue::take_tasks_matching(Function<bool(HTML::Task const&)> filter)
{
GC::MarkedVector<GC::Ref<Task>> matching_tasks(heap());
GC::RootVector<GC::Ref<Task>> matching_tasks(heap());
for (size_t i = 0; i < m_tasks.size();) {
auto& task = m_tasks.at(i);

View file

@ -37,7 +37,7 @@ public:
}
void remove_tasks_matching(Function<bool(HTML::Task const&)>);
GC::MarkedVector<GC::Ref<Task>> take_tasks_matching(Function<bool(HTML::Task const&)>);
GC::RootVector<GC::Ref<Task>> take_tasks_matching(Function<bool(HTML::Task const&)>);
Task const* last_added_task() const;

View file

@ -84,9 +84,9 @@ static bool is_all_named_element(DOM::Element const& element)
|| is<HTML::HTMLTextAreaElement>(element);
}
GC::MarkedVector<GC::Ref<DOM::Element>> HTMLAllCollection::collect_matching_elements() const
GC::RootVector<GC::Ref<DOM::Element>> HTMLAllCollection::collect_matching_elements() const
{
GC::MarkedVector<GC::Ref<DOM::Element>> elements(m_root->heap());
GC::RootVector<GC::Ref<DOM::Element>> elements(m_root->heap());
if (m_scope == Scope::Descendants) {
m_root->for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
if (m_filter(element))

View file

@ -32,7 +32,7 @@ public:
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> item(Optional<FlyString> const& name_or_index) const;
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> named_item(FlyString const& name) const;
GC::MarkedVector<GC::Ref<DOM::Element>> collect_matching_elements() const;
GC::RootVector<GC::Ref<DOM::Element>> collect_matching_elements() const;
virtual Optional<JS::Value> item_value(size_t index) const override;
virtual JS::Value named_item_value(FlyString const& name) const override;

View file

@ -1037,7 +1037,7 @@ static void update_the_source_set(DOM::Element& element)
TODO();
// 2. Let elements be « el ».
GC::MarkedVector<DOM::Element*> elements(element.heap());
GC::RootVector<DOM::Element*> elements(element.heap());
elements.append(&element);
// 3. If el is an img element whose parent node is a picture element,

View file

@ -1863,12 +1863,12 @@ void HTMLMediaElement::time_marches_on(TimeMarchesOnReason reason)
}
// https://html.spec.whatwg.org/multipage/media.html#take-pending-play-promises
GC::MarkedVector<GC::Ref<WebIDL::Promise>> HTMLMediaElement::take_pending_play_promises()
GC::RootVector<GC::Ref<WebIDL::Promise>> HTMLMediaElement::take_pending_play_promises()
{
// 1. Let promises be an empty list of promises.
// 2. Copy the media element's list of pending play promises to promises.
// 3. Clear the media element's list of pending play promises.
GC::MarkedVector<GC::Ref<WebIDL::Promise>> promises(heap());
GC::RootVector<GC::Ref<WebIDL::Promise>> promises(heap());
promises.extend(move(m_pending_play_promises));
// 4. Return promises.

View file

@ -11,7 +11,7 @@
#include <AK/Optional.h>
#include <AK/Time.h>
#include <AK/Variant.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibGfx/Rect.h>
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
#include <LibWeb/HTML/CORSSettingAttribute.h>
@ -207,7 +207,7 @@ private:
};
void time_marches_on(TimeMarchesOnReason = TimeMarchesOnReason::NormalPlayback);
GC::MarkedVector<GC::Ref<WebIDL::Promise>> take_pending_play_promises();
GC::RootVector<GC::Ref<WebIDL::Promise>> take_pending_play_promises();
void resolve_pending_play_promises(ReadonlySpan<GC::Ref<WebIDL::Promise>> promises);
void reject_pending_play_promises(ReadonlySpan<GC::Ref<WebIDL::Promise>> promises, GC::Ref<WebIDL::DOMException> error);

View file

@ -7,7 +7,7 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/PropertyDescriptor.h>
#include <LibJS/Runtime/PropertyKey.h>
@ -596,7 +596,7 @@ JS::ThrowCompletionOr<bool> Location::internal_delete(JS::PropertyKey const& pro
}
// 7.10.5.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/history.html#location-ownpropertykeys
JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> Location::internal_own_property_keys() const
JS::ThrowCompletionOr<GC::RootVector<JS::Value>> Location::internal_own_property_keys() const
{
// 1. If IsPlatformObjectSameOrigin(this) is true, then return OrdinaryOwnPropertyKeys(this).
if (HTML::is_platform_object_same_origin(*this))

View file

@ -63,7 +63,7 @@ public:
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override;
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override;
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual JS::ThrowCompletionOr<GC::RootVector<JS::Value>> internal_own_property_keys() const override;
HTML::CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
HTML::CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }

View file

@ -66,7 +66,7 @@ Variant<GC::Root<WindowProxy>, GC::Root<MessagePort>, Empty> MessageEvent::sourc
GC::Ref<JS::Object> MessageEvent::ports() const
{
if (!m_ports_array) {
GC::MarkedVector<JS::Value> port_vector(heap());
GC::RootVector<JS::Value> port_vector(heap());
for (auto const& port : m_ports)
port_vector.append(port);

View file

@ -1131,7 +1131,7 @@ bool Navigation::inner_navigate_event_firing_algorithm(
// 33. If endResultIsSameDocument is true:
if (end_result_is_same_document) {
// 1. Let promisesList be an empty list.
GC::MarkedVector<GC::Ref<WebIDL::Promise>> promises_list(realm.heap());
GC::RootVector<GC::Ref<WebIDL::Promise>> promises_list(realm.heap());
// 2. For each handler of event's navigation handler list:
for (auto const& handler : event->navigation_handler_list()) {

View file

@ -1040,7 +1040,7 @@ public:
private:
JS::VM& m_vm;
ReadonlySpan<u32> m_serialized;
GC::MarkedVector<JS::Value> m_memory; // Index -> JS value
GC::RootVector<JS::Value> m_memory; // Index -> JS value
size_t m_position { 0 };
static GC::Ref<Bindings::PlatformObject> create_serialized_type(StringView interface_name, JS::Realm& realm)

View file

@ -10,7 +10,7 @@
namespace Web::HTML {
using DeserializationMemory = GC::MarkedVector<JS::Value>;
using DeserializationMemory = GC::RootVector<JS::Value>;
using SerializationRecord = Vector<u32>;
using SerializationMemory = HashMap<GC::Root<JS::Value>, u32>;

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/TextTrack.h>

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/TextTrackCue.h>

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/TextTrack.h>

View file

@ -8,7 +8,7 @@
#include <AK/Badge.h>
#include <AK/String.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/VideoTrack.h>

View file

@ -526,7 +526,7 @@ void Window::consume_history_action_user_activation()
auto navigables = top->active_document()->inclusive_descendant_navigables();
// 4. Let windows be the list of Window objects constructed by taking the active window of each item in navigables.
GC::MarkedVector<GC::Ptr<Window>> windows(heap());
GC::RootVector<GC::Ptr<Window>> windows(heap());
for (auto& n : navigables)
windows.append(n->active_window());
@ -551,7 +551,7 @@ void Window::consume_user_activation()
auto navigables = top->active_document()->inclusive_descendant_navigables();
// 4. Let windows be the list of Window objects constructed by taking the active window of each item in navigables.
GC::MarkedVector<GC::Ptr<Window>> windows(heap());
GC::RootVector<GC::Ptr<Window>> windows(heap());
for (auto& n : navigables)
windows.append(n->active_window());

View file

@ -218,13 +218,13 @@ GC::Ref<WebIDL::Promise> WindowOrWorkerGlobalScopeMixin::fetch(Fetch::RequestInf
}
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
i32 WindowOrWorkerGlobalScopeMixin::set_timeout(TimerHandler handler, i32 timeout, GC::MarkedVector<JS::Value> arguments)
i32 WindowOrWorkerGlobalScopeMixin::set_timeout(TimerHandler handler, i32 timeout, GC::RootVector<JS::Value> arguments)
{
return run_timer_initialization_steps(move(handler), timeout, move(arguments), Repeat::No);
}
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
i32 WindowOrWorkerGlobalScopeMixin::set_interval(TimerHandler handler, i32 timeout, GC::MarkedVector<JS::Value> arguments)
i32 WindowOrWorkerGlobalScopeMixin::set_interval(TimerHandler handler, i32 timeout, GC::RootVector<JS::Value> arguments)
{
return run_timer_initialization_steps(move(handler), timeout, move(arguments), Repeat::Yes);
}
@ -254,7 +254,7 @@ void WindowOrWorkerGlobalScopeMixin::clear_map_of_active_timers()
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-initialisation-steps
// With no active script fix from https://github.com/whatwg/html/pull/9712
i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::MarkedVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id)
i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::RootVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id)
{
// 1. Let thisArg be global if that is a WorkerGlobalScope object; otherwise let thisArg be the WindowProxy that corresponds to global.
@ -697,7 +697,7 @@ GC::Ref<JS::Object> WindowOrWorkerGlobalScopeMixin::supported_entry_types() cons
auto& realm = this_impl().realm();
if (!m_supported_entry_types_array) {
GC::MarkedVector<JS::Value> supported_entry_types(vm.heap());
GC::RootVector<JS::Value> supported_entry_types(vm.heap());
#define __ENUMERATE_SUPPORTED_PERFORMANCE_ENTRY_TYPES(entry_type, cpp_class) \
supported_entry_types.append(JS::PrimitiveString::create(vm, entry_type));

View file

@ -40,8 +40,8 @@ public:
GC::Ref<WebIDL::Promise> create_image_bitmap(ImageBitmapSource image, WebIDL::Long sx, WebIDL::Long sy, WebIDL::Long sw, WebIDL::Long sh, Optional<ImageBitmapOptions> options = {}) const;
GC::Ref<WebIDL::Promise> fetch(Fetch::RequestInfo const&, Fetch::RequestInit const&) const;
i32 set_timeout(TimerHandler, i32 timeout, GC::MarkedVector<JS::Value> arguments);
i32 set_interval(TimerHandler, i32 timeout, GC::MarkedVector<JS::Value> arguments);
i32 set_timeout(TimerHandler, i32 timeout, GC::RootVector<JS::Value> arguments);
i32 set_interval(TimerHandler, i32 timeout, GC::RootVector<JS::Value> arguments);
void clear_timeout(i32);
void clear_interval(i32);
void clear_map_of_active_timers();
@ -86,7 +86,7 @@ private:
Yes,
No,
};
i32 run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::MarkedVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id = {});
i32 run_timer_initialization_steps(TimerHandler handler, i32 timeout, GC::RootVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id = {});
void run_steps_after_a_timeout_impl(i32 timeout, Function<void()> completion_step, Optional<i32> timer_key = {});
GC::Ref<WebIDL::Promise> create_image_bitmap_impl(ImageBitmapSource& image, Optional<WebIDL::Long> sx, Optional<WebIDL::Long> sy, Optional<WebIDL::Long> sw, Optional<WebIDL::Long> sh, Optional<ImageBitmapOptions>& options) const;

View file

@ -5,7 +5,7 @@
*/
#include <AK/Optional.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/PropertyDescriptor.h>
@ -228,7 +228,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_delete(JS::PropertyKey const&
}
// 7.4.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-ownpropertykeys
JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> WindowProxy::internal_own_property_keys() const
JS::ThrowCompletionOr<GC::RootVector<JS::Value>> WindowProxy::internal_own_property_keys() const
{
auto& event_loop = main_thread_event_loop();
auto& vm = event_loop.vm();
@ -236,7 +236,7 @@ JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> WindowProxy::internal_own_pro
// 1. Let W be the value of the [[Window]] internal slot of this.
// 2. Let keys be a new empty List.
auto keys = GC::MarkedVector<JS::Value> { vm.heap() };
auto keys = GC::RootVector<JS::Value> { vm.heap() };
// 3. Let maxProperties be W's associated Document's document-tree child navigables's size.
auto max_properties = m_window->associated_document().document_tree_child_navigables().size();

View file

@ -30,7 +30,7 @@ public:
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override;
virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override;
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
virtual JS::ThrowCompletionOr<GC::MarkedVector<JS::Value>> internal_own_property_keys() const override;
virtual JS::ThrowCompletionOr<GC::RootVector<JS::Value>> internal_own_property_keys() const override;
GC::Ptr<Window> window() const { return m_window; }
void set_window(GC::Ref<Window>);

View file

@ -5,7 +5,7 @@
*/
#include <AK/StringBuilder.h>
#include <LibGC/MarkedVector.h>
#include <LibGC/RootVector.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/VM.h>
@ -60,7 +60,7 @@ JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::
return JS::js_undefined();
}
auto output = TRY(generically_format_values(arguments.get<GC::MarkedVector<JS::Value>>()));
auto output = TRY(generically_format_values(arguments.get<GC::RootVector<JS::Value>>()));
m_console->output_debug_message(log_level, output);
return JS::js_undefined();
}

View file

@ -76,7 +76,7 @@ void ResizeObserverEntry::visit_edges(JS::Cell::Visitor& visitor)
static GC::Ref<JS::Object> to_js_array(JS::Realm& realm, Vector<GC::Ref<ResizeObserverSize>> const& sizes)
{
GC::MarkedVector<JS::Value> vector(realm.heap());
GC::RootVector<JS::Value> vector(realm.heap());
for (auto const& size : sizes)
vector.append(JS::Value(size.ptr()));

View file

@ -15,7 +15,7 @@
namespace Web::ServiceWorker {
struct Job;
using JobQueue = GC::MarkedVector<GC::Ref<Job>>;
using JobQueue = GC::RootVector<GC::Ref<Job>>;
// https://w3c.github.io/ServiceWorker/#dfn-job
// FIXME: Consider not making this GC allocated, and give a special JobQueue class responsibility for its referenced GC objects

View file

@ -208,7 +208,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
cache.add_imported_object(function);
Wasm::HostFunction host_function {
[&](auto&, auto& arguments) -> Wasm::Result {
GC::MarkedVector<JS::Value> argument_values { vm.heap() };
GC::RootVector<JS::Value> argument_values { vm.heap() };
size_t index = 0;
for (auto& entry : arguments) {
argument_values.append(to_js_value(vm, entry, type.parameters()[index]));
@ -425,7 +425,7 @@ JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress add
return to_js_value(vm, result.values().first(), type.results().first());
// Put result values into a JS::Array in reverse order.
auto js_result_values = GC::MarkedVector<JS::Value> { realm.heap() };
auto js_result_values = GC::RootVector<JS::Value> { realm.heap() };
js_result_values.ensure_capacity(result.values().size());
for (size_t i = result.values().size(); i > 0; i--) {

View file

@ -381,18 +381,18 @@ bool is_element_obscured(ReadonlySpan<GC::Ref<Web::DOM::Element>> paint_tree, We
}
// https://w3c.github.io/webdriver/#dfn-pointer-interactable-paint-tree
GC::MarkedVector<GC::Ref<Web::DOM::Element>> pointer_interactable_tree(Web::HTML::BrowsingContext& browsing_context, Web::DOM::Element& element)
GC::RootVector<GC::Ref<Web::DOM::Element>> pointer_interactable_tree(Web::HTML::BrowsingContext& browsing_context, Web::DOM::Element& element)
{
// 1. If element is not in the same tree as session's current browsing context's active document, return an empty sequence.
if (!browsing_context.active_document()->contains(element))
return GC::MarkedVector<GC::Ref<Web::DOM::Element>>(browsing_context.heap());
return GC::RootVector<GC::Ref<Web::DOM::Element>>(browsing_context.heap());
// 2. Let rectangles be the DOMRect sequence returned by calling getClientRects().
auto rectangles = element.get_client_rects();
// 3. If rectangles has the length of 0, return an empty sequence.
if (rectangles->length() == 0)
return GC::MarkedVector<GC::Ref<Web::DOM::Element>>(browsing_context.heap());
return GC::RootVector<GC::Ref<Web::DOM::Element>>(browsing_context.heap());
// 4. Let center point be the in-view center point of the first indexed element in rectangles.
auto viewport = browsing_context.page().top_level_traversable()->viewport_rect();

View file

@ -44,7 +44,7 @@ bool is_element_non_typeable_form_control(Web::DOM::Element const&);
bool is_element_in_view(ReadonlySpan<GC::Ref<Web::DOM::Element>> paint_tree, Web::DOM::Element&);
bool is_element_obscured(ReadonlySpan<GC::Ref<Web::DOM::Element>> paint_tree, Web::DOM::Element&);
GC::MarkedVector<GC::Ref<Web::DOM::Element>> pointer_interactable_tree(Web::HTML::BrowsingContext&, Web::DOM::Element&);
GC::RootVector<GC::Ref<Web::DOM::Element>> pointer_interactable_tree(Web::HTML::BrowsingContext&, Web::DOM::Element&);
ByteString get_or_create_a_shadow_root_reference(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&);
JsonObject shadow_root_reference_object(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&);

View file

@ -84,7 +84,7 @@ static JS::ThrowCompletionOr<JS::Value> execute_a_function_body(HTML::BrowsingCo
return completion;
}
void execute_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete)
void execute_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete)
{
auto const* document = browsing_context.active_document();
auto& realm = document->realm();
@ -142,7 +142,7 @@ void execute_script(HTML::BrowsingContext const& browsing_context, ByteString bo
}
// https://w3c.github.io/webdriver/#execute-async-script
void execute_async_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete)
void execute_async_script(HTML::BrowsingContext const& browsing_context, ByteString body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete)
{
auto const* document = browsing_context.active_document();
auto& realm = document->realm();

View file

@ -23,7 +23,7 @@ struct ExecutionResult {
using OnScriptComplete = GC::Function<void(ExecutionResult)>;
void execute_script(HTML::BrowsingContext const&, ByteString body, GC::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
void execute_async_script(HTML::BrowsingContext const&, ByteString body, GC::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
void execute_script(HTML::BrowsingContext const&, ByteString body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
void execute_async_script(HTML::BrowsingContext const&, ByteString body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
}

View file

@ -253,7 +253,7 @@ static Response internal_json_clone(HTML::BrowsingContext const& browsing_contex
// -> has an own property named "toJSON" that is a Function
if (auto to_json = object.get_without_side_effects(vm.names.toJSON); to_json.is_function()) {
// Return success with the value returned by Function.[[Call]](toJSON) with value as the this value.
auto to_json_result = TRY_OR_JS_ERROR(to_json.as_function().internal_call(value, GC::MarkedVector<JS::Value> { vm.heap() }));
auto to_json_result = TRY_OR_JS_ERROR(to_json.as_function().internal_call(value, GC::RootVector<JS::Value> { vm.heap() }));
if (!to_json_result.is_string())
return WebDriver::Error::from_code(ErrorCode::JavascriptError, "toJSON did not return a String"sv);

View file

@ -153,7 +153,7 @@ inline JS::Completion clean_up_on_return(JS::Realm& stored_realm, JS::Realm& rel
// https://webidl.spec.whatwg.org/#call-a-user-objects-operation
// https://whatpr.org/webidl/1437.html#call-a-user-objects-operation
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, GC::MarkedVector<JS::Value> args)
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, GC::RootVector<JS::Value> args)
{
// 1. Let completion be an uninitialized variable.
JS::Completion completion;
@ -255,7 +255,7 @@ JS::ThrowCompletionOr<String> to_usv_string(JS::VM& vm, JS::Value value)
// https://webidl.spec.whatwg.org/#invoke-a-callback-function
// https://whatpr.org/webidl/1437.html#invoke-a-callback-function
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, ExceptionBehavior exception_behavior, GC::MarkedVector<JS::Value> args)
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, ExceptionBehavior exception_behavior, GC::RootVector<JS::Value> args)
{
// https://webidl.spec.whatwg.org/#js-invoking-callback-functions
// The exceptionBehavior argument must be supplied if, and only if, callables return type is not a promise type. If callables return type is neither undefined nor any, it must be "rethrow".
@ -359,12 +359,12 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Valu
return return_steps(completion);
}
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, GC::MarkedVector<JS::Value> args)
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, GC::RootVector<JS::Value> args)
{
return invoke_callback(callback, move(this_argument), ExceptionBehavior::NotSpecified, move(args));
}
JS::Completion construct(WebIDL::CallbackType& callback, GC::MarkedVector<JS::Value> args)
JS::Completion construct(WebIDL::CallbackType& callback, GC::RootVector<JS::Value> args)
{
// 1. Let completion be an uninitialized variable.
JS::Completion completion;

View file

@ -21,7 +21,7 @@ bool is_buffer_source_type(JS::Value);
GC::Ptr<JS::ArrayBuffer> underlying_buffer_source(JS::Object& buffer_source);
ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source);
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, GC::MarkedVector<JS::Value> args);
JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, GC::RootVector<JS::Value> args);
JS::ThrowCompletionOr<String> to_string(JS::VM&, JS::Value);
JS::ThrowCompletionOr<String> to_usv_string(JS::VM&, JS::Value);
@ -33,7 +33,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String
{
auto& function_object = callback.callback;
GC::MarkedVector<JS::Value> arguments_list { function_object->heap() };
GC::RootVector<JS::Value> arguments_list { function_object->heap() };
(arguments_list.append(forward<Args>(args)), ...);
return call_user_object_operation(callback, operation_name, move(this_argument), move(arguments_list));
@ -45,8 +45,8 @@ enum class ExceptionBehavior {
Rethrow,
};
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, ExceptionBehavior exception_behavior, GC::MarkedVector<JS::Value> args);
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, GC::MarkedVector<JS::Value> args);
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, ExceptionBehavior exception_behavior, GC::RootVector<JS::Value> args);
JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, GC::RootVector<JS::Value> args);
// https://webidl.spec.whatwg.org/#invoke-a-callback-function
template<typename... Args>
@ -54,7 +54,7 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Valu
{
auto& function_object = callback.callback;
GC::MarkedVector<JS::Value> arguments_list { function_object->heap() };
GC::RootVector<JS::Value> arguments_list { function_object->heap() };
(arguments_list.append(forward<Args>(args)), ...);
return invoke_callback(callback, move(this_argument), exception_behavior, move(arguments_list));
@ -66,7 +66,7 @@ JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Valu
return invoke_callback(callback, move(this_argument), ExceptionBehavior::NotSpecified, forward<Args>(args)...);
}
JS::Completion construct(WebIDL::CallbackType& callback, GC::MarkedVector<JS::Value> args);
JS::Completion construct(WebIDL::CallbackType& callback, GC::RootVector<JS::Value> args);
// https://webidl.spec.whatwg.org/#construct-a-callback-function
template<typename... Args>
@ -74,7 +74,7 @@ JS::Completion construct(WebIDL::CallbackType& callback, Args&&... args)
{
auto& function_object = callback.callback;
GC::MarkedVector<JS::Value> arguments_list { function_object->heap() };
GC::RootVector<JS::Value> arguments_list { function_object->heap() };
(arguments_list.append(forward<Args>(args)), ...);
return construct(callback, move(arguments_list));