LibJS+LibWeb: Rename Heap::allocate_without_realm to Heap::allocate

Now that the heap has no knowledge about a JavaScript realm and is
purely for managing the memory of the heap, it does not make sense
to name this function to say that it is a non-realm variant.
This commit is contained in:
Shannon Booth 2024-11-14 06:13:46 +13:00 committed by Tim Flynn
commit 1e54003cb1
Notes: github-actions[bot] 2024-11-13 21:52:39 +00:00
115 changed files with 243 additions and 243 deletions

View file

@ -139,7 +139,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
auto& vm = group->vm();
// 1. Let browsingContext be a new browsing context.
JS::NonnullGCPtr<BrowsingContext> browsing_context = *vm.heap().allocate_without_realm<BrowsingContext>(page);
JS::NonnullGCPtr<BrowsingContext> browsing_context = *vm.heap().allocate<BrowsingContext>(page);
// 2. Let unsafeContextCreationTime be the unsafe shared current time.
[[maybe_unused]] auto unsafe_context_creation_time = HighResolutionTime::unsafe_shared_current_time();

View file

@ -43,7 +43,7 @@ auto BrowsingContextGroup::create_a_new_browsing_context_group_and_document(JS::
{
// 1. Let group be a new browsing context group.
// 2. Append group to the user agent's browsing context group set.
auto group = Bindings::main_thread_vm().heap().allocate_without_realm<BrowsingContextGroup>(page);
auto group = Bindings::main_thread_vm().heap().allocate<BrowsingContextGroup>(page);
// 3. Let browsingContext and document be the result of creating a new browsing context and document with null, null, and group.
auto [browsing_context, document] = TRY(BrowsingContext::create_a_new_browsing_context_and_document(page, nullptr, nullptr, group));

View file

@ -52,7 +52,7 @@ static JS::ThrowCompletionOr<JS::NonnullGCPtr<WebIDL::CallbackType>> convert_val
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunction, value.to_string_without_side_effects());
// 2. Return the IDL callback function type value that represents a reference to the same object that V represents, with the incumbent settings object as the callback context.
return vm.heap().allocate_without_realm<WebIDL::CallbackType>(value.as_object(), HTML::incumbent_settings_object());
return vm.heap().allocate<WebIDL::CallbackType>(value.as_object(), HTML::incumbent_settings_object());
}
// https://webidl.spec.whatwg.org/#es-sequence

View file

@ -18,7 +18,7 @@ DocumentState::~DocumentState() = default;
JS::NonnullGCPtr<DocumentState> DocumentState::clone() const
{
JS::NonnullGCPtr<DocumentState> cloned = *heap().allocate_without_realm<DocumentState>();
JS::NonnullGCPtr<DocumentState> cloned = *heap().allocate<DocumentState>();
cloned->m_document = m_document;
cloned->m_history_policy_container = m_history_policy_container;
cloned->m_request_referrer = m_request_referrer;

View file

@ -30,8 +30,8 @@ JS_DEFINE_ALLOCATOR(EventLoop);
EventLoop::EventLoop(Type type)
: m_type(type)
{
m_task_queue = heap().allocate_without_realm<TaskQueue>(*this);
m_microtask_queue = heap().allocate_without_realm<TaskQueue>(*this);
m_task_queue = heap().allocate<TaskQueue>(*this);
m_microtask_queue = heap().allocate<TaskQueue>(*this);
m_rendering_task_function = JS::create_heap_function(heap(), [this] {
update_the_rendering();

View file

@ -22,7 +22,7 @@ static IDAllocator s_unique_task_source_allocator { static_cast<int>(Task::Sourc
JS::NonnullGCPtr<Task> Task::create(JS::VM& vm, Source source, JS::GCPtr<DOM::Document const> document, JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)
{
return vm.heap().allocate_without_realm<Task>(source, document, move(steps));
return vm.heap().allocate<Task>(source, document, move(steps));
}
Task::Task(Source source, JS::GCPtr<DOM::Document const> document, JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)

View file

@ -31,7 +31,7 @@ void HTMLAudioElement::initialize(JS::Realm& realm)
JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::AudioBox>(document(), *this, move(style));
return heap().allocate<Layout::AudioBox>(document(), *this, move(style));
}
void HTMLAudioElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -29,7 +29,7 @@ void HTMLBRElement::initialize(JS::Realm& realm)
JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style));
return heap().allocate<Layout::BreakNode>(document(), *this, move(style));
}
void HTMLBRElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -132,7 +132,7 @@ WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
JS::GCPtr<Layout::Node> HTMLCanvasElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::CanvasBox>(document(), *this, move(style));
return heap().allocate<Layout::CanvasBox>(document(), *this, move(style));
}
void HTMLCanvasElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -215,7 +215,7 @@ WebIDL::ExceptionOr<void> HTMLDialogElement::show_modal()
return JS::js_undefined();
},
0, "", &realm());
auto cancel_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*cancel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto cancel_callback = realm().heap().allocate<WebIDL::CallbackType>(*cancel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
m_close_watcher->add_event_listener_without_options(HTML::EventNames::cancel, DOM::IDLEventListener::create(realm(), cancel_callback));
// - closeAction being to close the dialog given this and null.
auto close_callback_function = JS::NativeFunction::create(
@ -225,7 +225,7 @@ WebIDL::ExceptionOr<void> HTMLDialogElement::show_modal()
return JS::js_undefined();
},
0, "", &realm());
auto close_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*close_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto close_callback = realm().heap().allocate<WebIDL::CallbackType>(*close_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
m_close_watcher->add_event_listener_without_options(HTML::EventNames::close, DOM::IDLEventListener::create(realm(), close_callback));
// FIXME: 16. Set this's previously focused element to the focused element.

View file

@ -35,7 +35,7 @@ void HTMLIFrameElement::initialize(JS::Realm& realm)
JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
return heap().allocate<Layout::FrameBox>(document(), *this, move(style));
}
void HTMLIFrameElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -114,7 +114,7 @@ void HTMLImageElement::form_associated_element_attribute_changed(FlyString const
JS::GCPtr<Layout::Node> HTMLImageElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
return heap().allocate<Layout::ImageBox>(document(), *this, move(style), *this);
}
void HTMLImageElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -106,7 +106,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(CSS::StylePropertie
// NOTE: Image inputs are `appearance: none` per the default UA style,
// but we still need to create an ImageBox for them, or no image will get loaded.
if (type_state() == TypeAttributeState::ImageButton) {
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
return heap().allocate<Layout::ImageBox>(document(), *this, move(style), *this);
}
// https://drafts.csswg.org/css-ui/#appearance-switching
@ -118,13 +118,13 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(CSS::StylePropertie
}
if (type_state() == TypeAttributeState::SubmitButton || type_state() == TypeAttributeState::Button || type_state() == TypeAttributeState::ResetButton)
return heap().allocate_without_realm<Layout::BlockContainer>(document(), this, move(style));
return heap().allocate<Layout::BlockContainer>(document(), this, move(style));
if (type_state() == TypeAttributeState::Checkbox)
return heap().allocate_without_realm<Layout::CheckBox>(document(), *this, move(style));
return heap().allocate<Layout::CheckBox>(document(), *this, move(style));
if (type_state() == TypeAttributeState::RadioButton)
return heap().allocate_without_realm<Layout::RadioButton>(document(), *this, move(style));
return heap().allocate<Layout::RadioButton>(document(), *this, move(style));
return Element::create_layout_node_for_display_type(document(), style.display(), style, this);
}
@ -898,7 +898,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto mouseup_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto mouseup_callback = realm().heap().allocate<WebIDL::CallbackType>(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
DOM::AddEventListenerOptions mouseup_listener_options;
mouseup_listener_options.once = true;
@ -911,7 +911,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto step_up_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*up_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto step_up_callback = realm().heap().allocate<WebIDL::CallbackType>(*up_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
up_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_up_callback));
up_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback));
@ -933,7 +933,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto step_down_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*down_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto step_down_callback = realm().heap().allocate<WebIDL::CallbackType>(*down_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
down_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), step_down_callback));
down_button->add_event_listener_without_options(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback));
}
@ -992,7 +992,7 @@ void HTMLInputElement::create_file_input_shadow_tree()
};
auto on_button_click_function = JS::NativeFunction::create(realm, move(on_button_click), 0, "", &realm);
auto on_button_click_callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(on_button_click_function, Bindings::principal_host_defined_environment_settings_object(realm));
auto on_button_click_callback = realm.heap().allocate<WebIDL::CallbackType>(on_button_click_function, Bindings::principal_host_defined_environment_settings_object(realm));
m_file_button->add_event_listener_without_options(UIEvents::EventNames::click, DOM::IDLEventListener::create(realm, on_button_click_callback));
update_file_input_shadow_tree();
@ -1064,7 +1064,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto keydown_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*keydown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto keydown_callback = realm().heap().allocate<WebIDL::CallbackType>(*keydown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
add_event_listener_without_options(UIEvents::EventNames::keydown, DOM::IDLEventListener::create(realm(), keydown_callback));
auto wheel_callback_function = JS::NativeFunction::create(
@ -1079,7 +1079,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto wheel_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*wheel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto wheel_callback = realm().heap().allocate<WebIDL::CallbackType>(*wheel_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
add_event_listener_without_options(UIEvents::EventNames::wheel, DOM::IDLEventListener::create(realm(), wheel_callback));
auto update_slider_by_mouse = [this](JS::VM& vm) {
@ -1102,7 +1102,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto mousemove_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*mousemove_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto mousemove_callback = realm().heap().allocate<WebIDL::CallbackType>(*mousemove_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto mousemove_listener = DOM::IDLEventListener::create(realm(), mousemove_callback);
auto& window = static_cast<HTML::Window&>(relevant_global_object(*this));
window.add_event_listener_without_options(UIEvents::EventNames::mousemove, mousemove_listener);
@ -1114,7 +1114,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto mouseup_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto mouseup_callback = realm().heap().allocate<WebIDL::CallbackType>(*mouseup_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
DOM::AddEventListenerOptions mouseup_listener_options;
mouseup_listener_options.once = true;
window.add_event_listener(UIEvents::EventNames::mouseup, DOM::IDLEventListener::create(realm(), mouseup_callback), mouseup_listener_options);
@ -1122,7 +1122,7 @@ void HTMLInputElement::create_range_input_shadow_tree()
return JS::js_undefined();
},
0, "", &realm());
auto mousedown_callback = realm().heap().allocate_without_realm<WebIDL::CallbackType>(*mousedown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
auto mousedown_callback = realm().heap().allocate<WebIDL::CallbackType>(*mousedown_callback_function, Bindings::principal_host_defined_environment_settings_object(realm()));
add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), mousedown_callback));
}

View file

@ -29,7 +29,7 @@ void HTMLLabelElement::initialize(JS::Realm& realm)
JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::Label>(document(), this, move(style));
return heap().allocate<Layout::Label>(document(), this, move(style));
}
// https://html.spec.whatwg.org/multipage/forms.html#labeled-control

View file

@ -147,7 +147,7 @@ JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(CSS::StyleProperti
return nullptr;
case Representation::Image:
if (image_data())
return heap().allocate_without_realm<Layout::ImageBox>(document(), *this, move(style), *this);
return heap().allocate<Layout::ImageBox>(document(), *this, move(style), *this);
break;
default:
break;

View file

@ -65,7 +65,7 @@ void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String>
JS::GCPtr<Layout::Node> HTMLVideoElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate_without_realm<Layout::VideoBox>(document(), *this, move(style));
return heap().allocate<Layout::VideoBox>(document(), *this, move(style));
}
void HTMLVideoElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -55,7 +55,7 @@ class ResponseHolder : public JS::Cell {
public:
[[nodiscard]] static JS::NonnullGCPtr<ResponseHolder> create(JS::VM& vm)
{
return vm.heap().allocate_without_realm<ResponseHolder>();
return vm.heap().allocate<ResponseHolder>();
}
[[nodiscard]] JS::GCPtr<Fetch::Infrastructure::Response> response() const { return m_response; }
@ -176,7 +176,7 @@ ErrorOr<void> Navigable::initialize_navigable(JS::NonnullGCPtr<DocumentState> do
VERIFY(document_state->document());
// 2. Let entry be a new session history entry, with
JS::NonnullGCPtr<SessionHistoryEntry> entry = *heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> entry = *heap().allocate<SessionHistoryEntry>();
// URL: document's URL
entry->set_url(document_state->document()->url());
// document state: documentState
@ -678,7 +678,7 @@ static WebIDL::ExceptionOr<JS::NonnullGCPtr<NavigationParams>> create_navigation
// opener policy: coop
// FIXME: navigation timing type: navTimingType
// about base URL: entry's document state's about base URL
auto navigation_params = vm.heap().allocate_without_realm<NavigationParams>();
auto navigation_params = vm.heap().allocate<NavigationParams>();
navigation_params->id = move(navigation_id);
navigation_params->navigable = navigable;
navigation_params->response = response;
@ -955,7 +955,7 @@ static WebIDL::ExceptionOr<Navigable::NavigationParamsVariant> create_navigation
// resource: oldDocState's resource
// ever populated: oldDocState's ever populated
// navigable target name: oldDocState's navigable target name
auto new_document_state = navigable->heap().allocate_without_realm<DocumentState>();
auto new_document_state = navigable->heap().allocate<DocumentState>();
new_document_state->set_history_policy_container(old_doc_state->history_policy_container());
new_document_state->set_request_referrer(old_doc_state->request_referrer());
new_document_state->set_request_referrer_policy(old_doc_state->request_referrer_policy());
@ -990,7 +990,7 @@ static WebIDL::ExceptionOr<Navigable::NavigationParamsVariant> create_navigation
// - source snapshot has transient activation: sourceSnapshotParams's has transient activation
// - initiator origin: responseOrigin
// FIXME: - navigation timing type: navTimingType
auto navigation_params = vm.heap().allocate_without_realm<NonFetchSchemeNavigationParams>();
auto navigation_params = vm.heap().allocate<NonFetchSchemeNavigationParams>();
navigation_params->id = navigation_id;
navigation_params->navigable = navigable;
navigation_params->url = location_url.release_value().value();
@ -1044,7 +1044,7 @@ static WebIDL::ExceptionOr<Navigable::NavigationParamsVariant> create_navigation
// COOP enforcement result: coopEnforcementResult
// FIXME: navigation timing type: navTimingType
// about base URL: entry's document state's about base URL
auto navigation_params = vm.heap().allocate_without_realm<NavigationParams>();
auto navigation_params = vm.heap().allocate<NavigationParams>();
navigation_params->id = navigation_id;
navigation_params->navigable = navigable;
navigation_params->request = request;
@ -1112,7 +1112,7 @@ WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(
// - source snapshot has transient activation: sourceSnapshotParams's has transient activation
// - initiator origin: entry's document state's initiator origin
// FIXME: - navigation timing type: navTimingType
auto non_fetching_scheme_navigation_params = vm().heap().allocate_without_realm<NonFetchSchemeNavigationParams>();
auto non_fetching_scheme_navigation_params = vm().heap().allocate<NonFetchSchemeNavigationParams>();
non_fetching_scheme_navigation_params->id = navigation_id;
non_fetching_scheme_navigation_params->navigable = this;
non_fetching_scheme_navigation_params->url = entry->url();
@ -1437,7 +1437,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
// initiator origin: initiatorOriginSnapshot
// resource: documentResource
// navigable target name: navigable's target name
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate_without_realm<DocumentState>();
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate<DocumentState>();
document_state->set_request_referrer_policy(referrer_policy);
document_state->set_initiator_origin(initiator_origin_snapshot);
document_state->set_resource(document_resource);
@ -1458,7 +1458,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
}
// 6. Let historyEntry be a new session history entry, with its URL set to url and its document state set to documentState.
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = *heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = *heap().allocate<SessionHistoryEntry>();
history_entry->set_url(url);
history_entry->set_document_state(document_state);
@ -1521,7 +1521,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(URL::URL const& url,
// document state: navigable's active session history entry's document state
// navigation API state: destinationNavigationAPIState
// scroll restoration mode: navigable's active session history entry's scroll restoration mode
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = heap().allocate<SessionHistoryEntry>();
history_entry->set_url(url);
history_entry->set_document_state(active_session_history_entry()->document_state());
history_entry->set_navigation_api_state(destination_navigation_api_state);
@ -1668,7 +1668,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url
// opener policy: coop
// FIXME: navigation timing type: "navigate"
// about base URL: targetNavigable's active document's about base URL
auto navigation_params = vm.heap().allocate_without_realm<NavigationParams>();
auto navigation_params = vm.heap().allocate<NavigationParams>();
navigation_params->id = navigation_id;
navigation_params->navigable = this;
navigation_params->request = {};
@ -1734,7 +1734,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(URL::URL const
// resource: null
// ever populated: true
// navigable target name: oldDocState's navigable target name
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate_without_realm<DocumentState>();
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate<DocumentState>();
document_state->set_document(new_document);
document_state->set_history_policy_container(old_doc_state->history_policy_container());
document_state->set_request_referrer(old_doc_state->request_referrer());
@ -1748,7 +1748,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(URL::URL const
// 12. Let historyEntry be a new session history entry, with
// URL: entryToReplace's URL
// document state: documentState
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = *heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> history_entry = *heap().allocate<SessionHistoryEntry>();
history_entry->set_url(entry_to_replace->url());
history_entry->set_document_state(document_state);
@ -1939,7 +1939,7 @@ void perform_url_and_history_update_steps(DOM::Document& document, URL::URL new_
// document state: activeEntry's document state
// scroll restoration mode: activeEntry's scroll restoration mode
// FIXME: persisted user state: activeEntry's persisted user state
JS::NonnullGCPtr<SessionHistoryEntry> new_entry = document.heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> new_entry = document.heap().allocate<SessionHistoryEntry>();
new_entry->set_url(new_url);
new_entry->set_classic_history_api_state(serialized_data.value_or(active_entry->classic_history_api_state()));
new_entry->set_document_state(active_entry->document_state());

View file

@ -86,7 +86,7 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable(JS::GCP
// - origin: document's origin
// - navigable target name: targetName
// - about base URL: document's about base URL
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate_without_realm<HTML::DocumentState>();
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate<HTML::DocumentState>();
document_state->set_document(document);
document_state->set_initiator_origin(document->origin());
document_state->set_origin(document->origin());
@ -95,7 +95,7 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable(JS::GCP
document_state->set_about_base_url(document->about_base_url());
// 7. Let navigable be a new navigable.
JS::NonnullGCPtr<Navigable> navigable = *heap().allocate_without_realm<Navigable>(page);
JS::NonnullGCPtr<Navigable> navigable = *heap().allocate<Navigable>(page);
// 8. Initialize the navigable navigable given documentState and parentNavigable.
TRY_OR_THROW_OOM(vm(), navigable->initialize_navigable(document_state, parent_navigable));

View file

@ -548,7 +548,7 @@ JS::NonnullGCPtr<NavigationAPIMethodTracker> Navigation::maybe_set_the_upcoming_
// comitted-to entry: null
// comitted promise: committedPromise
// finished promise: finishedPromise
auto api_method_tracker = vm.heap().allocate_without_realm<NavigationAPIMethodTracker>(
auto api_method_tracker = vm.heap().allocate<NavigationAPIMethodTracker>(
/* .navigation = */ *this,
/* .key = */ OptionalNone {},
/* .info = */ info,
@ -597,7 +597,7 @@ JS::NonnullGCPtr<NavigationAPIMethodTracker> Navigation::add_an_upcoming_travers
// comitted-to entry: null
// comitted promise: committedPromise
// finished promise: finishedPromise
auto api_method_tracker = vm.heap().allocate_without_realm<NavigationAPIMethodTracker>(
auto api_method_tracker = vm.heap().allocate<NavigationAPIMethodTracker>(
/* .navigation = */ *this,
/* .key = */ destination_key,
/* .info = */ info,

View file

@ -4526,21 +4526,21 @@ Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& cont
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& document)
{
return document.heap().allocate_without_realm<HTMLParser>(document);
return document.heap().allocate<HTMLParser>(document);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input, Optional<MimeSniff::MimeType> maybe_mime_type)
{
if (document.has_encoding())
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value().to_byte_string());
return document.heap().allocate<HTMLParser>(document, input, document.encoding().value().to_byte_string());
auto encoding = run_encoding_sniffing_algorithm(document, input, maybe_mime_type);
dbgln_if(HTML_PARSER_DEBUG, "The encoding sniffing algorithm returned encoding '{}'", encoding);
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
return document.heap().allocate<HTMLParser>(document, input, encoding);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, StringView encoding)
{
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
return document.heap().allocate<HTMLParser>(document, input, encoding);
}
enum class AttributeMode {

View file

@ -35,7 +35,7 @@ JS::NonnullGCPtr<ClassicScript> ClassicScript::create(ByteString filename, Strin
// 3. Let script be a new classic script that this algorithm will subsequently initialize.
// 4. Set script's realm to realm.
// 5. Set script's base URL to baseURL.
auto script = vm.heap().allocate_without_realm<ClassicScript>(move(base_url), move(filename), realm);
auto script = vm.heap().allocate<ClassicScript>(move(base_url), move(filename), realm);
// FIXME: 6. Set script's fetch options to options.

View file

@ -49,7 +49,7 @@ EnvironmentSettingsObject::~EnvironmentSettingsObject()
void EnvironmentSettingsObject::initialize(JS::Realm& realm)
{
Base::initialize(realm);
m_module_map = realm.heap().allocate_without_realm<ModuleMap>();
m_module_map = realm.heap().allocate<ModuleMap>();
}
void EnvironmentSettingsObject::visit_edges(Cell::Visitor& visitor)

View file

@ -949,7 +949,7 @@ void fetch_descendants_of_and_link_a_module_script(JS::Realm& realm,
}
// 3. Let state be Record { [[ParseError]]: null, [[Destination]]: destination, [[PerformFetch]]: null, [[FetchClient]]: fetchClient }.
auto state = realm.heap().allocate_without_realm<FetchContext>(JS::js_null(), destination, nullptr, fetch_client);
auto state = realm.heap().allocate<FetchContext>(JS::js_null(), destination, nullptr, fetch_client);
// 4. If performFetch was given, set state.[[PerformFetch]] to performFetch.
state->perform_fetch = perform_fetch;

View file

@ -30,7 +30,7 @@ SessionHistoryEntry::SessionHistoryEntry()
JS::NonnullGCPtr<SessionHistoryEntry> SessionHistoryEntry::clone() const
{
JS::NonnullGCPtr<SessionHistoryEntry> entry = *heap().allocate_without_realm<SessionHistoryEntry>();
JS::NonnullGCPtr<SessionHistoryEntry> entry = *heap().allocate<SessionHistoryEntry>();
entry->m_step = m_step;
entry->m_url = m_url;
entry->m_document_state = m_document_state->clone();

View file

@ -14,7 +14,7 @@ JS_DEFINE_ALLOCATOR(SessionHistoryTraversalQueueEntry);
JS::NonnullGCPtr<SessionHistoryTraversalQueueEntry> SessionHistoryTraversalQueueEntry::create(JS::VM& vm, JS::NonnullGCPtr<JS::HeapFunction<void()>> steps, JS::GCPtr<HTML::Navigable> target_navigable)
{
return vm.heap().allocate_without_realm<SessionHistoryTraversalQueueEntry>(steps, target_navigable);
return vm.heap().allocate<SessionHistoryTraversalQueueEntry>(steps, target_navigable);
}
void SessionHistoryTraversalQueueEntry::visit_edges(JS::Cell::Visitor& visitor)

View file

@ -16,7 +16,7 @@ JS_DEFINE_ALLOCATOR(Timer);
JS::NonnullGCPtr<Timer> Timer::create(JS::Object& window_or_worker_global_scope, i32 milliseconds, Function<void()> callback, i32 id)
{
auto heap_function_callback = JS::create_heap_function(window_or_worker_global_scope.heap(), move(callback));
return window_or_worker_global_scope.heap().allocate_without_realm<Timer>(window_or_worker_global_scope, milliseconds, heap_function_callback, id);
return window_or_worker_global_scope.heap().allocate<Timer>(window_or_worker_global_scope, milliseconds, heap_function_callback, id);
}
Timer::Timer(JS::Object& window_or_worker_global_scope, i32 milliseconds, JS::NonnullGCPtr<JS::HeapFunction<void()>> callback, i32 id)

View file

@ -26,7 +26,7 @@ JS_DEFINE_ALLOCATOR(TraversableNavigable);
TraversableNavigable::TraversableNavigable(JS::NonnullGCPtr<Page> page)
: Navigable(page)
, m_session_history_traversal_queue(vm().heap().allocate_without_realm<SessionHistoryTraversalQueue>())
, m_session_history_traversal_queue(vm().heap().allocate<SessionHistoryTraversalQueue>())
{
#ifdef AK_OS_MACOS
auto display_list_player_type = page->client().display_list_player_type();
@ -94,7 +94,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable
}
// 4. Let documentState be a new document state, with
auto document_state = vm.heap().allocate_without_realm<DocumentState>();
auto document_state = vm.heap().allocate<DocumentState>();
// document: document
document_state->set_document(document);
@ -112,7 +112,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable
document_state->set_about_base_url(document->about_base_url());
// 5. Let traversable be a new traversable navigable.
auto traversable = vm.heap().allocate_without_realm<TraversableNavigable>(page);
auto traversable = vm.heap().allocate<TraversableNavigable>(page);
// 6. Initialize the navigable traversable given documentState.
TRY_OR_THROW_OOM(vm, traversable->initialize_navigable(document_state, nullptr));
@ -514,7 +514,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
auto target_entry = navigable->current_session_history_entry();
// 3. Let changingNavigableContinuation be a changing navigable continuation state with:
auto changing_navigable_continuation = vm.heap().allocate_without_realm<ChangingNavigableContinuationState>();
auto changing_navigable_continuation = vm.heap().allocate<ChangingNavigableContinuationState>();
changing_navigable_continuation->displayed_document = displayed_entry->document();
changing_navigable_continuation->target_entry = target_entry;
changing_navigable_continuation->navigable = navigable;